r4056 - branches/src/target/kernel/2.6.24.x/patches

werner at sita.openmoko.org werner at sita.openmoko.org
Wed Feb 13 02:18:51 CET 2008


Author: werner
Date: 2008-02-13 02:18:47 +0100 (Wed, 13 Feb 2008)
New Revision: 4056

Modified:
   branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch
   branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
Log:
fix-pcf50606-set-irq-type.patch
fix-pcf50633-set-irq-type.patch

    From: Andy Green <andy at openmoko.com>

    Remove set_irq_type and use IRQF_FALLING with interrupt enabled all the
    time.
    Use a mutex to stop any reentrancy


Signed-off-by: Andy Green <andy at openmoko.com>

---

 drivers/i2c/chips/pcf50606.c |   29 ++++++++---------------------
 1 files changed, 8 insertions(+), 21 deletions(-)
 drivers/i2c/chips/pcf50633.c |   31 +++++++++----------------------
 1 files changed, 9 insertions(+), 22 deletions(-)



Modified: branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch	2008-02-12 23:51:35 UTC (rev 4055)
+++ branches/src/target/kernel/2.6.24.x/patches/gta01-pcf50606.patch	2008-02-13 01:18:47 UTC (rev 4056)
@@ -8,7 +8,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.24/drivers/i2c/chips/pcf50606.c
-@@ -0,0 +1,1946 @@
+@@ -0,0 +1,1933 @@
 +/* Philips/NXP PCF50606 Power Management Unit (PMU) driver
 + *
 + * (C) 2006-2007 by OpenMoko, Inc.
@@ -106,6 +106,7 @@
 +	struct mutex lock;
 +	unsigned int flags;
 +	unsigned int working;
++	struct mutex working_lock;
 +	struct work_struct work;
 +	struct rtc_device *rtc;
 +	struct input_dev *input_dev;
@@ -567,6 +568,7 @@
 +			container_of(work, struct pcf50606_data, work);
 +	u_int8_t int1, int2, int3;
 +
++	mutex_lock(&pcf->working_lock);
 +	pcf->working = 1;
 +
 +	int1 = __reg_read(pcf, PCF50606_REG_INT1);
@@ -745,33 +747,19 @@
 +	pcf->working = 0;
 +	input_sync(pcf->input_dev);
 +	put_device(&pcf->client.dev);
-+
-+	enable_irq(pcf->irq);
++	mutex_unlock(&pcf->working_lock);
 +}
 +
-+static void pcf50606_schedule_work(struct pcf50606_data *pcf)
-+{
-+	int status;
-+
-+	get_device(&pcf->client.dev);
-+	status = schedule_work(&pcf->work);
-+	if (!status && !pcf->working)
-+		dev_dbg(&pcf->client.dev, "work item may be lost\n");
-+}
-+
-+
 +static irqreturn_t pcf50606_irq(int irq, void *_pcf)
 +{
 +	struct pcf50606_data *pcf = _pcf;
 +
 +	dev_dbg(&pcf->client.dev, "entering(irq=%u, pcf=%p): scheduling work\n",
 +		irq, _pcf);
-+	pcf50606_schedule_work(pcf);
++	get_device(&pcf->client.dev);
++	if (!schedule_work(&pcf->work) && !pcf->working)
++		dev_dbg(&pcf->client.dev, "work item may be lost\n");
 +
-+	/* Disable any further interrupts until we have processed
-+	 * the current one */
-+	disable_irq(irq);
-+
 +	return IRQ_HANDLED;
 +}
 +
@@ -1601,6 +1589,7 @@
 +		return -ENOMEM;
 +
 +	mutex_init(&data->lock);
++ 	mutex_init(&data->working_lock);
 +	INIT_WORK(&data->work, pcf50606_work);
 +	data->irq = irq;
 +	data->working = 0;
@@ -1662,13 +1651,11 @@
 +	reg_write(data, PCF50606_REG_INT2M, 0x00);
 +	reg_write(data, PCF50606_REG_INT3M, PCF50606_INT3_TSCPRES);
 +
