Message ID | 20230614155556.4095526-3-daire.mcnamara@microchip.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Krzysztof Wilczyński |
Headers | show |
Series | PCI: microchip: Fixes and clean-ups | expand |
[+CC Simon] Hello, > The kernel test robot reported that the ugly cast from > void(*)(struct clk *) to void (*)(void *) converts to incompatible > function type. This commit adopts the common convention of creating a > trivial stub function that takes a void * and passes it to the > underlying function that expects the more specific type. This is a nice change, but it seems it has been carried along a few other series and through their different revisions. Simon also found the problem and addressed it independently per: https://lore.kernel.org/linux-pci/20230511-pci-microchip-clk-cast-v1-1-7674f4d4e218@kernel.org However, we have a few other drivers where we could take care of this, per: drivers/pci/controller/pcie-microchip-host.c 864- return ERR_PTR(ret); 865- 866: devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare, 867- clk); 868- drivers/pci/controller/dwc/pcie-keembay.c 170- 171- ret = devm_add_action_or_reset(dev, 172: (void(*)(void *))clk_disable_unprepare, 173- clk); 174- if (ret) drivers/pci/controller/dwc/pci-meson.c 189- 190- devm_add_action_or_reset(dev, 191: (void (*) (void *))clk_disable_unprepare, 192- clk); 193- If neither you nor Simon has objections, I can send a small series to address these in a single take. You could then drop this particular patch from v2 of this series, should you send a second revision at some point. Thoughts? Krzysztof
On Sun, Jun 25, 2023 at 03:34:28AM +0900, Krzysztof Wilczyński wrote: > [+CC Simon] > > Hello, > > > The kernel test robot reported that the ugly cast from > > void(*)(struct clk *) to void (*)(void *) converts to incompatible > > function type. This commit adopts the common convention of creating a > > trivial stub function that takes a void * and passes it to the > > underlying function that expects the more specific type. > > This is a nice change, but it seems it has been carried along a few other > series and through their different revisions. Simon also found the problem > and addressed it independently per: > > https://lore.kernel.org/linux-pci/20230511-pci-microchip-clk-cast-v1-1-7674f4d4e218@kernel.org > > However, we have a few other drivers where we could take care of this, per: > > drivers/pci/controller/pcie-microchip-host.c > 864- return ERR_PTR(ret); > 865- > 866: devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare, > 867- clk); > 868- > > drivers/pci/controller/dwc/pcie-keembay.c > 170- > 171- ret = devm_add_action_or_reset(dev, > 172: (void(*)(void *))clk_disable_unprepare, > 173- clk); > 174- if (ret) > > drivers/pci/controller/dwc/pci-meson.c > 189- > 190- devm_add_action_or_reset(dev, > 191: (void (*) (void *))clk_disable_unprepare, > 192- clk); > 193- > > If neither you nor Simon has objections, I can send a small series to > address these in a single take. You could then drop this particular patch > from v2 of this series, should you send a second revision at some point. Hi Krzysztof, Sure, that is fine my me. My 2c worth, is that it would be nice to have a common helper for these cases. But I don't feel strongly about it.
diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/controller/pcie-microchip-host.c index dd5245904c87..73046bad1521 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -848,6 +848,13 @@ static const struct irq_domain_ops event_domain_ops = { .map = mc_pcie_event_map, }; +static inline void mc_pcie_chip_off_action(void *data) +{ + struct clk *clk = data; + + clk_disable_unprepare(clk); +} + static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id) { struct clk *clk; @@ -863,8 +870,7 @@ static inline struct clk *mc_pcie_init_clk(struct device *dev, const char *id) if (ret) return ERR_PTR(ret); - devm_add_action_or_reset(dev, (void (*) (void *))clk_disable_unprepare, - clk); + devm_add_action_or_reset(dev, mc_pcie_chip_off_action, clk); return clk; }