Skip to contentSkip to conversation

More Driver Core patches for 2.6.10-rc1

PATCH In review Greg KH 2 participants 13 messages Nov 12, 2004 – Nov 13, 2004 1 message not in the archive

Subsystems (6)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 More Driver Core patches for 2.6.10-rc1

Hi,

Here are a few driver core and sysfs patches and fixes for 2.6.10-rc1. They fix some minor bugs in sysfs, add some more environment variables to /sbin/hotplug to make userspace easier, and shrink the size of struct device.

Please pull from:

	bk://kernel.bkbits.net/gregkh/linux/driver-2.6

thanks,

greg k-h

p.s. I'll send these as patches in response to this email to lkml for those who want to see them.

 arch/arm/common/locomo.c        |    3 ---
 arch/arm/common/sa1111.c        |   23 +++++++++++++++--------
 arch/arm/mach-sa1100/neponset.c |   23 +++++++++++++++--------
 drivers/base/bus.c              |    2 +-
 drivers/base/class.c            |    6 ++++++
 drivers/base/core.c             |   21 +++++++++++++++++++++
 drivers/block/genhd.c           |    6 ++++++
 drivers/video/aty/aty128fb.c    |   10 +++++-----
 drivers/video/aty/atyfb_base.c  |   10 +++++-----
 drivers/video/aty/radeon_pm.c   |    6 +++---
 fs/sysfs/dir.c                  |    8 ++++----
 include/linux/device.h          |    5 -----
 include/linux/kobject_uevent.h  |    1 +
 lib/kobject_uevent.c            |    8 +++++---
 14 files changed, 87 insertions(+), 45 deletions(-)

-----

Anil Keshavamurthy:
o Add KOBJ_ONLINE

David Brownell:
o driver core: shrink struct device a bit

Greg Kroah-Hartman:
o sysfs: fix odd patch error
o driver core: fix up some missed power_state changes from David's patch

Kay Sievers:
o print hotplug SEQNUM as unsigned
o add the bus name to the hotplug environment
o add the driver name to the hotplug environment

Maneesh Soni:
o sysfs: fix duplicate driver registration error

Milton D. Miller II:
o fix sysfs backing store error path confusion

author
#1 lore raw

PATCH 1/1 More Driver Core patches for 2.6.10-rc1

ChangeSet 1.2093, 2004/11/12 11:41:25-08:00, [email protected]

[PATCH] driver core: shrink struct device a bit

This patch removes two fields from "struct device" that are duplicated in "struct dev_pm_info": power_state (which should probably vanish) and "saved_state". There were only two "real" uses of saved_state; both are now switched over to use dev_pm_info.

 arch/arm/common/locomo.c        |    3 ---
 arch/arm/common/sa1111.c        |   23 +++++++++++++++--------
 arch/arm/mach-sa1100/neponset.c |   23 +++++++++++++++--------
 include/linux/device.h          |    5 -----
 4 files changed, 30 insertions(+), 24 deletions(-)
arch/arm/common/locomo.c +0 -3
diff -Nru a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
@@ -627,9 +627,6 @@
 	if (lchip) {
 		__locomo_remove(lchip);
 		dev_set_drvdata(dev, NULL);
-
-		kfree(dev->saved_state);
-		dev->saved_state = NULL;
 	}
 
 	return 0;
arch/arm/common/sa1111.c +15 -8
diff -Nru a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
@@ -797,6 +797,8 @@
 	unsigned int	wakeen1;
 };
 
