Messages in this thread |  | | | Date | Wed, 14 Sep 2005 17:14:29 -0700 | | From | David Brownell <> | | Subject | Re: [RFC][PATCH] SPI subsystem |
| |
> > >+static int spi_suspend(struct device * dev, u32 state) > > >+{ > > >... > > >+ list_for_each_entry(child, &dev->children, node) {
That should probably use device_for_each_child() if you're going to do it that way ...
> > >+ if (child->driver && child->driver->suspend) { > > >+ ret = child->driver->suspend(child, state, SUSPEND_DISABLE); > > >+ if (ret == 0) > > >+ ret = child->driver->suspend(child, state, SUSPEND_SAVE_STATE); > > >+ if (ret == 0) > > >+ ret = child->driver->suspend(child, state, SUSPEND_POWER_DOWN); > > >+ } > > >+ } > > > > > > > > Oh my God. It will be called 3 times for each child > > entry, isn't it?! > > OK. This stuff is probably wrong. I used the platform > subsystem as an example. I need to do more research > into how much work the driver core does for you.
Most platform drivers I've seen just handle the power on/off requests. I think there's some historical reason that the "reason" stuff exists ... but I suspect not many folk would get unhappy if that were removed, and those calls got simplified.
- Dave
- 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/
|  |