mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Peter Korsgaard <jacmet@sunsite.dk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] mcp23s08: add i2c support
Date: Thu, 14 Jul 2011 20:53:55 -0600	[thread overview]
Message-ID: <20110715025355.GX2927@ponder.secretlab.ca> (raw)
In-Reply-To: <1310673568-30577-4-git-send-email-jacmet@sunsite.dk>

On Thu, Jul 14, 2011 at 09:59:28PM +0200, Peter Korsgaard wrote:
> Add i2c bindings for the mcp230xx devices. This is quite a lot simpler
> than the spi ones as there's no funky sub addressing done (one struct
> i2c_client per struct gpio_chip).
> 
> The mcp23s08_platform_data structure is reused for i2c, even though
> only a single mcp23s08_chip_info structure is needed.
> 
> To make the platform data bus independent, the setup/teardown prototypes
> are slightly changed, so the bus specific struct (spi_device / i2c_client)
> is passed as a void pointer instead.
> 
> There's no in-tree users of these callbacks.

Why don't we just remove them then?  The notifier mechanism is more
generic anyway.

[...]
> @@ -537,9 +705,13 @@ static int __init mcp23s08_init(void)
>  		return ret;
>  #endif /* CONFIG_SPI_MASTER */
>  
> +#ifdef CONFIG_I2C
> +	ret = i2c_add_driver(&mcp230xx_driver);
> +#endif /* CONFIG_I2C */
> +

Need to unwind on failure to register, or put the i2c driver into a
separate module so that each module gets it's own init/exit hooks.

>  	return ret;
>  }
> -/* register after spi postcore initcall and before
> +/* register after spi/i2c postcore initcall and before
>   * subsys initcalls that may rely on these GPIOs
>   */
>  subsys_initcall(mcp23s08_init);
> @@ -550,6 +722,10 @@ static void __exit mcp23s08_exit(void)
>  	spi_unregister_driver(&mcp23s08_driver);
>  #endif /* CONFIG_SPI_MASTER */
>  
> +#ifdef CONFIG_I2C
> +	i2c_del_driver(&mcp230xx_driver);
> +#endif /* CONFIG_I2C */
> +
>  }
>  module_exit(mcp23s08_exit);
>  
> diff --git a/include/linux/spi/mcp23s08.h b/include/linux/spi/mcp23s08.h
> index c42cff8..2eb4fc1 100644
> --- a/include/linux/spi/mcp23s08.h
> +++ b/include/linux/spi/mcp23s08.h
> @@ -25,10 +25,10 @@ struct mcp23s08_platform_data {
>  
>  	void		*context;	/* param to setup/teardown */
>  
> -	int		(*setup)(struct spi_device *spi,
> +	int		(*setup)(void *data,
>  					int gpio, unsigned ngpio,
>  					void *context);
> -	int		(*teardown)(struct spi_device *spi,
> +	int		(*teardown)(void *data,
>  					int gpio, unsigned ngpio,
>  					void *context);
>  };
> -- 
> 1.7.5.4
> 

  reply	other threads:[~2011-07-15  2:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 19:59 [PATCH 0/3] gpio/mcp23s08: add support for i2c variants Peter Korsgaard
2011-07-14 19:59 ` [PATCH 1/3] mcp23s08: remove unused work queue Peter Korsgaard
2011-07-15  2:53   ` Grant Likely
2011-07-15  6:54     ` Peter Korsgaard
2011-07-14 19:59 ` [PATCH 2/3] mcp23s08: isolate spi specific parts Peter Korsgaard
2011-07-15  2:53   ` Grant Likely
2011-07-15  6:57     ` Peter Korsgaard
2011-07-14 19:59 ` [PATCH 3/3] mcp23s08: add i2c support Peter Korsgaard
2011-07-15  2:53   ` Grant Likely [this message]
2011-07-15  7:03     ` Peter Korsgaard

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=20110715025355.GX2927@ponder.secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=jacmet@sunsite.dk \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®