+#ifdef	CONFIG_PM
+
 static int sa1111_suspend(struct device *dev, u32 state, u32 level)
 {
 	struct sa1111 *sachip = dev_get_drvdata(dev);
@@ -808,11 +810,10 @@
 	if (level != SUSPEND_DISABLE)
 		return 0;
 
-	dev->saved_state = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
-	if (!dev->saved_state)
+	save = kmalloc(sizeof(struct sa1111_save_data), GFP_KERNEL);
+	if (!save)
 		return -ENOMEM;
-
-	save = (struct sa1111_save_data *)dev->saved_state;
+	dev->power.saved_state = save;
 
 	spin_lock_irqsave(&sachip->lock, flags);
 
@@ -870,7 +871,7 @@
 	if (level != RESUME_ENABLE)
 		return 0;
 
-	save = (struct sa1111_save_data *)dev->saved_state;
+	save = (struct sa1111_save_data *)dev->power.saved_state;
 	if (!save)
 		return 0;
 
@@ -915,12 +916,18 @@
 
 	spin_unlock_irqrestore(&sachip->lock, flags);
 
-	dev->saved_state = NULL;
+	dev->power.saved_state = NULL;
 	kfree(save);
 
 	return 0;
 }
 
+#else	/* !CONFIG_PM */
+#define sa1111_resume	NULL
+#define sa1111_suspend	NULL
+#endif	/* !CONFIG_PM */
+
+
 static int sa1111_probe(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
@@ -943,8 +950,8 @@
 		__sa1111_remove(sachip);
 		dev_set_drvdata(dev, NULL);
 
-		kfree(dev->saved_state);
-		dev->saved_state = NULL;
+		kfree(dev->power.saved_state);
+		dev->power.saved_state = NULL;
 	}
 
 	return 0;
arch/arm/mach-sa1100/neponset.c +15 -8
diff -Nru a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
@@ -173,6 +173,8 @@
 	return 0;
 }
 
+#ifdef CONFIG_PM
+
 /*
  * LDM power management.
  */
@@ -184,12 +186,12 @@
 	if (level == SUSPEND_SAVE_STATE ||
 	    level == SUSPEND_DISABLE ||
 	    level == SUSPEND_POWER_DOWN) {
-		if (!dev->saved_state)
-			dev->saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
-		if (!dev->saved_state)
+		if (!dev->power.saved_state)
+			dev->power.saved_state = kmalloc(sizeof(unsigned int), GFP_KERNEL);
+		if (!dev->power.saved_state)
 			return -ENOMEM;
 
-		*(unsigned int *)dev->saved_state = NCR_0;
+		*(unsigned int *)dev->power.saved_state = NCR_0;
 	}
 
 	return 0;
@@ -198,15 +200,20 @@
 static int neponset_resume(struct device *dev, u32 level)
 {
 	if (level == RESUME_RESTORE_STATE || level == RESUME_ENABLE) {
-		if (dev->saved_state) {
-			NCR_0 = *(unsigned int *)dev->saved_state;
-			kfree(dev->saved_state);
-			dev->saved_state = NULL;
+		if (dev->power.saved_state) {
+			NCR_0 = *(unsigned int *)dev->power.saved_state;
+			kfree(dev->power.saved_state);
+			dev->power.saved_state = NULL;
 		}
 	}
 
 	return 0;
 }
+
+#else
+#define	neponset_suspend	NULL
+#define	neponset_resume	NULL
+#endif
 
 static struct device_driver neponset_device_driver = {
 	.name		= "neponset",
include/linux/device.h +0 -5
diff -Nru a/include/linux/device.h b/include/linux/device.h
@@ -268,12 +268,7 @@
 	void		*platform_data;	/* Platform specific data (e.g. ACPI,
 					   BIOS data relevant to device) */
 	struct dev_pm_info	power;
-	u32		power_state;	/* Current operating state. In
-					   ACPI-speak, this is D0-D3, D0
-					   being fully functional, and D3
-					   being off. */
 
-	unsigned char *saved_state;	/* saved device state */
 	u32		detach_state;	/* State to enter when device is
 					   detached from its driver. */
 
author
#2 lore raw

ChangeSet 1.2094, 2004/11/12 11:42:03-08:00, [email protected]

[PATCH] fix sysfs backing store error path confusion

On Nov 3, 2004, at 3:42 PM, Greg KH wrote:

|On Tue, Nov 02, 2004 at 10:03:34AM -0600, Maneesh Soni wrote:
||On Tue, Nov 02, 2004 at 02:46:58AM -0600, Milton Miller wrote:
|||sysfs_new_dirent returns ERR_PTR(-ENOMEM) if kmalloc fails but the callers
|||were expecting NULL.
||
||Thanks for spotting this. But as you said, I will prefer to change the callee.
||How about this patch?
..
||-		return -ENOMEM;
||+		return NULL;
|
|Actually, this needs to be a 0, not NULL, otherwise the compiler
|complains with a warning.  I've fixed it up and applied it.
|
|thanks,
|
|greg k-h

I wondered why greg thought the type was wrong. After it was merged I
realized that the wrong function was changed. Here's an attempt to fix both errors.

 fs/sysfs/dir.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/sysfs/dir.c +2 -2
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
@@ -38,7 +38,7 @@
 
 	sd = kmalloc(sizeof(*sd), GFP_KERNEL);
 	if (!sd)
-		return ERR_PTR(-ENOMEM);
+		return NULL;
 
 	memset(sd, 0, sizeof(*sd));
 	atomic_set(&sd->s_count, 1);
@@ -56,7 +56,7 @@
 
 	sd = sysfs_new_dirent(parent_sd, element);
 	if (!sd)
-		return 0;
+		return -ENOMEMurn -ENOMEM;
 
 	sd->s_mode = mode;
 	sd->s_type = type;
author
#3 lore raw

ChangeSet 1.2095, 2004/11/12 11:42:28-08:00, [email protected]

[PATCH] Add KOBJ_ONLINE

I am trying to fix the current ACPI container.ko and processor.ko to use kobject_hotplug() for notification. For this I would be requiring the KOBJ_ONLINE definitions to be added to kobject_action.

 include/linux/kobject_uevent.h |    1 +
 lib/kobject_uevent.c           |    2 ++
 2 files changed, 3 insertions(+)
include/linux/kobject_uevent.h +1 -0
diff -Nru a/include/linux/kobject_uevent.h b/include/linux/kobject_uevent.h
@@ -28,6 +28,7 @@
 	KOBJ_MOUNT	= (__force kobject_action_t) 0x04,	/* mount event for block devices */
 	KOBJ_UMOUNT	= (__force kobject_action_t) 0x05,	/* umount event for block devices */
 	KOBJ_OFFLINE	= (__force kobject_action_t) 0x06,	/* offline event for hotplug devices */
+	KOBJ_ONLINE	= (__force kobject_action_t) 0x07,	/* online event for hotplug devices */
 };
 
 
lib/kobject_uevent.c +2 -0
diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
@@ -42,6 +42,8 @@
 		return "umount";
 	case KOBJ_OFFLINE:
 		return "offline";
+	case KOBJ_ONLINE:
+		return "online";
 	default:
 		return NULL;
 	}
author
#4 lore raw

ChangeSet 1.2096, 2004/11/12 11:42:46-08:00, [email protected]

[PATCH] sysfs: fix duplicate driver registration error

o Do not release existing directory if the new directory happens to be a duplicate directory. Thanks to Kay Sievers for the testcase.

 fs/sysfs/dir.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
fs/sysfs/dir.c +1 -1
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
@@ -111,7 +111,7 @@
 				d_rehash(*d);
 			}
 		}
-		if (error)
+		if (error && (error != -EEXIST))
 			d_drop(*d);
 		dput(*d);
 	} else
author
#5 lore raw

ChangeSet 1.2097, 2004/11/12 11:43:08-08:00, [email protected]

[PATCH] add the driver name to the hotplug environment

Add the name of the device's driver to the hotplug environment of class and block devices.

ACTION=add
DEVPATH=/block/sda
SUBSYSTEM=block
SEQNUM=986 PHYSDEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1/3-1:1.0/host0/target0:0:0/0:0:0:0 PHYSDEVBUS=scsi
PHYSDEVDRIVER=sd

 drivers/base/class.c  |    6 ++++++
 drivers/block/genhd.c |    6 ++++++
 2 files changed, 12 insertions(+)
