lkml.org 
[lkml]   [2004]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] enums to clear suspend-state confusion
Hi!

> > Now, Patrick has some plans with device power managment and they
> > included something bigger being passed down to the drivers. I wanted
> > to prepare for those plans.
> >
> > I can replace suspend_state_t with enum system_state, but it might
> > mean that enum system_state will have to be extended with things like
> > RUNTIME_PM_PCI_D0 in future... I guess that's easiest thing to do. It
> > solves all the problems we have *now*.
>
> Better is to use a typedef then, so that enum can be turned into a
> pointer to a structure later on, and drivers using the "helper"
> function to_pci_state() would not need any change when that transition
> happen.

Yes, that's exactly what I did... Unfortunately typedef means ugly
code. So I'll just switch it back to enum system_state, and lets care
about device power managment when it hits us, okay?

--- tmp/linux/include/linux/pci.h 2004-08-15 19:15:05.000000000 +0200
+++ linux/include/linux/pci.h 2004-08-17 23:16:41.000000000 +0200
...
const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
- int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */
+ int (*suspend) (struct pci_dev *dev, suspend_state_t reason); /* Device suspended */
int (*resume) (struct pci_dev *dev); /* Device woken up */
int (*enable_wake) (struct pci_dev *dev, u32 state, int enable); /* Enable wake event */
--- tmp/linux/include/linux/pm.h 2004-08-15 19:15:05.000000000 +0200
+++ linux/include/linux/pm.h 2004-08-15 19:35:41.000000000 +0200
...
+/*
+ * For now, drivers only get system state. Later, this is going to become
+ * structure or something to enable runtime power managment.
+ */
+typedef enum system_state suspend_state_t;
+
+#define SUSPEND_EQ(a, b) (a == b)
+
enum {
PM_DISK_FIRMWARE = 1,
PM_DISK_PLATFORM,
--
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:05    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site