b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From 915f1d230e5292bc2156a9997bcb19d9e632f10b Mon Sep 17 00:00:00 2001 |
| 2 | From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl> |
| 3 | Date: Wed, 16 Dec 2020 15:33:05 +0100 |
| 4 | Subject: [PATCH] phy: phy-brcm-usb: specify init function format at struct |
| 5 | level |
| 6 | MIME-Version: 1.0 |
| 7 | Content-Type: text/plain; charset=UTF-8 |
| 8 | Content-Transfer-Encoding: 8bit |
| 9 | |
| 10 | This is slightly cleaner solution that assures noone assings a wrong |
| 11 | function to the pointer. |
| 12 | |
| 13 | Signed-off-by: Rafał Miłecki <rafal@milecki.pl> |
| 14 | Acked-by: Florian Fainelli <f.fainelli@gmail.com> |
| 15 | Link: https://lore.kernel.org/r/20201216143305.12179-2-zajec5@gmail.com |
| 16 | Signed-off-by: Vinod Koul <vkoul@kernel.org> |
| 17 | --- |
| 18 | drivers/phy/broadcom/phy-brcm-usb.c | 7 +++---- |
| 19 | 1 file changed, 3 insertions(+), 4 deletions(-) |
| 20 | |
| 21 | --- a/drivers/phy/broadcom/phy-brcm-usb.c |
| 22 | +++ b/drivers/phy/broadcom/phy-brcm-usb.c |
| 23 | @@ -35,7 +35,7 @@ struct value_to_name_map { |
| 24 | }; |
| 25 | |
| 26 | struct match_chip_info { |
| 27 | - void *init_func; |
| 28 | + void (*init_func)(struct brcm_usb_init_params *params); |
| 29 | u8 required_regs[BRCM_REGS_MAX + 1]; |
| 30 | u8 optional_reg; |
| 31 | }; |
| 32 | @@ -428,7 +428,6 @@ static int brcm_usb_phy_probe(struct pla |
| 33 | struct device_node *dn = pdev->dev.of_node; |
| 34 | int err; |
| 35 | const char *mode; |
| 36 | - void (*dvr_init)(struct brcm_usb_init_params *params); |
| 37 | const struct match_chip_info *info; |
| 38 | struct regmap *rmap; |
| 39 | int x; |
| 40 | @@ -444,8 +443,8 @@ static int brcm_usb_phy_probe(struct pla |
| 41 | info = of_device_get_match_data(&pdev->dev); |
| 42 | if (!info) |
| 43 | return -ENOENT; |
| 44 | - dvr_init = info->init_func; |
| 45 | - (*dvr_init)(&priv->ini); |
| 46 | + |
| 47 | + info->init_func(&priv->ini); |
| 48 | |
| 49 | dev_dbg(dev, "Best mapping table is for %s\n", |
| 50 | priv->ini.family_name); |