drivers/base/class.c +6 -0
diff -Nru a/drivers/base/class.c b/drivers/base/class.c
@@ -303,6 +303,12 @@
 					    buffer, buffer_size, &length,
 					    "PHYSDEVBUS=%s", dev->bus->name);
 
+		/* add driver name of physical device */
+		if (dev->driver)
+			add_hotplug_env_var(envp, num_envp, &i,
+					    buffer, buffer_size, &length,
+					    "PHYSDEVDRIVER=%s", dev->driver->name);
+
 		/* terminate, set to next free slot, shrink available space */
 		envp[i] = NULL;
 		envp = &envp[i];
drivers/block/genhd.c +6 -0
diff -Nru a/drivers/block/genhd.c b/drivers/block/genhd.c
@@ -469,6 +469,12 @@
 					    buffer, buffer_size, &length,
 					    "PHYSDEVBUS=%s", dev->bus->name);
 
+		/* add driver name of physical device */
+		if (dev->driver)
+			add_hotplug_env_var(envp, num_envp, &i,
+					    buffer, buffer_size, &length,
+					    "PHYSDEVDRIVER=%s", dev->driver->name);
+
 		envp[i] = NULL;
 	}
 
author
#6 lore raw

ChangeSet 1.2098, 2004/11/12 11:43:27-08:00, [email protected]

[PATCH] add the bus name to the hotplug environment

Add the name of the bus and the driver to the hotplug event for /sys/devices/*. With this addition, userspace knows what it can expect from sysfs to show up, instead of waiting for a timeout for devices without a bus.

ACTION=add DEVPATH=/devices/pci0000:00/0000:00:1d.1/usb3/3-1 SUBSYSTEM=usb
SEQNUM=978
PHYSDEVBUS=usb
PHYSDEVDRIVER=usb

 drivers/base/bus.c  |    2 +-
 drivers/base/core.c |   21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
drivers/base/bus.c +1 -1
diff -Nru a/drivers/base/bus.c b/drivers/base/bus.c
@@ -247,7 +247,7 @@
  *	device_bind_driver - bind a driver to one device.
  *	@dev:	device.
  *
- *	Allow manual attachment of a driver to a deivce.
+ *	Allow manual attachment of a driver to a device.
  *	Caller must have already set @dev->driver.
  *
  *	Note that this does not modify the bus reference count
drivers/base/core.c +21 -0
diff -Nru a/drivers/base/core.c b/drivers/base/core.c
@@ -116,7 +116,28 @@
 			int num_envp, char *buffer, int buffer_size)
 {
 	struct device *dev = to_dev(kobj);
+	int i = 0;
+	int length = 0;
 	int retval = 0;
+
+	/* add bus name of physical device */
+	if (dev->bus)
+		add_hotplug_env_var(envp, num_envp, &i,
+				    buffer, buffer_size, &length,
+				    "PHYSDEVBUS=%s", dev->bus->name);
+
+	/* add driver name of physical device */
+	if (dev->driver)
+		add_hotplug_env_var(envp, num_envp, &i,
+				    buffer, buffer_size, &length,
+				    "PHYSDEVDRIVER=%s", dev->driver->name);
+
+	/* terminate, set to next free slot, shrink available space */
+	envp[i] = NULL;
+	envp = &envp[i];
+	num_envp -= i;
+	buffer = &buffer[length];
+	buffer_size -= length;
 
 	if (dev->bus->hotplug) {
 		/* have the bus specific function add its stuff */
author
#7 lore raw

ChangeSet 1.2099, 2004/11/12 11:43:49-08:00, [email protected]

[PATCH] print hotplug SEQNUM as unsigned

 lib/kobject_uevent.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
lib/kobject_uevent.c +3 -3
diff -Nru a/lib/kobject_uevent.c b/lib/kobject_uevent.c
@@ -289,10 +289,10 @@
 	spin_lock(&sequence_lock);
 	seq = ++hotplug_seqnum;
 	spin_unlock(&sequence_lock);
-	sprintf(seq_buff, "SEQNUM=%lld", (long long)seq);
+	sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq);
 
-	pr_debug ("%s: %s %s seq=%lld %s %s %s %s %s\n",
-		  __FUNCTION__, argv[0], argv[1], (long long)seq,
+	pr_debug ("%s: %s %s seq=%llu %s %s %s %s %s\n",
+		  __FUNCTION__, argv[0], argv[1], (unsigned long long)seq,
 		  envp[0], envp[1], envp[2], envp[3], envp[4]);
 
 	send_uevent(action_string, kobj_path, envp, GFP_KERNEL);
author
#8 lore raw

ChangeSet 1.2100, 2004/11/12 11:44:09-08:00, [email protected]

[PATCH] driver core: fix up some missed power_state changes from David's patch

 drivers/video/aty/aty128fb.c   |   10 +++++-----
 drivers/video/aty/atyfb_base.c |   10 +++++-----
 drivers/video/aty/radeon_pm.c  |    6 +++---
 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/video/aty/aty128fb.c +5 -5
diff -Nru a/drivers/video/aty/aty128fb.c b/drivers/video/aty/aty128fb.c
@@ -2363,7 +2363,7 @@
 		state = 2;
 #endif /* CONFIG_PPC_PMAC */
 	 
-	if (state != 2 || state == pdev->dev.power_state)
+	if (state != 2 || state == pdev->dev.power.power_state)
 		return 0;
 
 	printk(KERN_DEBUG "aty128fb: suspending...\n");
@@ -2394,7 +2394,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power_state = state;
+	pdev->dev.power.power_state = state;
 
 	return 0;
 }
@@ -2404,13 +2404,13 @@
 	struct fb_info *info = pci_get_drvdata(pdev);
 	struct aty128fb_par *par = info->par;
 
-	if (pdev->dev.power_state == 0)
+	if (pdev->dev.power.power_state == 0)
 		return 0;
 
 	acquire_console_sem();
 
 	/* Wakeup chip */
-	if (pdev->dev.power_state == 2)
+	if (pdev->dev.power.power_state == 2)
 		aty128_set_suspend(par, 0);
 	par->asleep = 0;
 
@@ -2430,7 +2430,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power_state = 0;
+	pdev->dev.power.power_state = 0;
 
 	printk(KERN_DEBUG "aty128fb: resumed !\n");
 
drivers/video/aty/atyfb_base.c +5 -5
diff -Nru a/drivers/video/aty/atyfb_base.c b/drivers/video/aty/atyfb_base.c
@@ -2033,7 +2033,7 @@
 		state = 2;
 #endif /* CONFIG_PPC_PMAC */
 
-	if (state != 2 || state == pdev->dev.power_state)
+	if (state != 2 || state == pdev->dev.power.power_state)
 		return 0;
 
 	acquire_console_sem();
@@ -2062,7 +2062,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power_state = state;
+	pdev->dev.power.power_state = state;
 
 	return 0;
 }
@@ -2072,12 +2072,12 @@
 	struct fb_info *info = pci_get_drvdata(pdev);
 	struct atyfb_par *par = (struct atyfb_par *) info->par;
 
-	if (pdev->dev.power_state == 0)
+	if (pdev->dev.power.power_state == 0)
 		return 0;
 
 	acquire_console_sem();
 
-	if (pdev->dev.power_state == 2)
+	if (pdev->dev.power.power_state == 2)
 		aty_power_mgmt(0, par);
 	par->asleep = 0;
 
@@ -2093,7 +2093,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power_state = 0;
+	pdev->dev.power.power_state = 0;
 
 	return 0;
 }
drivers/video/aty/radeon_pm.c +3 -3
diff -Nru a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c
@@ -898,7 +898,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power_state = state;
+	pdev->dev.power.power_state = state;
 
 	return 0;
 }
