Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1514906
| From | Vladimir Zapolskiy <vz@mleia.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [patch v3 1/1] i2c: add master driver for mellanox systems |
| Date | 2016-11-03 23:50 +0100 |
| Message-ID | <szyZz-1Cf-15@gated-at.bofh.it> (permalink) |
| References | <sztwS-6uq-29@gated-at.bofh.it> <szyPT-1y8-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 04.11.2016 00:34, Vladimir Zapolskiy wrote:
>> +
>> +static int mlxcpld_i2c_probe(struct platform_device *pdev)
>> +{
>> + struct mlxcpld_i2c_priv *priv;
>> + int err;
>> +
>> + priv = devm_kzalloc(&pdev->dev, sizeof(struct mlxcpld_i2c_priv),
>> + GFP_KERNEL);
>> + if (!priv)
>> + return -ENOMEM;
>> +
>> + mutex_init(&priv->lock);
>> + platform_set_drvdata(pdev, priv);
>> +
>> + priv->dev = &pdev->dev;
>> +
>> + /* Register with i2c layer */
>> + priv->adap = mlxcpld_i2c_adapter;
See a correction below.
>> + priv->adap.dev.parent = &pdev->dev;
>> + priv->adap.retries = MLXCPLD_I2C_RETR_NUM;
>> + priv->adap.nr = MLXCPLD_I2C_BUS_NUM;
>
> So since you want to allow the registration of only one such controller
> on a board (by the way in the opposite case it is also expected that
> "struct i2c_adapter" is allocated dynamically to avoid rewriting of
> data), you probably know the good reason behind it.
I've just noticed that you do a struct copy-on-assignment, while I think
it is very rarely used in the kernel sources (I don't know why), it cancels
my concern expressed above.
>
> But in that case you may consider to move .retries and .nr
> instantiation to the "static struct i2c_adapter" declaration above.
>
--
With best wishes,
Vladimir
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[patch v3 1/1] i2c: add master driver for mellanox systems vadimp@mellanox.com - 2016-11-03 18:00 +0100
Re: [patch v3 1/1] i2c: add master driver for mellanox systems Vladimir Zapolskiy <vz@mleia.com> - 2016-11-03 23:40 +0100
Re: [patch v3 1/1] i2c: add master driver for mellanox systems Vladimir Zapolskiy <vz@mleia.com> - 2016-11-03 23:50 +0100
RE: [patch v3 1/1] i2c: add master driver for mellanox systems Vadim Pasternak <vadimp@mellanox.com> - 2016-11-04 09:50 +0100
csiph-web