Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1399058 > unrolled thread
| Started by | William Breathitt Gray <vilhelm.gray@gmail.com> |
|---|---|
| First post | 2016-05-11 15:10 +0200 |
| Last post | 2016-05-11 16:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] watchdog: ebc-c384_wdt: Simplify ebc_c384_wdt_start timeout computation William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-05-11 15:10 +0200
Re: [PATCH] watchdog: ebc-c384_wdt: Simplify ebc_c384_wdt_start timeout computation Guenter Roeck <linux@roeck-us.net> - 2016-05-11 15:50 +0200
Re: [PATCH] watchdog: ebc-c384_wdt: Simplify ebc_c384_wdt_start timeout computation William Breathitt Gray <vilhelm.gray@gmail.com> - 2016-05-11 16:00 +0200
| From | William Breathitt Gray <vilhelm.gray@gmail.com> |
|---|---|
| Date | 2016-05-11 15:10 +0200 |
| Subject | [PATCH] watchdog: ebc-c384_wdt: Simplify ebc_c384_wdt_start timeout computation |
| Message-ID | <rxC3M-to-9@gated-at.bofh.it> |
The ebc_c384_wdt_set_timeout function already rounds up timeout values greater than 255 to a multiple of 60, so there is no need to round again in the ebc_c384_wdt_start function; a timeout value greater than 255 in ebc_c384_wdt_start will divide cleanly by 60. Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> --- drivers/watchdog/ebc-c384_wdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/watchdog/ebc-c384_wdt.c b/drivers/watchdog/ebc-c384_wdt.c index 77fda0b..948e687 100644 --- a/drivers/watchdog/ebc-c384_wdt.c +++ b/drivers/watchdog/ebc-c384_wdt.c @@ -51,7 +51,7 @@ static int ebc_c384_wdt_start(struct watchdog_device *wdev) /* resolution is in minutes for timeouts greater than 255 seconds */ if (t > 255) - t = DIV_ROUND_UP(t, 60); + t /= 60; outb(t, PET_ADDR); -- 2.7.3
[toc] | [next] | [standalone]
| From | Guenter Roeck <linux@roeck-us.net> |
|---|---|
| Date | 2016-05-11 15:50 +0200 |
| Subject | Re: [PATCH] watchdog: ebc-c384_wdt: Simplify ebc_c384_wdt_start timeout computation |
| Message-ID | <rxCGv-Pf-21@gated-at.bofh.it> |
| In reply to | #1399058 |
On Wed, May 11, 2016 at 09:05:51AM -0400, William Breathitt Gray wrote: > The ebc_c384_wdt_set_timeout function already rounds up timeout values > greater than 255 to a multiple of 60, so there is no need to round again > in the ebc_c384_wdt_start function; a timeout value greater than 255 in > ebc_c384_wdt_start will divide cleanly by 60. > ... except if the timeout is set with the module parameter, which is now rounded down, which would be a problem since it would time out earlier than expected (a timeout of 299 seconds, set with the module parameter, would time out after 240 seconds). So you would have to do some calculations on the timeout value set with the module parameter to ensure that it is set to a correct value. Guenter > Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com> > --- > drivers/watchdog/ebc-c384_wdt.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/watchdog/ebc-c384_wdt.c b/drivers/watchdog/ebc-c384_wdt.c > index 77fda0b..948e687 100644 > --- a/drivers/watchdog/ebc-c384_wdt.c > +++ b/drivers/watchdog/ebc-c384_wdt.c > @@ -51,7 +51,7 @@ static int ebc_c384_wdt_start(struct watchdog_device *wdev) > > /* resolution is in minutes for timeouts greater than 255 seconds */ > if (t > 255) > - t = DIV_ROUND_UP(t, 60); > + t /= 60; > > outb(t, PET_ADDR); > > -- > 2.7.3 >
[toc] | [prev] | [next] | [standalone]
| From | William Breathitt Gray <vilhelm.gray@gmail.com> |
|---|---|
| Date | 2016-05-11 16:00 +0200 |
| Subject | Re: [PATCH] watchdog: ebc-c384_wdt: Simplify ebc_c384_wdt_start timeout computation |
| Message-ID | <rxCQa-UH-3@gated-at.bofh.it> |
| In reply to | #1399097 |
On Wed, May 11, 2016 at 06:43:27AM -0700, Guenter Roeck wrote: >On Wed, May 11, 2016 at 09:05:51AM -0400, William Breathitt Gray wrote: >> The ebc_c384_wdt_set_timeout function already rounds up timeout values >> greater than 255 to a multiple of 60, so there is no need to round again >> in the ebc_c384_wdt_start function; a timeout value greater than 255 in >> ebc_c384_wdt_start will divide cleanly by 60. >> >... except if the timeout is set with the module parameter, which is now >rounded down, which would be a problem since it would time out earlier than >expected (a timeout of 299 seconds, set with the module parameter, would >time out after 240 seconds). So you would have to do some calculations >on the timeout value set with the module parameter to ensure that it is >set to a correct value. > >Guenter Oops, I overlooked that scenario. Please ignore this patch as your are correct that a timeout set via module parameter would not necessarily be a multiple of 60; timeout in the start callback should indeed be rounded. William Breathitt Gray
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web