Re: [PATCH net-next v8 4/9] net: txgbe: Register I2C platform device

andy.shevchenko
2023-05-15T09:30:26Z

Mon, May 15, 2023 at 02:31:55PM +0800, Jiawen Wu kirjoitti:
> Register the platform device to use Designware I2C bus master driver.
> Use regmap to read/write I2C device region from given base offset.

...

> +#include <linux/platform_device.h>
> #include <linux/gpio/property.h>
> +#include <linux/regmap.h>

Perhaps keeping this ordered?

> #include <linux/clkdev.h>
> #include <linux/clk-provider.h>
> #include <linux/i2c.h>

...

> +static const struct regmap_config i2c_regmap_config = {
> + .reg_bits = 32,
> + .val_bits = 32,
> + .reg_read = txgbe_i2c_read,
> + .reg_write = txgbe_i2c_write,

fast_io = true;

? (Note, I haven't checked if IO accessors are really fast)

> +};

...

> + i2c_regmap = devm_regmap_init(&pdev->dev, NULL, wx,
> + &i2c_regmap_config);

This is exactly a single line (80 characters), why to have two?

> + if (IS_ERR(i2c_regmap)) {
> + wx_err(wx, "failed to init regmap\n");
> + return PTR_ERR(i2c_regmap);
> + }

...

> + res = DEFINE_RES_IRQ(pdev->irq);
> + info.res = &res;

You can do

info.res = &DEFINE_RES_IRQ(pdev->irq);

--
With Best Regards,
Andy Shevchenko