mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: David Cohen <david.a.cohen@linux.intel.com>
Cc: wim@iguana.be, tglx@linutronix.de, mingo@redhat.com,
	hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org,
	linux-watchdog@vger.kernel.org, gnomes@lxorguk.ukuu.org.uk
Subject: Re: [PATCH v3 2/2] x86: intel-mid: add watchdog platform code for Merrifield
Date: Tue, 15 Apr 2014 12:09:02 -0700	[thread overview]
Message-ID: <20140415190902.GB7940@roeck-us.net> (raw)
In-Reply-To: <1397587272-31152-3-git-send-email-david.a.cohen@linux.intel.com>

On Tue, Apr 15, 2014 at 11:41:12AM -0700, David Cohen wrote:
> This patch adds platform code for Intel Merrifield.
> Since the watchdog is not part of SFI table, we have no other option but
> to manually register watchdog's platform device (argh!).
> 
argh ... does this really belong into the commit log ?

> Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
> ---
>  arch/x86/platform/intel-mid/device_libs/Makefile   |  1 +
>  .../platform/intel-mid/device_libs/platform_wdt.c  | 63 ++++++++++++++++++++++
>  2 files changed, 64 insertions(+)
>  create mode 100644 arch/x86/platform/intel-mid/device_libs/platform_wdt.c
> 
> diff --git a/arch/x86/platform/intel-mid/device_libs/Makefile b/arch/x86/platform/intel-mid/device_libs/Makefile
> index 097e7a7940d8..af9307f2cc28 100644
> --- a/arch/x86/platform/intel-mid/device_libs/Makefile
> +++ b/arch/x86/platform/intel-mid/device_libs/Makefile
> @@ -20,3 +20,4 @@ obj-$(subst m,y,$(CONFIG_DRM_MEDFIELD)) += platform_tc35876x.o
>  obj-$(subst m,y,$(CONFIG_SERIAL_MRST_MAX3110)) += platform_max3111.o
>  # MISC Devices
>  obj-$(subst m,y,$(CONFIG_KEYBOARD_GPIO)) += platform_gpio_keys.o
> +obj-$(subst m,y,$(CONFIG_INTEL_MID_WATCHDOG)) += platform_wdt.o
> diff --git a/arch/x86/platform/intel-mid/device_libs/platform_wdt.c b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
> new file mode 100644
> index 000000000000..653242110d57
> --- /dev/null
> +++ b/arch/x86/platform/intel-mid/device_libs/platform_wdt.c
> @@ -0,0 +1,63 @@
> +/*
> + * platform_wdt.c: Watchdog platform library file
> + *
> + * (C) Copyright 2014 Intel Corporation
> + * Author: David Cohen <david.a.cohen@linux.intel.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; version 2
> + * of the License.
> + */
> +
> +#include <linux/init.h>
> +#include <linux/intel-mid_wdt.h>

	/platform_data/...

> +#include <linux/interrupt.h>
> +#include <linux/platform_device.h>
> +#include <asm/intel-mid.h>
> +
> +#define TANGIER_EXT_TIMER0_MSI 15
> +
> +static struct platform_device wdt_dev = {
> +	.name = "intel_mid_wdt",
> +	.id = -1,
> +};
> +
> +static int tangier_probe(void)
> +{
> +	int ioapic;
> +	struct io_apic_irq_attr irq_attr;
> +
				= { };
would ensure that there are no un-initialized variables
if the structure definition ever changes.

Or just pre-initialize the entire structure as much as possible.

> +	ioapic = mp_find_ioapic(TANGIER_EXT_TIMER0_MSI);
> +	if (ioapic >= 0) {
> +		irq_attr.ioapic = ioapic;
> +		irq_attr.ioapic_pin = TANGIER_EXT_TIMER0_MSI;
> +		irq_attr.trigger = 1;
> +		irq_attr.polarity = 0; /* Active high */
> +		io_apic_set_pci_routing(NULL, TANGIER_EXT_TIMER0_MSI,
> +					&irq_attr);

No need for an error check ? I understand no one else does,
but why does the function return an error if no one cares about it ?

> +	} else {
> +		pr_warn("intel_mid_wdt: can not find interrupt %d in ioapic\n",
> +			TANGIER_EXT_TIMER0_MSI);

As mentioned earlier, I think it would pake sense to pass
struct platform_device * as argument and use dev_warn.

It would also enable you to use the irq passed from the parameter
instead of checking for the hard-coded define.

> +		return -EINVAL;

Why not return the error returned by mp_find_ioapic() ?

> +	}
> +
> +	return 0;
> +}
> +
> +static struct intel_mid_wdt_pdata tangier_pdata = {
> +	.irq = TANGIER_EXT_TIMER0_MSI,
> +	.probe = tangier_probe,
> +};
> +
> +static int __init register_mid_wdt(void)
> +{
> +	if (intel_mid_identify_cpu() == INTEL_MID_CPU_CHIP_TANGIER) {
> +		wdt_dev.dev.platform_data = &tangier_pdata;
> +		return platform_device_register(&wdt_dev);
> +	}
> +
> +	return -ENODEV;
> +}
> +
> +rootfs_initcall(register_mid_wdt);
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2014-04-15 19:09 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-08 20:59 [PATCH 0/2] Initial implementation of Intel MID watchdog driver David Cohen
2014-04-08 20:59 ` [PATCH 1/2] watchdog: add Intel MID watchdog driver support David Cohen
2014-04-08 23:56   ` Randy Dunlap
2014-04-09 17:48     ` David Cohen
2014-04-10 13:51       ` Guenter Roeck
2014-04-10 18:24         ` David Cohen
2014-04-09  0:17   ` Guenter Roeck
2014-04-09 12:41     ` One Thousand Gnomes
2014-04-08 20:59 ` [PATCH 2/2] x86: intel-mid: add watchdog platform code for Merrifield David Cohen
2014-04-09 12:42   ` One Thousand Gnomes
2014-04-09 13:49     ` Alexander Stein
2014-04-09 13:58       ` One Thousand Gnomes
2014-04-09 14:03         ` Alexander Stein
2014-04-09 15:18           ` Guenter Roeck
2014-04-09 16:10             ` Alexander Stein
2014-04-09 17:15               ` Guenter Roeck
2014-04-10 11:08               ` One Thousand Gnomes
2014-04-09 18:00     ` David Cohen
2014-04-10 19:15   ` Guenter Roeck
2014-04-10 19:30     ` David Cohen
2014-04-10 20:35       ` Guenter Roeck
2014-04-10 21:23         ` David Cohen
2014-04-10 22:51           ` Guenter Roeck
2014-04-11 20:50 ` [PATCH v2 0/2] Initial implementation of Intel MID watchdog driver David Cohen
2014-04-11 20:50   ` [PATCH v2 1/2] watchdog: add Intel MID watchdog driver support David Cohen
2014-04-11 20:50   ` [PATCH v2 2/2] x86: intel-mid: add watchdog platform code for Merrifield David Cohen
2014-04-15 18:41   ` [PATCH v3 0/2] Initial implementation of Intel MID watchdog driver David Cohen
2014-04-15 18:41     ` [PATCH v3 1/2] watchdog: add Intel MID watchdog driver support David Cohen
2014-04-15 19:01       ` Guenter Roeck
2014-04-15 19:24         ` David Cohen
2014-04-15 18:41     ` [PATCH v3 2/2] x86: intel-mid: add watchdog platform code for Merrifield David Cohen
2014-04-15 19:09       ` Guenter Roeck [this message]
2014-04-15 19:30         ` David Cohen
2014-04-15 20:06     ` [PATCH v4 0/2] Initial implementation of Intel MID watchdog driver David Cohen
2014-04-15 20:06       ` [PATCH v4 1/2] watchdog: add Intel MID watchdog driver support David Cohen
2014-04-16  0:13         ` Guenter Roeck
2014-04-15 20:06       ` [PATCH v4 2/2] x86: intel-mid: add watchdog platform code for Merrifield David Cohen
2014-04-15 20:09         ` David Cohen
2014-04-15 21:13           ` Guenter Roeck
2014-04-15 21:17             ` David Cohen
2014-04-15 21:35               ` Guenter Roeck
2014-04-15 21:39                 ` David Cohen
2014-04-15 22:20         ` [PATCH v4.1 " David Cohen
2014-04-16  0:16           ` Guenter Roeck

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=20140415190902.GB7940@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=david.a.cohen@linux.intel.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wim@iguana.be \
    --cc=x86@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®