LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Mike Frysinger" <vapier.adi@gmail.com>
To: "Marc Pignat" <marc.pignat@hevs.ch>
Cc: wim@iguana.be, linux-kernel@vger.kernel.org
Subject: Re: [RFC, PATCH] watchdog on gpio
Date: Mon, 14 Jan 2008 03:04:36 -0500	[thread overview]
Message-ID: <8bd0f97a0801140004q6a32c2ceh397a2208d3012f0e@mail.gmail.com> (raw)
In-Reply-To: <200801101611.08867.marc.pignat@hevs.ch>

On Jan 10, 2008 10:11 AM, Marc Pignat <marc.pignat@hevs.ch> wrote:
> watchdog driver for embedded systems with a supervisor watchdog (MAX823 or so)
> connected to a gpio. This is the platform_driver and needs platform_data for
> defining the gpio pin and the watchdog timeout.

generic gpio watchdog is good stuff ...

> #include <linux/gpio_wdt.h>

perhaps "watchdog" rather than "wdt" considering it's already
"linux/watchdog.h" ?

> --- a/drivers/watchdog/gpio_wdt.c       1970-01-01 01:00:00.000000000 +0100
> +++ b/drivers/watchdog/gpio_wdt.c       2008-01-10 16:06:09.000000000 +0100
> +#include <asm/arch/gpio.h>

this should be <asm/gpio.h>

> +static struct watchdog_info ident = {
> +       .firmware_version = 0,

no point in setting this i dont think ...

> +static int gpio_wdt_ioctl(struct inode *inode, struct file *file,
> +    unsigned int cmd, unsigned long arg)
> +{
> +       case WDIOC_KEEPALIVE:
> +               gpio_wdt_keepalive(wdt);
> +               return 0;

this two lines should be merged.

> +       default:
> +               return -ENOIOCTLCMD;

should be -ENOTTY like all the other watchdogs

> +static char banner[] __initdata = KERN_INFO PFX "fixed %d.%03d seconds timeout (nowayout= %d)\n";

this only gets used once in the init function ... having it be broken
out like this is kind of silly

> +static int __init gpio_wdt_probe(struct platform_device *pdev)

shouldnt this be __devinit ?

> +       if (watchdog) {
> +               printk(KERN_ERR PFX "only one device supported\n");
> +               return -ENODEV;
> +       }

why ?  it'd be trivial to abstract this driver away from a global
"watchdog" state into a proper arbitrary # of gpio watchdogs.

> +static int __exit gpio_wdt_remove(struct platform_device *pdev)

shouldnt this be __devexit ?

> +#define gpio_wdt_suspend()
> +#define gpio_wdt_resume()

i'm pretty sure this is incorrect and instead should read:
#define gpio_wdt_suspend NULL
#define gpio_wdt_resume NULL

> +static struct platform_driver gpio_wdt_driver = {
> +       .probe          = gpio_wdt_probe,
> +       .remove         = __exit_p(gpio_wdt_remove),

once you fix the remove to be __devexit, this should be __devexit_p()

> --- a/drivers/watchdog/Kconfig  2008-01-08 17:30:30.000000000 +0100
> +++ b/drivers/watchdog/Kconfig  2008-01-10 14:00:30.000000000 +0100
> +config GPIO_WATCHDOG
> +       tristate "Support for GPIO connected watchdog"
> +       depends on GENERIC_GPIO
> +       help
> +         This option enables support for a MAX823-like watchdog connected to
> +         GPIO input/output.

this is misleading/confusing.  suggested rewording:
This option enables support for a watchdog connected via GPIO lines
(such as the MAX823).

To compile this driver as a module, choose M here: the module will be
called gpio_wdt.

> --- a/include/linux/gpio_wdt.h  1970-01-01 01:00:00.000000000 +0100
> +++ b/include/linux/gpio_wdt.h  2008-01-10 15:48:42.000000000 +0100
> +#include <asm/arch/hardware.h>

no idea why you're including this as it is surely incorrect and not
needed.  please remove it and add <linux/types.h>.

> +#define GPIO_WDT_DRIVER_NAME "gpio_wdt"

this belongs in the driver C file, not the header.
-mike

  parent reply	other threads:[~2008-01-14  8:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-10 15:11 Marc Pignat
2008-01-10 17:14 ` Ben Dooks
2008-01-11 16:40 ` Florian Fainelli
2008-01-14  7:34   ` Marc Pignat
2008-01-14  8:08   ` Mike Frysinger
2008-01-14  8:04 ` Mike Frysinger [this message]
2008-01-14  9:03   ` Alan Cox
2008-01-14  9:28     ` Mike Frysinger
2008-01-14  9:29       ` Alan Cox
2008-01-14  9:45         ` Mike Frysinger
2008-01-14 12:14           ` Haavard Skinnemoen
2008-01-14 12:22             ` Mike Frysinger
2008-01-14 13:30               ` Haavard Skinnemoen
2008-01-14 12:49           ` Johannes Weiner
2008-01-14 13:03             ` Mike Frysinger
2008-01-14 13:56               ` printk-wrapper with sectionized string constants [was: Re: [RFC, PATCH] watchdog on gpio] Johannes Weiner

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=8bd0f97a0801140004q6a32c2ceh397a2208d3012f0e@mail.gmail.com \
    --to=vapier.adi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.pignat@hevs.ch \
    --cc=wim@iguana.be \
    --subject='Re: [RFC, PATCH] watchdog on gpio' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).