On Wed, May 21, 2025 at 4:08 AM Krzysztof Kozlowski <krzk@xxxxxxxxxx> wrote: > > On 21/05/2025 04:15, Rosen Penev wrote: > > - .name = "qca955x_wmac", > > - .driver_data = AR9300_DEVID_QCA955X, > > - }, > > - { > > - .name = "qca953x_wmac", > > - .driver_data = AR9300_DEVID_AR953X, > > - }, > > - { > > - .name = "qca956x_wmac", > > - .driver_data = AR9300_DEVID_QCA956X, > > - }, > > +static const struct of_device_id ath9k_of_match_table[] = { > > + { .compatible = "qca,ar9130-wmac", .data = (void *)AR5416_AR9100_DEVID }, > > + { .compatible = "qca,ar9330-wmac", .data = (void *)AR9300_DEVID_AR9330 }, > > + { .compatible = "qca,ar9340-wmac", .data = (void *)AR9300_DEVID_AR9340 }, > > + { .compatible = "qca,qca9530-wmac", .data = (void *)AR9300_DEVID_AR953X }, > > + { .compatible = "qca,qca9550-wmac", .data = (void *)AR9300_DEVID_QCA955X }, > > + { .compatible = "qca,qca9560-wmac", .data = (void *)AR9300_DEVID_QCA956X }, > > Undocumented ABI. Hrm wonder where to document. Documentation/devicetree/bindings/net/wireless/qca,ath9k.yaml sounds like the place but that file looks like it's for pci(e) only. This patch adds the bindings to ahb, not pci(e). > > Please run scripts/checkpatch.pl on the patches and fix reported > warnings. After that, run also 'scripts/checkpatch.pl --strict' on the > patches and (probably) fix more warnings. Some warnings can be ignored, > especially from --strict run, but the code here looks like it needs a > fix. Feel free to get in touch if the warning is not clear. > > > > {}, > > }; > > > > @@ -72,20 +55,16 @@ static const struct ath_bus_ops ath_ahb_bus_ops = { > > > > static int ath_ahb_probe(struct platform_device *pdev) > > { > > - const struct platform_device_id *id = platform_get_device_id(pdev); > > + const struct of_device_id *match; > > struct ieee80211_hw *hw; > > struct ath_softc *sc; > > struct ath_hw *ah; > > void __iomem *mem; > > char hw_name[64]; > > + u16 dev_id; > > int irq; > > int ret; > > > > - if (!dev_get_platdata(&pdev->dev)) { > > - dev_err(&pdev->dev, "no platform data specified\n"); > > - return -EINVAL; > > - } > > - > > mem = devm_platform_ioremap_resource(pdev, 0); > > if (IS_ERR(mem)) { > > dev_err(&pdev->dev, "ioremap failed\n"); > > @@ -118,7 +97,9 @@ static int ath_ahb_probe(struct platform_device *pdev) > > goto err_free_hw; > > } > > > > - ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); > > + match = of_match_device(ath9k_of_match_table, &pdev->dev); > > There is a wrapper for getting data, use it. I assume you mean of_device_get_match_data. Will do. > > > + dev_id = (uintptr_t)match->data; > > And dev_id is enum? Then you want kernel_ulong_t. The entries specified in data are macros in the form of 0xYYYY. This is why I used u16. The ath9k_init_device takes an int here. Interestingly enough in the newer ath drivers, it looks like these macros are placed in an enum. ath9k uses a u16 field in the struct. As for kernel_ulong_t, ath12k uses that, ath10k uintptr_t. I assume the former is more appropriate. > > > > > Best regards, > Krzysztof