Re: [PATCH v2 2/2] i2c: Add Tegra BPMP I2C proxy driver

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

 



Hi there,

> +static int tegra_bpmp_i2c_msg_len_check(struct i2c_msg *msgs, unsigned int num)
> +{
> +	size_t tx_len = 0, rx_len = 0;
> +	unsigned int i;
> +
> +	for (i = 0; i < num; i++)
> +		if (!(msgs[i].flags & I2C_M_RD))
> +			tx_len += SERIALI2C_HDR_SIZE + msgs[i].len;
> +
> +	if (tx_len > TEGRA_I2C_IPC_MAX_IN_BUF_SIZE)
> +		return -EINVAL;
> +
> +	for (i = 0; i < num; i++)
> +		if ((msgs[i].flags & I2C_M_RD))
> +			rx_len += msgs[i].len;

You could have done with iterating over all msgs only once, but no need
to fix. I think I'll update the i2c core quirks feature to support your
case and rework that incrementally.

> +	/* TODO: move this somewhere else */
> +	memset(&request, 0, sizeof(request));
> +	memset(&response, 0, sizeof(response));

So? :)

> +	i2c->adapter.class = I2C_CLASS_HWMON;

Do you really need that?

> +	err = i2c_add_adapter(&i2c->adapter);
> +	if (err < 0) {
> +		dev_err(&pdev->dev, "failed to add I2C adapter: %d\n", err);

No error message here, the core will do that.

> +static int __init tegra_bpmp_i2c_init_driver(void)
> +{
> +	return platform_driver_register(&tegra_bpmp_i2c_driver);
> +}
> +subsys_initcall(tegra_bpmp_i2c_init_driver);

Have you tried if subsys_initcall is really really necessary?

Thanks,

   Wolfram

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux