linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Kaehlcke <matthias.list@kaehlcke.net>
To: "Patil, Rachna" <rachna@ti.com>
Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	linux-iio@vger.kernel.org,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Dmitry Torokhov <dtor@mail.ru>,
	Jonathan Cameron <jic23@cam.ac.uk>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: Re: [PATCH 2/5] MFD: ti_tscadc: Add support for TI's TSC/ADC MFDevice
Date: Thu, 23 Aug 2012 20:48:31 +0200	[thread overview]
Message-ID: <20120823184830.GE27787@darwin> (raw)
In-Reply-To: <1345718997-18304-1-git-send-email-rachna@ti.com>

Hi,

El Thu, Aug 23, 2012 at 04:19:57PM +0530 Patil, Rachna ha dit:

> Add the mfd core driver which supports touchscreen
> and ADC.
> With this patch we are only adding infrastructure to
> support the MFD clients.
> 
> Signed-off-by: Patil, Rachna <rachna@ti.com>
> ---
> diff --git a/drivers/mfd/ti_tscadc.c b/drivers/mfd/ti_tscadc.c
> ...
> +static	int __devinit ti_tscadc_probe(struct platform_device *pdev)
> +{
> +	struct ti_tscadc_dev		*tscadc;
> +	int				err, ctrl;
> +	int				clk_value, clock_rate;
> +	struct resource			*res;
> +	struct clk			*clk;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res) {
> +		dev_err(&pdev->dev, "no memory resource defined.\n");
> +		return -EINVAL;
> +	}
> +
> +	/* Allocate memory for device */
> +	tscadc = kzalloc(sizeof(struct ti_tscadc_dev), GFP_KERNEL);
> +	if (!tscadc) {
> +		dev_err(&pdev->dev, "failed to allocate memory.\n");
> +		return -ENOMEM;
> +	}
> +
> +	res = request_mem_region(res->start, resource_size(res), pdev->name);
> +	if (!res) {
> +		dev_err(&pdev->dev, "failed to reserve registers.\n");
> +		err = -EBUSY;
> +		goto err_free_mem;
> +	}
> +
> +	tscadc->tscadc_base = ioremap(res->start, resource_size(res));
> +	if (!tscadc->tscadc_base) {
> +		dev_err(&pdev->dev, "failed to map registers.\n");
> +		err = -ENOMEM;
> +		goto err_release_mem;
> +	}
> +
> +	tscadc->irq = platform_get_irq(pdev, 0);
> +	if (tscadc->irq < 0) {
> +		dev_err(&pdev->dev, "no irq ID is specified.\n");
> +		return -ENODEV;

goto err_iounmap_mem;

> ...
> +err_fail:
> +	pm_runtime_put_sync(&pdev->dev);
> +	pm_runtime_disable(&pdev->dev);
> +	iounmap(tscadc->tscadc_base);
> +err_release_mem:
> +	release_mem_region(res->start, resource_size(res));
> +	mfd_remove_devices(tscadc->dev);
> +err_free_mem:
> +	platform_set_drvdata(pdev, NULL);

shouldn't be necessary as the platform device doesn't exist any longer

> ...
> +static int __devexit ti_tscadc_remove(struct platform_device *pdev)
> +{
> +	struct ti_tscadc_dev	*tscadc = platform_get_drvdata(pdev);
> +	struct resource		*res;
> +
> +	tscadc_writel(tscadc, REG_SE, 0x00);
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	iounmap(tscadc->tscadc_base);
> +	release_mem_region(res->start, resource_size(res));
> +
> +	pm_runtime_put_sync(&pdev->dev);
> +	pm_runtime_disable(&pdev->dev);
> +
> +	mfd_remove_devices(tscadc->dev);
> +	kfree(tscadc);
> +
> +	platform_set_drvdata(pdev, NULL);

same as above

best regards

-- 
Matthias Kaehlcke
Embedded Linux Developer
Amsterdam

         The only way to do great work is to love what you do
                            (Steve Jobs)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

  reply	other threads:[~2012-08-23 18:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 10:49 [PATCH 2/5] MFD: ti_tscadc: Add support for TI's TSC/ADC MFDevice Patil, Rachna
2012-08-23 18:48 ` Matthias Kaehlcke [this message]
2012-08-28 10:25   ` Patil, Rachna
     [not found] ` <1345718997-18304-1-git-send-email-rachna-l0cyMroinI0@public.gmane.org>
2012-09-19 15:30   ` Samuel Ortiz

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=20120823184830.GE27787@darwin \
    --to=matthias.list@kaehlcke.net \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dtor@mail.ru \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rachna@ti.com \
    --cc=sameo@linux.intel.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 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).