Linux I2C development
 help / color / mirror / Atom feed
From: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: eric miao <eric.miao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
	i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
Subject: Re: [patch 6/6] Minor fixes for pxa-driver
Date: Wed, 13 Feb 2008 09:58:39 +0100	[thread overview]
Message-ID: <20080213095839.5d99d48a@hyperion.delvare> (raw)
In-Reply-To: <20080121143659.089906703-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Hi Wolfram,

On Mon, 21 Jan 2008 15:20:16 +0100, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org wrote:
> While working on the PCA9564-platform driver, I sometimes had a glimpse at the
> pxa-driver. I found some suspicious places, and this patch contains my
> suggestions. Note: They are not tested, due to no hardware.

Looks good. I've added a couple more fixes, resulting patch is below.
As I don't have hardware for testing either, I would appreciate if
someone with a PXA board could test it and confirm that it causes no
regression. Mike? Eric? I plan to send this patch to Linus for 2.6.25
(i.e. quickly.)

From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Subject: i2c-pxa: Misc fixes

While working on the PCA9564-platform driver, I sometimes had a glimpse at the
pxa-driver. I found some suspicious places, and this patch contains my
suggestions. Note: They are not tested, due to no hardware.

[JD: Some more fixes.]

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Signed-off-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
---
 drivers/i2c/busses/i2c-pxa.c |   27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

--- linux-2.6.25-rc1.orig/drivers/i2c/busses/i2c-pxa.c	2008-02-13 09:51:09.000000000 +0100
+++ linux-2.6.25-rc1/drivers/i2c/busses/i2c-pxa.c	2008-02-13 09:57:33.000000000 +0100
@@ -997,7 +997,14 @@ static int i2c_pxa_probe(struct platform
 	spin_lock_init(&i2c->lock);
 	init_waitqueue_head(&i2c->wait);
 
-	sprintf(i2c->adap.name, "pxa_i2c-i2c.%u", dev->id);
+	/*
+	 * If "dev->id" is negative we consider it as zero.
+	 * The reason to do so is to avoid sysfs names that only make
+	 * sense when there are multiple adapters.
+	 */
+	i2c->adap.nr = dev->id != -1 ? dev->id : 0;
+	snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
+		 i2c->adap.nr);
 
 	i2c->clk = clk_get(&dev->dev, "I2CCLK");
 	if (IS_ERR(i2c->clk)) {
@@ -1048,13 +1055,6 @@ static int i2c_pxa_probe(struct platform
 	i2c->adap.algo_data = i2c;
 	i2c->adap.dev.parent = &dev->dev;
 
-	/*
-	 * If "dev->id" is negative we consider it as zero.
-	 * The reason to do so is to avoid sysfs names that only make
-	 * sense when there are multiple adapters.
-	 */
-	i2c->adap.nr = dev->id != -1 ? dev->id : 0;
-
 	ret = i2c_add_numbered_adapter(&i2c->adap);
 	if (ret < 0) {
 		printk(KERN_INFO "I2C: Failed to add bus\n");
@@ -1078,6 +1078,7 @@ eadapt:
 ereqirq:
 	clk_disable(i2c->clk);
 	i2c_pxa_disable(dev);
+	iounmap(i2c->reg_base);
 eremap:
 	clk_put(i2c->clk);
 eclk:
@@ -1087,7 +1088,7 @@ emalloc:
 	return ret;
 }
 
-static int i2c_pxa_remove(struct platform_device *dev)
+static int __devexit i2c_pxa_remove(struct platform_device *dev)
 {
 	struct pxa_i2c *i2c = platform_get_drvdata(dev);
 
@@ -1101,6 +1102,7 @@ static int i2c_pxa_remove(struct platfor
 	clk_put(i2c->clk);
 	i2c_pxa_disable(dev);
 
+	iounmap(i2c->reg_base);
 	release_mem_region(i2c->iobase, i2c->iosize);
 	kfree(i2c);
 
@@ -1109,9 +1111,10 @@ static int i2c_pxa_remove(struct platfor
 
 static struct platform_driver i2c_pxa_driver = {
 	.probe		= i2c_pxa_probe,
-	.remove		= i2c_pxa_remove,
+	.remove		= __devexit_p(i2c_pxa_remove),
 	.driver		= {
 		.name	= "pxa2xx-i2c",
+		.owner	= THIS_DRIVER,
 	},
 };
 
@@ -1120,9 +1123,9 @@ static int __init i2c_adap_pxa_init(void
 	return platform_driver_register(&i2c_pxa_driver);
 }
 
-static void i2c_adap_pxa_exit(void)
+static void __exit i2c_adap_pxa_exit(void)
 {
-	return platform_driver_unregister(&i2c_pxa_driver);
+	platform_driver_unregister(&i2c_pxa_driver);
 }
 
 MODULE_LICENSE("GPL");

-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

  parent reply	other threads:[~2008-02-13  8:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 14:20 [patch 0/6] PCA9564-platform driver w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
2008-01-21 14:20 ` [patch 1/6] Removing trailing whitespaces from pca-algorithm w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
     [not found]   ` <20080121143657.041235373-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-01-23 14:21     ` Jean Delvare
2008-01-21 14:20 ` [patch 2/6] Extension of pca-algorithm w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
     [not found]   ` <20080121143657.455317984-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-01-23 19:52     ` Jean Delvare
     [not found]       ` <20080123205241.3e1235e7-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-24 13:00         ` Wolfram Sang
2008-01-21 14:20 ` [patch 3/6] Minor typos in i2c/algos/Kconfig w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
     [not found]   ` <20080121143657.830988061-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-01-23 20:08     ` Jean Delvare
     [not found]       ` <20080123210840.3f4a78e6-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-24 13:47         ` Wolfram Sang
2008-02-13  9:00           ` Jean Delvare
2008-01-21 14:20 ` [patch 4/6] Platform driver for the PCA9564 w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
2008-01-21 14:20 ` [patch 5/6] pca-isa driver uses the new pca-algorithm w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
     [not found]   ` <20080121143658.662633756-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-01-24 11:00     ` Jean Delvare
     [not found]       ` <20080124120044.4052c351-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-01-24 14:01         ` Wolfram Sang
2008-01-21 14:20 ` [patch 6/6] Minor fixes for pxa-driver w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
     [not found]   ` <20080121143659.089906703-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-02-13  8:58     ` Jean Delvare [this message]
2008-02-13  9:22       ` Eric Miao
     [not found]         ` <E913911567467945BBEB9277E27868B083D61E-3TKN+kxLw8+HXkj8w7BxOhL4W9x8LtSr@public.gmane.org>
2008-02-13 10:08           ` Jean Delvare
     [not found]       ` <20080213095839.5d99d48a-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-02-13 11:57         ` Mike Rapoport
     [not found]           ` <47B2DB21.7020404-UTxiZqZC01RS1MOuV/RT9w@public.gmane.org>
2008-02-13 13:11             ` Jean Delvare
2008-02-14  2:23           ` Eric Miao
2008-02-14 18:55         ` Wolfram Sang
2008-02-14 22:11           ` Jean Delvare
2008-02-15  0:43             ` Eric Miao
2008-02-23 21:49         ` Jean Delvare
     [not found] ` <20080121142010.988419876-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2008-01-23  9:33   ` [patch 0/6] PCA9564-platform driver 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=20080213095839.5d99d48a@hyperion.delvare \
    --to=khali-puyad+kwke1g9huczpvpmw@public.gmane.org \
    --cc=eric.miao-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
    --cc=i2c-GZX6beZjE8VD60Wz+7aTrA@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