public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Dirk Behme <dirk.behme@googlemail.com>
To: linux-omap-open-source@linux.omap.com
Subject: Re: [PATCH] ARM: OMAP: ISP1301 workqueue fixes
Date: Fri, 29 Dec 2006 09:36:22 +0100	[thread overview]
Message-ID: <4594D386.2050904@gmail.com> (raw)
In-Reply-To: <200612281205.37642.david-b@pacbell.net>

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

David Brownell wrote:
> On Thursday 28 December 2006 12:02 am, Dirk Behme wrote:
> 
>> static void
>>-isp1301_work(void *data)
>>+isp1301_work(struct work_struct *data)
>> {
>>-       struct isp1301  *isp = data;
>>+       struct isp1301  *isp = (struct isp1301 *)data;
>>        int             stop;
> 
> 
> Clearly incorrect.  It should use container_of().  The work_struct
> is NOT the first member of that struct... this will be oopsing.

Yes, I see. Thanks!

So, next attempt ;) Below both, ISP1301 and board-h3. Again,
only checked for compilation.

Dirk

[-- Attachment #2: isp1301_workqueue_fix.txt --]
[-- Type: text/plain, Size: 823 bytes --]

Index: linux-osk/drivers/i2c/chips/isp1301_omap.c
===================================================================
--- linux-osk.orig/drivers/i2c/chips/isp1301_omap.c
+++ linux-osk/drivers/i2c/chips/isp1301_omap.c
@@ -1119,9 +1119,9 @@ static u8 isp1301_clear_latch(struct isp
 }
 
 static void
-isp1301_work(void *data)
+isp1301_work(struct work_struct *work)
 {
-	struct isp1301	*isp = data;
+	struct isp1301	*isp = container_of(work, struct isp1301, work);
 	int		stop;
 
 	/* implicit lock:  we're the only task using this device */
@@ -1525,7 +1525,7 @@ static int isp1301_probe(struct i2c_adap
 	if (!isp)
 		return 0;
 
-	INIT_WORK(&isp->work, isp1301_work, isp);
+	INIT_WORK(&isp->work, isp1301_work);
 	init_timer(&isp->timer);
 	isp->timer.function = isp1301_timer;
 	isp->timer.data = (unsigned long) isp;




[-- Attachment #3: board_h3_workqueue_fix.txt --]
[-- Type: text/plain, Size: 1590 bytes --]

Index: linux-osk/arch/arm/mach-omap1/board-h3.c
===================================================================
--- linux-osk.orig/arch/arm/mach-omap1/board-h3.c
+++ linux-osk/arch/arm/mach-omap1/board-h3.c
@@ -296,9 +296,11 @@ static int h3_select_irda(struct device 
 	return err;
 }
 
-static void set_trans_mode(void *data)
+static void set_trans_mode(struct work_struct *work)
 {
-	int *mode = data;
+	struct omap_irda_config *irda_config =
+		container_of(work, struct omap_irda_config, gpio_expa.work);
+	int mode = irda_config->mode;
 	unsigned char expa;
 	int err = 0;
 
@@ -308,7 +310,7 @@ static void set_trans_mode(void *data)
 
 	expa &= ~0x03;
 
-	if (*mode & IR_SIRMODE) {
+	if (mode & IR_SIRMODE) {
 		expa |= 0x01;
 	} else { /* MIR/FIR */
 		expa |= 0x03;
@@ -323,9 +325,9 @@ static int h3_transceiver_mode(struct de
 {
 	struct omap_irda_config *irda_config = dev->platform_data;
 
+	irda_config->mode = mode;
 	cancel_delayed_work(&irda_config->gpio_expa);
-	PREPARE_WORK(&irda_config->gpio_expa, set_trans_mode, &mode);
-#error this is not permitted - mode is an argument variable
+	PREPARE_DELAYED_WORK(&irda_config->gpio_expa, set_trans_mode);
 	schedule_delayed_work(&irda_config->gpio_expa, 0);
 
 	return 0;
Index: linux-osk/include/asm-arm/arch-omap/irda.h
===================================================================
--- linux-osk.orig/include/asm-arm/arch-omap/irda.h
+++ linux-osk/include/asm-arm/arch-omap/irda.h
@@ -31,6 +31,7 @@ struct omap_irda_config {
 	unsigned long src_start;
 	int tx_trigger;
 	int rx_trigger;
+	int mode;
 };
 
 #endif


[-- Attachment #4: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2006-12-29  8:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-28  8:02 [PATCH] ARM: OMAP: ISP1301 workqueue fixes Dirk Behme
2006-12-28 12:30 ` Komal Shah
2006-12-28 16:19   ` Dirk Behme
2006-12-28 20:07     ` David Brownell
2006-12-28 20:05 ` David Brownell
2006-12-29  8:36   ` Dirk Behme [this message]
2007-01-02 20:34     ` tony

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=4594D386.2050904@gmail.com \
    --to=dirk.behme@googlemail.com \
    --cc=linux-omap-open-source@linux.omap.com \
    /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