All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabor Juhos <juhosg@openwrt.org>
To: John Crispin <blogic@openwrt.org>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [PATCH V2 15/16] MIPS: ralink: add support for periodic timer irq
Date: Fri, 12 Apr 2013 18:35:48 +0200	[thread overview]
Message-ID: <516837E4.4060206@openwrt.org> (raw)
In-Reply-To: <1365751663-5725-15-git-send-email-blogic@openwrt.org>

2013.04.12. 9:27 keltezéssel, John Crispin írta:
> Adds a driver for the periodic timer found on Ralink SoC.
> 
> Signed-off-by: John Crispin <blogic@openwrt.org>
> ---
>  arch/mips/ralink/Makefile |    2 +-
>  arch/mips/ralink/timer.c  |  193 +++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 194 insertions(+), 1 deletion(-)
>  create mode 100644 arch/mips/ralink/timer.c
> 
> diff --git a/arch/mips/ralink/Makefile b/arch/mips/ralink/Makefile
> index 38cf1a8..e37e0ec 100644
> --- a/arch/mips/ralink/Makefile
> +++ b/arch/mips/ralink/Makefile
> @@ -6,7 +6,7 @@
>  # Copyright (C) 2009-2011 Gabor Juhos <juhosg@openwrt.org>
>  # Copyright (C) 2013 John Crispin <blogic@openwrt.org>
>  
> -obj-y := prom.o of.o reset.o clk.o irq.o
> +obj-y := prom.o of.o reset.o clk.o irq.o timer.o
>  
>  obj-$(CONFIG_SOC_RT288X) += rt288x.o
>  obj-$(CONFIG_SOC_RT305X) += rt305x.o
> diff --git a/arch/mips/ralink/timer.c b/arch/mips/ralink/timer.c

<...>

> +static void rt_timer_disable(struct rt_timer *rt)
> +{
> +	u32 t;
> +
> +	t = rt_timer_r32(rt, TIMER_REG_TMR0CTL);
> +	t &= ~TMR0CTL_ENABLE;
> +	rt_timer_w32(rt, TIMER_REG_TMR0CTL, t);
> +}
> +
> +static int rt_timer_probe(struct platform_device *pdev)
> +{
> +	struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	struct rt_timer *rt;
> +	struct clk *clk;
> +
> +	if (!res) {
> +		dev_err(&pdev->dev, "no memory resource found\n");
> +		return -EINVAL;
> +	}
> +
> +	rt = devm_kzalloc(&pdev->dev, sizeof(*rt), GFP_KERNEL);
> +	if (!rt) {
> +		dev_err(&pdev->dev, "failed to allocate memory\n");
> +		return -ENOMEM;
> +	}
> +
> +	rt->irq = platform_get_irq(pdev, 0);
> +	if (!rt->irq) {
> +		dev_err(&pdev->dev, "failed to load irq\n");
> +		return -ENOENT;
> +	}
> +
> +	rt->membase = devm_ioremap_resource(&pdev->dev, res);
> +	if (!rt->membase) {

If devm_ioremap_resource fails, it returns with ERR_PTR thus you should use
IS_ERR(rt->membase) here ...


> +		dev_err(&pdev->dev, "failed to ioremap\n");
> +		return -ENOMEM;

... and 'return PRT_ERR(rt->membase)' here.

> +	}

Also devm_ioremap_resource() provides its own error messages so the
message can be removed.

IIRC, you have fixed this already in one of your internal trees but it seems
that you forgot to fold that fix into this patch.

-Gabor

  reply	other threads:[~2013-04-12 16:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12  7:27 [PATCH V2 01/16] MIPS: ralink: add PCI IRQ handling John Crispin
2013-04-12  7:27 ` [PATCH V2 02/16] MIPS: ralink: fix RT305x clock setup John Crispin
2013-04-12  8:22   ` Gabor Juhos
2013-04-12  8:21     ` John Crispin
2013-04-12 13:00   ` Sergei Shtylyov
2013-04-12  7:27 ` [PATCH V2 03/16] MIPS: ralink: add missing comment in irq driver John Crispin
2013-04-12  8:24   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 04/16] MIPS: ralink: add RT5350 sdram register defines John Crispin
2013-04-12  8:29   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 05/16] MIPS: ralink: add RT3352 usb " John Crispin
2013-04-12  8:47   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 06/16] MIPS: ralink: extend RT3050 dtsi file John Crispin
2013-04-12  9:22   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 07/16] MIPS: ralink: add RT5350 " John Crispin
2013-04-12  9:25   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 08/16] MIPS: ralink: make early_printk work on RT2880 John Crispin
2013-04-12  9:28   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 09/16] MIPS: ralink: adds support for RT2880 SoC family John Crispin
2013-04-12 11:12   ` Gabor Juhos
2013-04-12 11:19     ` John Crispin
2013-04-12 17:03       ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 10/16] MIPS: ralink: add rt2880 dts files John Crispin
2013-04-12  7:27 ` [PATCH V2 11/16] MIPS: ralink: adds support for RT3883 SoC family John Crispin
2013-04-12 11:13   ` Gabor Juhos
2013-04-12  7:27 ` [PATCH V2 12/16] MIPS: ralink: add rt3883 dts files John Crispin
2013-04-12  7:27 ` [PATCH V2 13/16] MIPS: ralink: adds support for MT7620 SoC family John Crispin
2013-04-12  7:27 ` [PATCH V2 14/16] MIPS: ralink: add MT7620 dts files John Crispin
2013-04-12  7:27 ` [PATCH V2 15/16] MIPS: ralink: add support for periodic timer irq John Crispin
2013-04-12 16:35   ` Gabor Juhos [this message]
2013-04-12  7:27 ` [PATCH V2 16/16] MIPS: ralink: add cpu-feature-overrides.h John Crispin
2013-04-12 17:20   ` Gabor Juhos
2013-04-12  8:21 ` [PATCH V2 01/16] MIPS: ralink: add PCI IRQ handling Gabor Juhos

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=516837E4.4060206@openwrt.org \
    --to=juhosg@openwrt.org \
    --cc=blogic@openwrt.org \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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 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.