-+	err = request_irq(irq, pcf50606_irq, IRQF_DISABLED,
++	err = request_irq(irq, pcf50606_irq, IRQF_TRIGGER_FALLING,
 +			  "pcf50606", data);
 +	if (err < 0)
 +		goto exit_input;
 +
-+	set_irq_type(irq, IRQT_FALLING);
-+
 +	if (enable_irq_wake(irq) < 0)
 +		dev_err(&new_client->dev, "IRQ %u cannot be enabled as wake-up"
 +			"source in this hardware revision!", irq);

Modified: branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch	2008-02-12 23:51:35 UTC (rev 4055)
+++ branches/src/target/kernel/2.6.24.x/patches/pcf50633.patch	2008-02-13 01:18:47 UTC (rev 4056)
@@ -34,7 +34,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.24/drivers/i2c/chips/pcf50633.c
-@@ -0,0 +1,1802 @@
+@@ -0,0 +1,1789 @@
 +/* Philips PCF50633 Power Management Unit (PMU) driver
 + *
 + * (C) 2006-2007 by OpenMoko, Inc.
@@ -138,6 +138,7 @@
 +	struct mutex lock;
 +	unsigned int flags;
 +	unsigned int working;
++	struct mutex working_lock;
 +	struct work_struct work;
 +	struct rtc_device *rtc;
 +	struct input_dev *input_dev;
@@ -527,6 +528,7 @@
 +			container_of(work, struct pcf50633_data, work);
 +	u_int8_t int1, int2, int3, int4, int5;
 +
++	mutex_lock(&pcf->working_lock);
 +	pcf->working = 1;
 +
 +	/* FIXME: read in one i2c transaction */
@@ -702,32 +704,18 @@
 +	pcf->working = 0;
 +	input_sync(pcf->input_dev);
 +	put_device(&pcf->client.dev);
-+
-+	enable_irq(pcf->irq);
++	mutex_unlock(&pcf->working_lock);
 +}
 +
-+static void pcf50633_schedule_work(struct pcf50633_data *pcf)
-+{
-+	int status;
-+
-+	get_device(&pcf->client.dev);
-+	status = schedule_work(&pcf->work);
-+	if (!status && !pcf->working)
-+		dev_dbg(&pcf->client.dev, "work item may be lost\n");
-+}
-+
-+
 +static irqreturn_t pcf50633_irq(int irq, void *_pcf)
 +{
 +	struct pcf50633_data *pcf = _pcf;
 +
-+	DEBUGP("entering(irq=%u, pcf=%p): scheduling work\n",
-+		irq, _pcf);
-+	pcf50633_schedule_work(pcf);
++	DEBUGP("entering(irq=%u, pcf=%p): scheduling work\n", irq, _pcf);
 +
-+	/* Disable any further interrupts until we have processed
-+	 * the current one */
-+	disable_irq(irq);
++	get_device(&pcf->client.dev);
++	if (!schedule_work(&pcf->work) && !pcf->working)
++		dev_dbg(&pcf->client.dev, "work item may be lost\n");
 +
 +	return IRQ_HANDLED;
 +}
@@ -1472,6 +1460,7 @@
 +		return -ENOMEM;
 +
 +	mutex_init(&data->lock);
++	mutex_init(&data->working_lock);
 +	INIT_WORK(&data->work, pcf50633_work);
 +	data->irq = irq;
 +	data->working = 0;
@@ -1535,13 +1524,11 @@
 +	reg_write(data, PCF50633_REG_INT4M, 0x00);
 +	reg_write(data, PCF50633_REG_INT5M, 0x00);
 +
-+	err = request_irq(irq, pcf50633_irq, IRQF_DISABLED,
++	err = request_irq(irq, pcf50633_irq, IRQF_TRIGGER_FALLING,
 +			  "pcf50633", data);
 +	if (err < 0)
 +		goto exit_input;
 +
-+	set_irq_type(irq, IRQT_FALLING);
-+
 +	if (enable_irq_wake(irq) < 0)
 +		dev_err(&new_client->dev, "IRQ %u cannot be enabled as wake-up"
 +		        "source in this hardware revision!", irq);





More information about the commitlog mailing list