On Fri, 23 May 2008, Francesco VIRLINZI wrote: > Hi Alan > Thank for your reply. > > That isn't the only way to check the power state. You should have a > > private data structure associated with each of the devices you care > > about. The address of the private data structure is what you store in > > platform_set_drvdata(). In the private data structure you can have a > > field to indicate the device's power state. > > > Yes you are right. > The problem is that each driver can use the private_data as it wants, > while I need a generic > API to understand the power state of device. That's not the only problem. Each driver can also use dev->power.power_state.event the way it wants. So looking at that field won't tell you anything. > Your suggestion works fine if (internally) we assume an agreement > (i.e.: the first word in the private data is the power state) and in > this manner > I can analyse several IP with a single API. > But to do that (at the moment) I just do > (dev->power.power_state.event == xx) > > and PM_EVENT_ON/PM_EVENT_SUSPEND are good enough. > > Why did you decide to remove it? Because it is almost meaningless. For example, suppose a particular platform device has 3 power states: On with high performance, on with low performance, and off. Then how can you tell which state it is in by looking at dev->power.power_state.event? I suspect that you are trying to solve some problem in the wrong way. But without knowing what that problem is, I can't advise you on better ways to solve it. Alan Stern _______________________________________________ linux-pm mailing list linux-pm@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linux-foundation.org/mailman/listinfo/linux-pm