All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: Viresh Kumar <viresh.kumar@st.com>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree-discuss@ozlabs.org" <devicetree-discuss@ozlabs.org>,
	"spear-devel" <spear-devel@list.st.com>,
	Jonathan Cameron <jic23@cam.ac.uk>
Subject: Re: [PATCH] staging:iio:adc: Add SPEAr ADC driver
Date: Thu, 12 Apr 2012 09:03:48 +0200	[thread overview]
Message-ID: <201204120903.48747.sr@denx.de> (raw)
In-Reply-To: <4F867232.3070509@st.com>

On Thursday 12 April 2012 08:12:02 Viresh Kumar wrote:
> On 4/11/2012 6:49 PM, Stefan Roese wrote:
> > +static int __devinit spear_adc_probe(struct platform_device *pdev)
> > +{
> > +       struct device_node *np = pdev->dev.of_node;
> > +       struct spear_adc_info *info;
> > +       struct resource *res;
> > +       int retval = -ENODEV;
> > +       struct iio_dev *iodev = NULL;
> > +       int irq;
> > +
> > +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +       if (!res) {
> > +               dev_err(&pdev->dev, "failed to get platform I/O
> > memory\n"); +               retval = -EBUSY;
> > +               goto errout1;
> > +       }
> > +
> > +       iodev = iio_allocate_device(sizeof(struct spear_adc_info));
> > +       if (!iodev) {
> > +               dev_err(&pdev->dev, "failed allocating iio device\n");
> > +               retval = -ENOMEM;
> > +               goto errout1;
> > +       }
> > +
> > +       info = iio_priv(iodev);
> > +       info->np = np;
> > +
> > +       /*
> > +        * SPEAr600 has a different register layout than other SPEAr
> > SoC's +        * (e.g. SPEAr3xx). Let's provide two register base
> > addresses +        * to support multi-arch kernels.
> > +        */
> > +       info->adc_base_spear6xx = ioremap(res->start,
> > resource_size(res)); +       if (!info->adc_base_spear6xx) {
> > +               dev_err(&pdev->dev, "failed mapping memory\n");
> > +               retval = -EBUSY;
> > +               goto errout2;
> > +       }
> 
> This must be a DT only driver and so you can use of_iomap() instead of
> ioremap() and platform_get_resource()

Yes, thanks for spotting.
 
> > +       info->adc_base_spear3xx =
> > +               (struct adc_regs_spear3xx *)info->adc_base_spear6xx;
> > +
> > +       info->clk = clk_get(&pdev->dev, NULL);
> > +       if (IS_ERR(info->clk)) {
> > +               dev_err(&pdev->dev, "failed getting clock\n");
> > +               goto errout3;
> > +       }
> 
> patch for devm_* variant of clk is also there.

Where is it? Is it already in "next"? Do you have a link for the patch?

> > +       clk_enable(info->clk);
> 
> clk_prepare() is required now, before enable.

Ahh, I didn't follow the clk updates lately. Will update.
 
> > +
> > +       irq = platform_get_irq(pdev, 0);
> > +       if ((irq < 0) || (irq >= NR_IRQS)) {
> > +               dev_err(&pdev->dev, "failed getting interrupt
> > resource\n"); +               retval = -EINVAL;
> > +               goto errout4;
> > +       }
> > +
> > +       retval = request_irq(irq, spear_adc_isr, 0, MOD_NAME, info);
> > +       if (retval < 0) {
> > +               dev_err(&pdev->dev, "failed requesting interrupt\n");
> > +               goto errout4;
> > +       }
> > +
> 
> can use devm_* variants wherever possible.

Okay.

Thanks,
Stefan

WARNING: multiple messages have this Message-ID (diff)
From: Stefan Roese <sr-ynQEQJNshbs@public.gmane.org>
To: Viresh Kumar <viresh.kumar-qxv4g6HH51o@public.gmane.org>
Cc: "linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org"
	<devicetree-discuss-mnsaURCQ41sdnm+yROfE0A@public.gmane.org>,
	spear-devel <spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org>,
	Jonathan Cameron <jic23-KWPb1pKIrIJaa/9Udqfwiw@public.gmane.org>
Subject: Re: [PATCH] staging:iio:adc: Add SPEAr ADC driver
Date: Thu, 12 Apr 2012 09:03:48 +0200	[thread overview]
Message-ID: <201204120903.48747.sr@denx.de> (raw)
In-Reply-To: <4F867232.3070509-qxv4g6HH51o@public.gmane.org>

On Thursday 12 April 2012 08:12:02 Viresh Kumar wrote:
> On 4/11/2012 6:49 PM, Stefan Roese wrote:
> > +static int __devinit spear_adc_probe(struct platform_device *pdev)
> > +{
> > +       struct device_node *np = pdev->dev.of_node;
> > +       struct spear_adc_info *info;
> > +       struct resource *res;
> > +       int retval = -ENODEV;
> > +       struct iio_dev *iodev = NULL;
> > +       int irq;
> > +
> > +       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> > +       if (!res) {
> > +               dev_err(&pdev->dev, "failed to get platform I/O
> > memory\n"); +               retval = -EBUSY;
> > +               goto errout1;
> > +       }
> > +
> > +       iodev = iio_allocate_device(sizeof(struct spear_adc_info));
> > +       if (!iodev) {
> > +               dev_err(&pdev->dev, "failed allocating iio device\n");
> > +               retval = -ENOMEM;
> > +               goto errout1;
> > +       }
> > +
> > +       info = iio_priv(iodev);
> > +       info->np = np;
> > +
> > +       /*
> > +        * SPEAr600 has a different register layout than other SPEAr
> > SoC's +        * (e.g. SPEAr3xx). Let's provide two register base
> > addresses +        * to support multi-arch kernels.
> > +        */
> > +       info->adc_base_spear6xx = ioremap(res->start,
> > resource_size(res)); +       if (!info->adc_base_spear6xx) {
> > +               dev_err(&pdev->dev, "failed mapping memory\n");
> > +               retval = -EBUSY;
> > +               goto errout2;
> > +       }
> 
> This must be a DT only driver and so you can use of_iomap() instead of
> ioremap() and platform_get_resource()

Yes, thanks for spotting.
 
> > +       info->adc_base_spear3xx =
> > +               (struct adc_regs_spear3xx *)info->adc_base_spear6xx;
> > +
> > +       info->clk = clk_get(&pdev->dev, NULL);
> > +       if (IS_ERR(info->clk)) {
> > +               dev_err(&pdev->dev, "failed getting clock\n");
> > +               goto errout3;
> > +       }
> 
> patch for devm_* variant of clk is also there.

Where is it? Is it already in "next"? Do you have a link for the patch?

> > +       clk_enable(info->clk);
> 
> clk_prepare() is required now, before enable.

Ahh, I didn't follow the clk updates lately. Will update.
 
> > +
> > +       irq = platform_get_irq(pdev, 0);
> > +       if ((irq < 0) || (irq >= NR_IRQS)) {
> > +               dev_err(&pdev->dev, "failed getting interrupt
> > resource\n"); +               retval = -EINVAL;
> > +               goto errout4;
> > +       }
> > +
> > +       retval = request_irq(irq, spear_adc_isr, 0, MOD_NAME, info);
> > +       if (retval < 0) {
> > +               dev_err(&pdev->dev, "failed requesting interrupt\n");
> > +               goto errout4;
> > +       }
> > +
> 
> can use devm_* variants wherever possible.

Okay.

Thanks,
Stefan

  reply	other threads:[~2012-04-12  7:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 13:19 [PATCH] staging:iio:adc: Add SPEAr ADC driver Stefan Roese
2012-04-11 13:19 ` Stefan Roese
2012-04-11 13:40 ` Jonathan Cameron
2012-04-11 13:40   ` Jonathan Cameron
2012-04-12  6:01   ` Stefan Roese
2012-04-12  6:01     ` Stefan Roese
2012-04-12  6:12 ` Viresh Kumar
2012-04-12  6:12   ` Viresh Kumar
2012-04-12  7:03   ` Stefan Roese [this message]
2012-04-12  7:03     ` Stefan Roese
2012-04-12  7:41     ` Viresh Kumar
2012-04-12  7:41       ` Viresh Kumar
2012-04-12  8:15       ` Stefan Roese
2012-04-12  8:15         ` Stefan Roese
2012-04-12  8:21         ` Viresh Kumar
2012-04-12  8:21           ` Viresh Kumar

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=201204120903.48747.sr@denx.de \
    --to=sr@denx.de \
    --cc=devicetree-discuss@ozlabs.org \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=spear-devel@list.st.com \
    --cc=viresh.kumar@st.com \
    /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.