netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
	netdev@vger.kernel.org, linux-net-drivers@solarflare.com
Subject: Re: [PATCH 1/2] sfc: Use kernel I2C system and i2c-algo-bit driver
Date: Sat, 31 May 2008 17:07:40 +0200	[thread overview]
Message-ID: <20080531170740.5f4606c5@hyperion.delvare> (raw)
In-Reply-To: <20080531112700.GL1743@solarflare.com>

On Sat, 31 May 2008 12:27:02 +0100, Ben Hutchings wrote:
> Jean Delvare wrote:
> > > @@ -2459,6 +2475,18 @@ int falcon_probe_nic(struct efx_nic *efx)
> > >  	if (rc)
> > >  		goto fail5;
> > >  
> > > +	/* Initialise I2C adapter */
> > > + 	efx->i2c_adap.owner = THIS_MODULE;
> > > + 	efx->i2c_adap.class = I2C_CLASS_HWMON;
> > 
> > I doubt you want to do this. This would let any hardware monitoring
> > driver probe your bus for a device, while presumably you already know
> > which hardware monitoring device is present and you want to instantiate
> > the i2c client yourself. This will probably become clearer when you
> > start using the lm87 driver and modify it to support new-style i2c
> > binding.
>  
> So the class should be, what, 0?

Yes. Assuming a kzalloc'd structure, you can simply omit it.

> > > +	nic_data->i2c_data = falcon_i2c_bit_operations;
> > > +	nic_data->i2c_data.data = efx;
> > > + 	efx->i2c_adap.algo_data = &nic_data->i2c_data;
> > > +	efx->i2c_adap.dev.parent = &efx->pci_dev->dev;
> > > +	strcpy(efx->i2c_adap.name, "SFC4000 GPIO");
> > 
> > Please always use strlcpy.
>  
> OK.  I thought about it but it didn't seem worthwhile for a short constant
> string.

Until someone changes the string for a longer one (it's common to
include the I/O base) or the structure field is shortened to save some
memory... Always use strlcpy. In fact I'd like to see strcpy removed
from the kernel, it's almost always the wrong function to use.

-- 
Jean Delvare

  reply	other threads:[~2008-05-31 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1212182201.git.bhutchings@solarflare.com>
2008-05-30 21:27 ` [PATCH 1/2] sfc: Use kernel I2C system and i2c-algo-bit driver Ben Hutchings
2008-05-31  2:19   ` Jeff Garzik
2008-05-31 11:18   ` Jean Delvare
2008-05-31 11:27     ` Ben Hutchings
2008-05-31 15:07       ` Jean Delvare [this message]
2008-05-30 21:27 ` [PATCH 2/2] sfc: Reduce I2C udelay to 5 resulting in a clock frequency of 100 kHz Ben Hutchings
2008-05-31 11:19   ` Jean Delvare

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=20080531170740.5f4606c5@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=bhutchings@solarflare.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-net-drivers@solarflare.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).