lkml.org 
[lkml]   [2012]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] rtc-pcf8523: Add low battery voltage support
On Wed, Dec 19, 2012 at 04:34:32PM +0100, Jesper Nilsson wrote:
> This patch implements reading of the battery voltage low signal for
> rtc-pcf8523.
>
> The bit is read-only and cannot be cleared by software, so no
> clear-function is implemented.
>
> Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
> ---
> diff --git a/drivers/rtc/rtc-pcf8523.c b/drivers/rtc/rtc-pcf8523.c
> index be05a64..62905fb 100644
> --- a/drivers/rtc/rtc-pcf8523.c
> +++ b/drivers/rtc/rtc-pcf8523.c
> @@ -23,6 +23,7 @@
> #define REG_CONTROL3_PM_VDD (1 << 6) /* switch-over disabled */
> #define REG_CONTROL3_PM_DSM (1 << 5) /* direct switching mode */
> #define REG_CONTROL3_PM_MASK 0xe0
> +#define REG_CONTROL3_BLF (1 << 2) /* battery low bit, read-only */
>
> #define REG_SECONDS 0x03
> #define REG_SECONDS_OS (1 << 7)
> @@ -250,9 +252,36 @@ static int pcf8523_rtc_set_time(struct device *dev, struct rtc_time *tm)
> return pcf8523_start_rtc(client);
> }
>
> +static int
> +pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)

You should keep the modifier and return type on the same line as the
function name and wrap the arguments instead. That is:

static int pcf8523_rtc_ioctl(struct device *dev, unsigned int cmd,
unsigned long arg)
{
...
}

> +{
> + struct i2c_client *client = to_i2c_client(dev);
> + u8 value;
> + int err;
> + int ret = 0;

You can probably collapse the two integers in one line, like so:

int ret = 0, err;

Other than that, looks good:

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-12-19 17:21    [W:1.319 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site