mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kumar Gala <galak@kernel.crashing.org>
To: Alessandro Zummo <alessandro.zummo@towertech.it>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rtc: Added support for ds1672 control
Date: Tue, 28 Mar 2006 16:04:20 -0600	[thread overview]
Message-ID: <08A09790-5D74-4089-AA7B-6AB5628A19DD@kernel.crashing.org> (raw)
In-Reply-To: <20060328234027.26b5602b@inspiron>


On Mar 28, 2006, at 3:40 PM, Alessandro Zummo wrote:

> On Tue, 28 Mar 2006 15:07:33 -0600 (CST)
> Kumar Gala <galak@kernel.crashing.org> wrote:
>
>  is almost ok, please check my comments below:
>
>>
>>  	buf[0] = DS1672_REG_CNT_BASE;
>>  	buf[1] = secs & 0x000000FF;
>>  	buf[2] = (secs & 0x0000FF00) >> 8;
>>  	buf[3] = (secs & 0x00FF0000) >> 16;
>>  	buf[4] = (secs & 0xFF000000) >> 24;
>> +	buf[5] = 0;
>
>  I'd add a comment to say that 0 enables the osc.

ack.

>> +static int ds1672_get_control(struct i2c_client *client)
>> +{
>
> [..]
>
>> +	} else
>> +		return val;
>> +}
>
>  I think it would be cleaner to define the routine as follow:
> .. ds1672_get_control(...., unsigned char *status)
>
>  and to usa the space provided by the caller to store the result.
>
>> +	if (ds1672_get_control(client))
>> +		state = "disabled";
>> +	return sprintf(buf, "%s\n", state);
>> +}

Not sure if I follow you here.  I think you are suggesting for  
ds1672_get_control to look like:

static int ds1672_get_control(struct i2c_client *client, u8 *status)
{
         unsigned char addr = DS1672_REG_CONTROL;

         struct i2c_msg msgs[] = {
                 { client->addr, 0, 1, &addr },          /* setup  
read ptr */
                 { client->addr, I2C_M_RD, 1, status },  /* read  
control */
         };
...
}

which is fine.  Any suggestions on what to do on an error in the  
sysfs attrib function?

> please #define DS1672_REG_CONTROL_EOSC 0x80
> and check the single bit.

ack

>> +	err = ds1672_get_control(client);
>
>  ditto.
>
>
>  thanks for your work!

no problem.

- k

  reply	other threads:[~2006-03-28 22:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-28 21:07 Kumar Gala
2006-03-28 21:40 ` Alessandro Zummo
2006-03-28 22:04   ` Kumar Gala [this message]
2006-03-28 22:41     ` Alessandro Zummo
2006-03-28 22:55       ` [PATCH][UPDATE] " Kumar Gala
2006-03-28 23:48         ` Alessandro Zummo
2006-03-28 23:52           ` Kumar Gala
2006-03-28 23:57             ` Alessandro Zummo
2006-03-30 20:06               ` Kumar Gala
2006-03-30 20:26                 ` Alessandro Zummo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=08A09790-5D74-4089-AA7B-6AB5628A19DD@kernel.crashing.org \
    --to=galak@kernel.crashing.org \
    --cc=alessandro.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®