Skip to contentSkip to conversation

via-pmu: Wrap some uses of sleep_in_progress with proper ifdef's

PATCH In review Ben Collins 3 participants 4 messages Jan 4, 2006 – Jan 6, 2006 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 12/15 via-pmu: Wrap some uses of sleep_in_progress with proper ifdef's

Basically completes what's already in the rest of the driver. sleep_in_progress is only defined for pm+ppc32.

---

 drivers/macintosh/via-pmu.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

3ab202d5d55c3ea17d88454b212a0363f9a2b115

drivers/macintosh/via-pmu.c +4 -0
index 5640435..64549ad 100644
@@ -2911,8 +2911,10 @@ pmu_ioctl(struct inode * inode, struct f
 	 * the fbdev
 	 */
 	case PMU_IOC_GET_BACKLIGHT:
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 		if (sleep_in_progress)
 			return -EBUSY;
+#endif
 		error = get_backlight_level();
 		if (error < 0)
 			return error;
@@ -2920,8 +2922,10 @@ pmu_ioctl(struct inode * inode, struct f
 	case PMU_IOC_SET_BACKLIGHT:
 	{
 		__u32 value;
+#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
 		if (sleep_in_progress)
 			return -EBUSY;
+#endif
 		error = get_user(value, argp);
 		if (!error)
 			error = set_backlight_level(value);
Signature · 1 line
1.0.5
#1 lore raw

Hi Ben

Quoted 4 lines · Ben Collins

Basically completes what's already in the rest of the driver. sleep_in_progress is only defined for pm+ppc32.

We've already found a different solution to this in the Linuxppc-dev list.

See:
http://patchwork.ozlabs.org/linuxppc/patch?id=3737

Fix compilation of via-pmu.c without Power Management support.

---

--- linux/drivers/macintosh/via-pmu.c.orig2005-12-15 11:28:28.000000000 +0800
+++ linux/drivers/macintosh/via-pmu.c2005-12-15 12:20:43.000000000 +0800 @@ -157,8 +157,8 @@ static int pmu_version;
static int drop_interrupts;
#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
static int option_lid_wakeup = 1;
-static int sleep_in_progress;
#endif /* CONFIG_PM && CONFIG_PPC32 */
+static int sleep_in_progress;
static unsigned long async_req_locks;
static unsigned int pmu_irq_stats[11];

#2 lore raw
Quoted 6 lines · Kristian Mueller

Hi Ben

Quoted 3 lines · Ben Collins

Basically completes what's already in the rest of the driver. sleep_in_progress is only defined for pm+ppc32.

Quoted 7 lines
Quoted 1 line

We've already found a different solution to this in the Linuxppc-dev list.

See:
http://patchwork.ozlabs.org/linuxppc/patch?id=3737

That patch makes no sense. It just moves the variable out of the ifdef, but if CONFIG_PM or CONFIG_PPC32 is not enabled, then the variable never gets modified, and so is always 0. Why not just wrap all the code that uses it (like my patch did)?

Signature · 3 lines
   Ben Collins <[email protected]>
   Developer
   Ubuntu Linux
#3 lore raw

Hi Ben

Quoted 11 lines · Ben Collins
Quoted 5 lines · Kristian Mueller

We've already found a different solution to this in the Linuxppc-dev list.

See:
http://patchwork.ozlabs.org/linuxppc/patch?id=3737

That patch makes no sense. It just moves the variable out of the ifdef, but if CONFIG_PM or CONFIG_PPC32 is not enabled, then the variable never gets modified, and so is always 0. Why not just wrap all the code that uses it (like my patch did)?

I had quite the same approach in mind but as Olof Johansson remarked in
http://patchwork.ozlabs.org/linuxppc/patch?id=3736 this would just introduce more unnecessary #ifdefs.

Regards,
Kristian