public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Zapolskiy <vz@mleia.com>
To: vadimp@mellanox.com, wsa@the-dreams.de
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	jiri@resnulli.us, Michael Shych <michaelsh@mellanox.com>
Subject: Re: [patch v3 1/1] i2c: add master driver for mellanox systems
Date: Fri, 4 Nov 2016 00:48:48 +0200	[thread overview]
Message-ID: <8c1a3c26-e24d-014a-7bee-98d08c76ecfe@mleia.com> (raw)
In-Reply-To: <4708bff8-db23-e9c3-197d-ab337affa080@mleia.com>

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

  reply	other threads:[~2016-11-03 22:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-03 18:50 [patch v3 1/1] i2c: add master driver for mellanox systems vadimp
2016-11-03 22:34 ` Vladimir Zapolskiy
2016-11-03 22:48   ` Vladimir Zapolskiy [this message]
2016-11-04  7:15   ` Vadim Pasternak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8c1a3c26-e24d-014a-7bee-98d08c76ecfe@mleia.com \
    --to=vz@mleia.com \
    --cc=jiri@resnulli.us \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michaelsh@mellanox.com \
    --cc=vadimp@mellanox.com \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox