All of lore.kernel.org
 help / color / mirror / Atom feed
* mb800 watchdog driver
@ 2003-03-13  8:11 Grzegorz Jaskiewicz
  2003-03-13 16:10 ` Dave Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Grzegorz Jaskiewicz @ 2003-03-13  8:11 UTC (permalink / raw)
  To: Linux Kernel Mailing List

Hello guys !

I've wrote small driver for mb800 motherboards (x86, intel). And i want
to share with others. 
Any comments/patches are welcome.

You can download source from :
http://hit-six.co.uk/~gj/mb800_watchdog.tar.bz2


-- 
Grzegorz Jaskiewicz <gj@pointblue.com.pl>
K4 Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mb800 watchdog driver
  2003-03-13 16:10 ` Dave Jones
@ 2003-03-13 15:36   ` Joern Engel
  2003-03-13 16:19   ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Joern Engel @ 2003-03-13 15:36 UTC (permalink / raw)
  To: Dave Jones, Grzegorz Jaskiewicz, Linux Kernel Mailing List

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=unknown-8bit, Size: 683 bytes --]

On Thu, 13 March 2003 15:10:33 -0100, Dave Jones wrote:
> 
> in fact, these printk's should probably be something like dprintk's
> with dprintk being defined at the top of source like..
> 
> #define DEBUG
> #ifndef DEBUG
> # define dprintk(format, args...)
> #else
> # define dprintk(format, args...) printk(KERN_DEBUG "mb8wdog:", ## args)
                                                               ^^
> #endif

You might want to put an additional whitespace at the indicated
position, that works around a gcc 2.x bug.

Jörn

-- 
Mundie uses a textbook tactic of manipulation: start with some
reasonable talk, and lead the audience to an unreasonable conclusion.
-- Bruce Perens

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mb800 watchdog driver
  2003-03-13  8:11 mb800 watchdog driver Grzegorz Jaskiewicz
@ 2003-03-13 16:10 ` Dave Jones
  2003-03-13 15:36   ` Joern Engel
  2003-03-13 16:19   ` Christoph Hellwig
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Jones @ 2003-03-13 16:10 UTC (permalink / raw)
  To: Grzegorz Jaskiewicz; +Cc: Linux Kernel Mailing List

On Thu, Mar 13, 2003 at 08:11:04AM +0000, Grzegorz Jaskiewicz wrote:
 > 
 > I've wrote small driver for mb800 motherboards (x86, intel). And i want
 > to share with others. 
 > Any comments/patches are welcome.


> #include <sys/syscall.h>

not needed.
 
> #include <linux/version.h>

not needed.

> #include <linux/errno.h>            
> #include <linux/stddef.h>           

not needed.

> #include <asm/page.h>               
> #include <asm/pgtable.h>            

not needed.

> #ifdef CONFIG_DEVFS_FS
> #include <linux/devfs_fs_kernel.h>
> #else
> #error "this driver requires devfs, otherwise it would not work - sorry dude"
> #endif

devfs only drivers == EVIL. Pure EVIL.

> spinlock_t tab_lock;

can be static

> static struct proc_dir_entry *proc_mtd;
> int tab_o_count;

unused

>static struct file_operations tabfs = {
>    owner   : THIS_MODULE,
>    open    : open_wdog,      /* open */
>    write   : write_wdog,	/* write */
>    release : close_wdog,   /* release */
> };

use C99  .owner = THIS_MODULE
Ok, this is a 2.4 driver, but it makes forward porting simpler.
Also, the comments are pointless.

> void LockChip()
> void UnLockChip()

can be static (as can most other functions in this file)

>/*
>    if (check_region(0x2e, 2)){
>	printk(KERN_INFO "tab: my I/O space is allready in use, can't share it .. sorry\n");
>	return -1;
>    }
>
>    request_region(0x2e, 2, "mb800 watchdog");
>*/    

1. Probably shouldn't be commented out.
2. Don't use check_region, just check return of request_region.

>    printk(KERN_INFO "watchdog: DIE !!!\n");

Something more userfriendly "mb8wdog: unloading\n" would be nicer.

>	printk(KERN_INFO "MB800 WATCHDOG: LOAD DEVICE ENDED\n");

KERN_DEBUG ? and STOP SHOUTING!

>	printk(KERN_INFO "MB800 WATCHDOG: ENTER CREATE DISPATCH\n");

in fact, these printk's should probably be something like dprintk's
with dprintk being defined at the top of source like..

#define DEBUG
#ifndef DEBUG
# define dprintk(format, args...)
#else
# define dprintk(format, args...) printk(KERN_DEBUG "mb8wdog:", ## args)
#endif

>    if (copy_from_user(&b, buf, 1)){
>	return -EFAULT;
>    }
>
>    if (b){    
>	EnableAndSetWatchdog(b);
>    }
>    else{
>	DisableWatchdog();
>    }

Please choose one indentation style, and stick to it.
Preferably the one described in Documenation/CodingStyle

	if (b) {
		EnableAndSetWatchdog(b);
	} else {
		DisableWatchdog();
	}

Other than these small nits, I don't see any problems with it.
The biggest issue is the devfs-only requirement, which as I mentioned,
is really evil, and afaics, totally unnecessary.

		Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mb800 watchdog driver
  2003-03-13 16:10 ` Dave Jones
  2003-03-13 15:36   ` Joern Engel
@ 2003-03-13 16:19   ` Christoph Hellwig
  1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2003-03-13 16:19 UTC (permalink / raw)
  To: Dave Jones, Grzegorz Jaskiewicz, Linux Kernel Mailing List

On Thu, Mar 13, 2003 at 03:10:33PM -0100, Dave Jones wrote:
> On Thu, Mar 13, 2003 at 08:11:04AM +0000, Grzegorz Jaskiewicz wrote:
>  > 
>  > I've wrote small driver for mb800 motherboards (x86, intel). And i want
>  > to share with others. 
>  > Any comments/patches are welcome.
> 
> 
> > #include <sys/syscall.h>
> 
> not needed.

Nor does it even compile with any recent kernel..


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mb800 watchdog driver
@ 2003-03-13 22:52 Grzegorz Jaskiewicz
  0 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Jaskiewicz @ 2003-03-13 22:52 UTC (permalink / raw)
  To: Linux Kernel Mailing List

On Thu, 2003-03-13 at 16:10, Dave Jones wrote:

> devfs only drivers == EVIL. Pure EVIL.
well, since i am using only devfs and i don't see (personaly) any reason
to continue standard /dev directory structure i didn't wrote that part,
but if somebody really want it - patches are welcomed.

I've tried to remove all unneded parts, make it more kernel style of
programming compatible.

new version is on the same place where older one was, as i assume it
does not make sense to keep old one.

http://hit-six.co.uk/~gj/mb800_watchdog.tar.bz2

Cheers.

-- 
Grzegorz Jaskiewicz <gj@pointblue.com.pl>
K4 Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: mb800 WatchDog driver
@ 2004-01-28 15:23 Grzegorz Jaskiewicz
  0 siblings, 0 replies; 6+ messages in thread
From: Grzegorz Jaskiewicz @ 2004-01-28 15:23 UTC (permalink / raw)
  To: linux-kernel

Hi folks

Here is a little update to what I posted over one year ago. Some ppl are still 
asking me about this driver. It's now avaliable from:
http://gj.pointblue.com.pl/projects/mb800_watchdog.tar.bz2

I had no chance to rewrite it properly, sorry. If someone wants me to, I will 
need this motherboard. If someone else want's to make it properly, using 
watchdog api, and has this bord with him - it will be nice. 

Thanks.
-- 
Grzegorz Jaskiewicz
K4 labs

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-01-28 15:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-13  8:11 mb800 watchdog driver Grzegorz Jaskiewicz
2003-03-13 16:10 ` Dave Jones
2003-03-13 15:36   ` Joern Engel
2003-03-13 16:19   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2003-03-13 22:52 Grzegorz Jaskiewicz
2004-01-28 15:23 mb800 WatchDog driver Grzegorz Jaskiewicz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.