Messages in this thread |  | | | Date | Wed, 24 Sep 2008 14:08:09 +0900 | | From | Paul Mundt <> | | Subject | Re: [PATCH] RTC: Add platform data structure to Ricoh RS5C372 driver |
On Wed, Sep 24, 2008 at 11:45:49AM +0900, Alexey Kopytko wrote:
> From: Alexey Kopytko <alexey@kopytko.ru>
>
> This patch enables a platform developer to choose which alarm register to use.
> It adds and properly initializes platform data structure.
>
> ---
> RS5C_REG_ALARM_B_MIN is used to store power state in
> Buffalo Linkstation Mini and some other Linkstations.
> Tested with and without platform data.
>
> Signed-off-by: Alexey Kopytko <alexey@kopytko.ru>
>
[snip]
> +#ifndef _LINUX_RTC_RS5C372_H_
> +#define _LINUX_RTC_RS5C372_H_
> +
> +#define RS5C_REG_ALARM_A_MIN 8 /* or ALARM_W */
> +#define RS5C_REG_ALARM_A_HOURS 9
> +#define RS5C_REG_ALARM_A_WDAY 10
> +
> +#define RS5C_REG_ALARM_B_MIN 11 /* or ALARM_D */
> +#define RS5C_REG_ALARM_B_HOURS 12
> +#define RS5C_REG_ALARM_B_WDAY 13 /* (ALARM_B only) */
> +
> +struct rs5c_plat_data {
> + /* What alarm regs to use */
> + int alarm_min;
> + int alarm_hours;
> +};
I don't think this is a meaningful abstraction. Pushing this sort of
knowledge in to the platform code is pretty ugly, especially when the
only distinction you need is whether to use the A set or the B set.
Given that, you could simply have a flags field in the platform data and
use one bit to test in the driver for using the B set of registers (A is
always the default otherwise).
|  |