mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marc Pignat <marc.pignat@hevs.ch>
To: Jean Delvare <khali@linux-fr.org>
Cc: David Brownell <david-b@pacbell.net>,
	i2c@lm-sensors.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH v2] i2c: fix device_init_wakeup place
Date: Mon, 11 Aug 2008 10:31:35 +0200	[thread overview]
Message-ID: <200808111031.35722.marc.pignat@hevs.ch> (raw)

device_init_wakeup must be called after device_register.

Signed-off-by: Marc Pignat <marc.pignat@hevs.ch>
---

Hi all!

The current i2c code calls device_init_wakeup() before device_register, but
device_register (by calling device_initialize) will disable device wakeup.

This patch (against 2.6.27-rc2) move the device_init_wakeup() call in the bus
probe function, just before the probe call.

This patch also include a small functionnal change: the I2C_CLIENT_WAKE is no
more removed from the client flags, but this should't hurt.

Changes from v1:
 - patch against 2.6.24-rc2
 - call to device_init_wakeup depends on !device_can_wakeup (suggested by David
   Brownell)

Best regards

Marc


diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 7bf38c4..0039bd9 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -108,6 +108,9 @@ static int i2c_device_probe(struct device *dev)
 	if (!driver->probe || !driver->id_table)
 		return -ENODEV;
 	client->driver = driver;
+	if (!device_can_wakeup(&client->dev))
+		device_init_wakeup(&client->dev,
+					client->flags & I2C_CLIENT_WAKE);
 	dev_dbg(dev, "probe\n");
 
 	status = driver->probe(client, i2c_match_id(driver->id_table, client));
@@ -262,9 +265,8 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
 	client->adapter = adap;
 
 	client->dev.platform_data = info->platform_data;
-	device_init_wakeup(&client->dev, info->flags & I2C_CLIENT_WAKE);
 
-	client->flags = info->flags & ~I2C_CLIENT_WAKE;
+	client->flags = info->flags;
 	client->addr = info->addr;
 	client->irq = info->irq;
 

             reply	other threads:[~2008-08-11  8:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-11  8:31 Marc Pignat [this message]
2008-08-11 12:01 ` Jean Delvare

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=200808111031.35722.marc.pignat@hevs.ch \
    --to=marc.pignat@hevs.ch \
    --cc=david-b@pacbell.net \
    --cc=i2c@lm-sensors.org \
    --cc=khali@linux-fr.org \
    --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®