[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2wmlmymzxhf7ytpngbqgubka43rd4ytiwcffvwgaaf6gubvenz@w5gwxarev3r6>
Date: Wed, 18 Sep 2024 22:36:17 +0200
From: Andi Shyti <andi.shyti@...nel.org>
To: Chris Packham <chris.packham@...iedtelesis.co.nz>
Cc: robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
tsbogend@...ha.franken.de, linux-i2c@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-mips@...r.kernel.org
Subject: Re: [PATCH 5/5] i2c: rtl9300: Add multiplexing support
Hi Chris,
...
> -module_platform_driver(rtl9300_i2c_driver);
> +static int rtl9300_i2c_select_chan(struct i2c_mux_core *muxc, u32 chan)
> +{
> + struct i2c_adapter *adap = muxc->parent;
> + struct rtl9300_i2c *i2c = i2c_get_adapdata(adap);
> + int ret;
> +
> + ret = rtl9300_i2c_config_io(i2c, chan);
> + if (ret)
> + return ret;
> +
> + return 0;
return "rtl9300_i2c_config_io()"?
> +}
...
> +static int rtl9300_i2c_mux_probe_fw(struct rtl9300_i2c_chan *mux, struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct fwnode_handle *fwnode = dev_fwnode(dev);
> + struct device_node *np = dev->of_node;
> + struct device_node *adap_np;
> + struct i2c_adapter *adap = NULL;
> + struct fwnode_handle *child;
> + unsigned int *chans;
> + int i = 0;
> +
> + if (!is_of_node(fwnode))
> + return -EOPNOTSUPP;
> +
> + if (!np)
> + return -ENODEV;
> +
> + adap_np = of_parse_phandle(np, "i2c-parent", 0);
> + if (!adap_np) {
> + dev_err(&pdev->dev, "Cannot parse i2c-parent\n");
> + return -ENODEV;
return dev_err_probe(...)?
> + }
> + adap = of_find_i2c_adapter_by_node(adap_np);
> + of_node_put(adap_np);
...
> +static int __init rtl9300_i2c_init(void)
> +{
> + return platform_register_drivers(drivers, ARRAY_SIZE(drivers));
> +}
> +module_init(rtl9300_i2c_init);
> +
> +static void __exit rtl9300_i2c_exit(void)
> +{
> + platform_unregister_drivers(drivers, ARRAY_SIZE(drivers));
> +}
> +module_exit(rtl9300_i2c_exit);
You could use module_platform_driver()
Thanks,
Andi
>
> MODULE_DESCRIPTION("RTL9300 I2C controller driver");
> MODULE_LICENSE("GPL");
> --
> 2.46.1
>
Powered by blists - more mailing lists