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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux