The 10/08/2021 13:56, Kavyasree Kotagiri wrote: > This adds Generic Clock Controller driver for lan966x SoC. Hi Kavya, > > +#define DIV_MAX 256 > + > +static const char *clk_names[N_CLOCKS] = { > + "qspi0", "qspi1", "qspi2", "sdmmc0", > + "pi", "mcan0", "mcan1", "flexcom0", > + "flexcom1", "flexcom2", "flexcom3", > + "flexcom4", "timer", "usb_refclk", > +}; Aren't these names a little bit generic, especially 'timer'? The problem that I am seeing, if there is another clock driver that register a clock with the same name, then this will fail. Here is the check for this[1] > + > +static int lan966x_clk_probe(struct platform_device *pdev) > +{ > + struct clk_hw_onecell_data *hw_data; > + struct device *dev = &pdev->dev; > + int i; > + > + hw_data = devm_kzalloc(dev, sizeof(*hw_data), GFP_KERNEL); Is this correct? Shouldn't be devm_kzalloc(dev, struct_size(hw_data, hws, N_CLOCKS), GFP_KERNEL); > + if (!hw_data) > + return -ENOMEM; > + > + base = devm_platform_ioremap_resource(pdev, 0); > + if (IS_ERR(base)) > + return PTR_ERR(base); > + > + init.ops = &lan966x_gck_ops; > + > + hw_data->num = N_CLOCKS; > + > + for (i = 0; i < N_CLOCKS; i++) { > + init.name = clk_names[i]; > + hw_data->hws[i] = lan966x_gck_clk_register(dev, i); > + if (IS_ERR(hw_data->hws[i])) { > + dev_err(dev, "failed to register %s clock\n", > + init.name); > + return PTR_ERR(hw_data->hws[i]); > + } > + } > + > + return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, hw_data); > +} > + > +static const struct of_device_id lan966x_clk_dt_ids[] = { > + { .compatible = "microchip,lan966x-gck", }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, lan966x_clk_dt_ids); > + > +static struct platform_driver lan966x_clk_driver = { > + .probe = lan966x_clk_probe, > + .driver = { > + .name = "lan966x-clk", > + .of_match_table = lan966x_clk_dt_ids, > + }, > +}; > +builtin_platform_driver(lan966x_clk_driver); > + > +MODULE_AUTHOR("Kavyasree Kotagiri <kavyasree.kotagiri@xxxxxxxxxxxxx>"); > +MODULE_DESCRIPTION("LAN966X clock driver"); > +MODULE_LICENSE("GPL v2"); > -- > 2.17.1 > [1] https://elixir.bootlin.com/linux/latest/source/drivers/clk/clk.c#L3423 -- /Horatiu