2008-03-28 12:59:47

by David Fries

[permalink] [raw]
Subject: [PATCH 22/35] W1: ds1wm.c msleep for reset

masters/ds1wm.c 1.4
Like the previous w1_io.c reset coments and msleep patch, I don't have
the hardware to verify the change, but I think it is safe. It also
helps to see a comment like this in the code.
"We'll wait a bit longer just to be sure."
If they are going to calculate delaying 324.9us, but actually delay
500us, why not just give up the CPU and sleep? This is designed for a
battery powered ARM system, avoiding busywaiting has to be good for
battery life.

I sent a request for testers March 7, 2008 to the Linux kernel mailing
list and two developers who have patches for ds1wm.c, but I didn't get
any respons.

Signed-off-by: David Fries <[email protected]>
---
drivers/w1/masters/ds1wm.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index ea894bf..29e144f 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -160,8 +160,10 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
* 625 us - 60 us - 240 us - 100 ns = 324.9 us
*
* We'll wait a bit longer just to be sure.
+ * Was udelay(500), but if it is going to busywait the cpu that long,
+ * might as well come back later.
*/
- udelay(500);
+ msleep(1);

ds1wm_write_register(ds1wm_data, DS1WM_INT_EN,
DS1WM_INTEN_ERBF | DS1WM_INTEN_ETMT | DS1WM_INTEN_EPD |
--
1.4.4.4


Attachments:
(No filename) (1.34 kB)
(No filename) (189.00 B)
Download all attachments

2008-03-30 11:38:24

by Evgeniy Polyakov

[permalink] [raw]
Subject: Re: [PATCH 22/35] W1: ds1wm.c msleep for reset

On Fri, Mar 28, 2008 at 07:27:00AM -0500, David Fries ([email protected]) wrote:
> masters/ds1wm.c 1.4
> Like the previous w1_io.c reset coments and msleep patch, I don't have
> the hardware to verify the change, but I think it is safe. It also
> helps to see a comment like this in the code.
> "We'll wait a bit longer just to be sure."
> If they are going to calculate delaying 324.9us, but actually delay
> 500us, why not just give up the CPU and sleep? This is designed for a
> battery powered ARM system, avoiding busywaiting has to be good for
> battery life.

Ack, but would like to here from Matt Reimer.
Added to Cc:

> I sent a request for testers March 7, 2008 to the Linux kernel mailing
> list and two developers who have patches for ds1wm.c, but I didn't get
> any respons.
>
> Signed-off-by: David Fries <[email protected]>
> ---
> drivers/w1/masters/ds1wm.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
> index ea894bf..29e144f 100644
> --- a/drivers/w1/masters/ds1wm.c
> +++ b/drivers/w1/masters/ds1wm.c
> @@ -160,8 +160,10 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
> * 625 us - 60 us - 240 us - 100 ns = 324.9 us
> *
> * We'll wait a bit longer just to be sure.
> + * Was udelay(500), but if it is going to busywait the cpu that long,
> + * might as well come back later.
> */
> - udelay(500);
> + msleep(1);
>
> ds1wm_write_register(ds1wm_data, DS1WM_INT_EN,
> DS1WM_INTEN_ERBF | DS1WM_INTEN_ETMT | DS1WM_INTEN_EPD |
> --
> 1.4.4.4



--
Evgeniy Polyakov

2008-03-30 13:44:34

by David Fries

[permalink] [raw]
Subject: Re: [PATCH 22/35] W1: ds1wm.c msleep for reset

On Sun, Mar 30, 2008 at 03:38:06PM +0400, Evgeniy Polyakov wrote:
> On Fri, Mar 28, 2008 at 07:27:00AM -0500, David Fries ([email protected]) wrote:
> > masters/ds1wm.c 1.4
> > Like the previous w1_io.c reset coments and msleep patch, I don't have
> > the hardware to verify the change, but I think it is safe. It also
> > helps to see a comment like this in the code.
> > "We'll wait a bit longer just to be sure."
> > If they are going to calculate delaying 324.9us, but actually delay
> > 500us, why not just give up the CPU and sleep? This is designed for a
> > battery powered ARM system, avoiding busywaiting has to be good for
> > battery life.
>
> Ack, but would like to here from Matt Reimer.
> Added to Cc:

Yes, it would be nice to hear from someone with the hardware, but it
has been over three weeks without a response.

Date: Fri, 7 Mar 2008 22:37:37 -0600
Subject: [W1] ds1wm: testers please, msleep not udelay
Cc: Anton Vorontsov <[email protected]>,
Matt Reimer <[email protected]>


> > I sent a request for testers March 7, 2008 to the Linux kernel mailing
> > list and two developers who have patches for ds1wm.c, but I didn't get
> > any respons.
> >
> > Signed-off-by: David Fries <[email protected]>
> > ---
> > drivers/w1/masters/ds1wm.c | 4 +++-
> > 1 files changed, 3 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
> > index ea894bf..29e144f 100644
> > --- a/drivers/w1/masters/ds1wm.c
> > +++ b/drivers/w1/masters/ds1wm.c
> > @@ -160,8 +160,10 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
> > * 625 us - 60 us - 240 us - 100 ns = 324.9 us
> > *
> > * We'll wait a bit longer just to be sure.
> > + * Was udelay(500), but if it is going to busywait the cpu that long,
> > + * might as well come back later.
> > */
> > - udelay(500);
> > + msleep(1);
> >
> > ds1wm_write_register(ds1wm_data, DS1WM_INT_EN,
> > DS1WM_INTEN_ERBF | DS1WM_INTEN_ETMT | DS1WM_INTEN_EPD |
> > --
> > 1.4.4.4
>
>
>
> --
> Evgeniy Polyakov

--
David Fries <[email protected]>
http://fries.net/~david/ (PGP encryption key available)