[i2c] [PATCH] Make i2c-mpc driver use i2c_add_numbered_adapter

Scott Wood scottwood at freescale.com
Thu May 17 05:15:39 EST 2007


David Brownell wrote:
> On Tuesday 15 May 2007, Jean Delvare wrote:
> 
>>On Mon, 14 May 2007 13:11:23 -0600, Grant Likely wrote:
> 
> 
>>>--- a/drivers/i2c/busses/i2c-mpc.c
>>>+++ b/drivers/i2c/busses/i2c-mpc.c
>>>@@ -327,9 +327,10 @@ static int fsl_i2c_probe(struct platform_device *pdev)
>>> 	platform_set_drvdata(pdev, i2c);
>>> 
>>> 	i2c->adap = mpc_ops;
>>>+	i2c->adap.nr = pdev->id;
> 
> 
> By the way:  mpc_ops is a static i2c_adapter, so given that
> the reason for using pdev->id that way was that there might
> be more than one such platform device ... shouldn't allocation
> of the adapter be moved into allocation of the "i2c->" object?
> 
> Or at least, add a check to ensure that the static mpc_ops
> structure isn't in use before progressing this probe().

The mpc_ops struct is only used as a template; it gets copied into 
i2c->adap for each adapter instance.

-Scott



More information about the Linuxppc-dev mailing list