linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Juergen Beisert
	<j.beisert-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	David Brownell
	<dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>,
	Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH V2] gpio: add driver for MAX7300 I2C GPIO extender
Date: Thu, 19 Nov 2009 18:06:26 +0300	[thread overview]
Message-ID: <20091119150626.GA6057@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <1258639349-5457-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

On Thu, Nov 19, 2009 at 03:02:29PM +0100, Wolfram Sang wrote:
> Add the MAX7300-I2C variant to the MAX7301-SPI version. They share most parts
> of the driver (i.e. the logic) and the read/write-register functions get
> encapsulated. It is thus possible to use both variants simultaneously.
> 
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Juergen Beisert <j.beisert-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Anton Vorontsov <avorontsov-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
> Cc: Andrew Morton <akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
> ---

Wolfram, thanks for your work on this.

> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 2ad0128..a1d2608 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -65,6 +65,24 @@ config GPIO_SYSFS
>  
>  # put expanders in the right section, in alphabetical order
>  
> +comment "GPIO expanders for multiple busses"
> +
> +config GPIO_MAX7301
> +	tristate "Maxim MAX730x GPIO expander"

I believe this should be 'depends on I2C || SPI_MASTER'.

> +	help
> +	  GPIO driver for Maxim MAX7300/7301 GPIO expanders.
> +	  Also select which bus you want to use.
> +
> +if GPIO_MAX7301
> +config GPIO_MAX7301_I2C
> +	bool "I2C support (for MAX7300)"
> +	depends on I2C
> +
> +config GPIO_MAX7301_SPI
> +	bool "SPI support (for MAX7301)"
> +	depends on SPI_MASTER
> +endif
> +
>  comment "Memory mapped GPIO expanders:"
[...]
> +static int max7301_i2c_write(struct device *dev, unsigned int reg,
> +				unsigned int val)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);

This is a matter of taste, but I'd add an empty line here.

> +	return i2c_smbus_write_byte_data(client, reg, val);
> +}
> +
> +static int max7301_i2c_read(struct device *dev, unsigned int reg)
> +{
> +	struct i2c_client *client = to_i2c_client(dev);

And here.

> +	return i2c_smbus_read_byte_data(client, reg);
> +}
> +
> +static int __devinit max7300_probe(struct i2c_client *client,
> +			 const struct i2c_device_id *id)
> +{
[...]
> +#endif /* CONFIG_GPIO_MAX7301_I2C */
> +
>  static int __init max7301_init(void)
>  {
> -	return spi_register_driver(&max7301_driver);
> +	int ret;
> +	ret = max7300_add_driver(&max7300_driver);

Please add an empty line after 'int ret;'.


Thanks!

-- 
Anton Vorontsov
email: cbouatmailru-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
irc://irc.freenode.net/bd2

  parent reply	other threads:[~2009-11-19 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-18 12:17 [PATCH] gpio: add driver for MAX7300 I2C GPIO extender Wolfram Sang
     [not found] ` <1258546646-11586-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-11-18 23:10   ` [spi-devel-general] " Anton Vorontsov
     [not found]     ` <20091118231052.GA23699-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2009-11-19 14:02       ` [PATCH V2] " Wolfram Sang
     [not found]         ` <1258639349-5457-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-11-19 15:06           ` Anton Vorontsov [this message]
     [not found]             ` <20091119150626.GA6057-wnGakbxT3iijyJ0x5qLZdcN33GVbZNy3@public.gmane.org>
2009-11-20 10:56               ` [PATCH V3] " Wolfram Sang

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=20091119150626.GA6057@oksana.dev.rtsoft.ru \
    --to=avorontsov-hkdhdckh98+b+jhodadfcq@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=j.beisert-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    --cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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).