Re: [PATCH] RFC: MFD: driver for Atmel Microcontroller on iPaq h3xxx

From: Lee Jones
Date: Wed Apr 02 2014 - 08:14:58 EST


> > Does it matter that you're using:
> >
> > module_platform_driver();
> >
> > ... yet you can't build this as a module?
>
> I think it's a conceptual thing. Module means two things (IIUC):
> (a) it is a run-time loadable module
> (b) it's a piece of compartmentalized code
>
> In this case the macro refers to (b). module_platform_driver()
> resolves to module_driver() from <linux/device.h>
> and it's clearly a core part of the device core and available
> no matter whether the file is used as module at runtime or not.
> It just simplifies the initcalls and that's no different depending
> on whether the code is compiled-in or used as module.

Fair enough.

> >> + case MSG_KEYBOARD:
> >> + if (micro->key != NULL)
> >
> > !micro->key
>
> I guess you mean if (micro->key) {} rather than the !invert,
> but I get it, changed everywhere we check for != NULL like this.

Yes sorry, I'm so used to seeing (thing == NULL), but you knew what I
meant.

[...]

> >> +static int micro_suspend(struct device *dev)
> >> +{
> >> + return 0;
> >> +}
> >
> > Doesn't the PM framework check for NULL .suspend?
>
> No it's just like:
>
> #ifdef CONFIG_SUSPEND
> case PM_EVENT_SUSPEND:
> return ops->suspend;
> case PM_EVENT_RESUME:
> return ops->resume;
> #endif /* CONFIG_SUSPEND */
>
> (drivers/power/main.c)

base/ ---^

Right, but a NULL return _is_ valid from here and is subsequently dealt
with in the correct way.

[...]
callback = pm_op(dev->type->pm, state);
goto Driver;

[...]

Driver:
if (!callback && dev->driver && dev->driver->pm) {
info = "driver ";
callback = pm_op(dev->driver->pm, state);
}
[...]

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/