@@ -908,7 +908,7 @@
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
 
-	if (pdev->dev.power_state == 0)
+	if (pdev->dev.power.power_state == 0)
 		return 0;
 
 	acquire_console_sem();
@@ -935,7 +935,7 @@
 
 	release_console_sem();
 
-	pdev->dev.power_state = 0;
+	pdev->dev.power.power_state = 0;
 
 	printk(KERN_DEBUG "radeonfb: resumed !\n");
 
author
#9 lore raw

ChangeSet 1.2101, 2004/11/12 12:46:17-08:00, [email protected]

sysfs: fix odd patch error

 fs/sysfs/dir.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)
fs/sysfs/dir.c +1 -1
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
@@ -56,7 +56,7 @@
 
 	sd = sysfs_new_dirent(parent_sd, element);
 	if (!sd)
-		return -ENOMEMurn -ENOMEM;
+		return -ENOMEM;
 
 	sd->s_mode = mode;
 	sd->s_type = type;

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#11 lore raw

Replied to both of you, and the list, to prevent others from pointing out the same thing multiple times :)

Oh, it's nice to see that people actually read these patches, I like it.

Quoted 13 lines · Kenneth Aafl?y
Quoted 3 lines · Greg KH

ChangeSet 1.2094, 2004/11/12 11:42:03-08:00, [email protected]

[PATCH] fix sysfs backing store error path confusion

[snip]

fs/sysfs/dir.c line 59

Quoted 4 lines
  sd = sysfs_new_dirent(parent_sd, element);
  if (!sd)
fs/sysfs/dir.c +1 -1
-  return 0;
+  return -ENOMEMurn -ENOMEM;

Confusingly strange :)

Kenneth

Quoted 6 lines · Francois Romieu

Greg KH <[email protected]> :
[...]

Quoted 3 lines

diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c

fs/sysfs/dir.c +0 -0

[...]

Quoted 8 lines

fs/sysfs/dir.c line 59

Quoted 6 lines
fs/sysfs/dir.c +1 -1
@@ -56,7 +56,7 @@
 
 	sd = sysfs_new_dirent(parent_sd, element);
 	if (!sd)
-		return 0;
+		return -ENOMEMurn -ENOMEM;

Oops.

Yeah, I don't know what happened with my tools here. But if you look at the next patch in the series, I fixed it.

thanks,

greg k-h

#12 lore raw
In reply to Greg KH
Quoted 6 lines · Greg KH

David Brownell:
o driver core: shrink struct device a bit

Greg Kroah-Hartman:
o driver core: fix up some missed power_state changes from David's patch

Hmm. Apparently drivers/ide/ppc/pmac.c wasn't among those fixed up:

drivers/ide/ppc/pmac.c: In function `pmac_ide_macio_suspend':
drivers/ide/ppc/pmac.c:1363: error: structure has no member named power_state' drivers/ide/ppc/pmac.c:1366: error: structure has no member named power_state'
...

Is it always valid to just replace

	dev->dev.power_state

with

	dev->dev.power.power_state

or is there anything subtler going on?

Linus

author
#13 lore raw
Quoted 10 lines · Linus Torvalds
Quoted 6 lines · Greg KH

David Brownell:
o driver core: shrink struct device a bit

Greg Kroah-Hartman:
o driver core: fix up some missed power_state changes from David's patch

Quoted 6 lines

Hmm. Apparently drivers/ide/ppc/pmac.c wasn't among those fixed up:

drivers/ide/ppc/pmac.c: In function `pmac_ide_macio_suspend':
drivers/ide/ppc/pmac.c:1363: error: structure has no member named power_state' drivers/ide/ppc/pmac.c:1366: error: structure has no member named power_state'
...

Oops, sorry about that.

Quoted 7 lines

Is it always valid to just replace

	dev->dev.power_state

with

	dev->dev.power.power_state

Yes it is.

Quoted 1 line

or is there anything subtler going on?

Nope, nothing subtle here :)

thanks,

greg k-h