[linux-pm] pm_message_t becoming struct

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

> > static int foo_suspend(struct pci_dev *pdev, u32 state)
> > 
> > . that's wrong. Now we have
> > 
> > static int foo_suspend(struct pci_dev *pdev, pm_message_t state)
> > 
> > , which is slightly better, but people still get it wrong, because
> > pm_message_t is compatible with u32. Oops. Obvious solution is to make
> > pm_message_t typedefed into struct, so people can't do the typing
> > wrong. This is kernel 101.
> > 
> > What you would like to have is
> > 
> > static int foo_suspend(struct pci_dev *pdev, struct pm_message *state)
> > 
> > which I agree is marginally nicer to look at, but still does not
> > provide enough typechecking and [more importantly] there's no way in
> > hell we are doing second search and replace over all the drivers.
> 
> Are you willing to go halfway?  If we do something more like this:
> 
> 	typedef struct {
> 		struct pm_message *m;
> 	} pm_message_t;
> 
> then the code can pass pm_message_t's around with full type-checking and
> still retain the benefit of sending a pointer rather than a structure.
> 
> Yes, it looks stupid.  But it's a reasonable compromise that won't

I'm afraid it really looks stupid. [It actually has benefit that we
_could_ go over tree in future and change pm_message_t into struct
pm_message *.]

OTOH we would probably be stuck with this stupid-looking-thing
forever, and I'd really prefer to avoid that.

								Pavel
-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux