All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gregory Bean <gbean@codeaurora.org>
To: Ben Dooks <ben-linux@fluff.org>
Cc: akpm@linux-foundation.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Joe Perches <joe@perches.com>,
	"David S. Miller" <davem@davemloft.net>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Randy Dunlap <randy.dunlap@oracle.com>,
	Michael Hennerich <michael.hennerich@analog.com>,
	Mike Frysinger <vapier@gentoo.org>,
	David Brown <davidb@codeaurora.org>,
	Daniel Walker <dwalker@codeaurora.org>,
	Bryan Huntsman <bryanh@codeaurora.org>
Subject: Re: [PATCH 1/2] gpio: msm7200a: Add gpiolib support for MSM chips.
Date: Fri, 11 Jun 2010 22:37:18 -0700	[thread overview]
Message-ID: <4C131D0E.60109@codeaurora.org> (raw)
In-Reply-To: <20100612021252.GB31045@fluff.org.uk>

> Why not put this under arch/arm?

Is there an appropriate place for loadable device drivers under 
arch/arm?  I don't know of one.

>> +static inline void set_gpio_bit(unsigned n, void __iomem *reg)
>> +{
>> +	writel(readl(reg) | bit(n), reg);
>> +}
>> +
>> +/*
>> + * This function assumes that msm_gpio_dev::lock is held.
>> + */
>> +static inline void clr_gpio_bit(unsigned n, void __iomem *reg)
>> +{
>> +	writel(readl(reg)&  ~bit(n), reg);
>> +}
>> +
>> +/*
>> + * This function assumes that msm_gpio_dev::lock is held.
>> + */
>> +static inline void
>> +msm_gpio_write(struct msm_gpio_dev *dev, unsigned n, unsigned on)
>> +{
>> +	if (on)
>> +		set_gpio_bit(n, dev->regs.out);
>> +	else
>> +		clr_gpio_bit(n, dev->regs.out);
>> +}
>
> wouldn't it be easier to inline a set_to function and just role the
> set and clr bit functions into it, since they pretty much do the
> same thing. even better, on arm the code won't require a branch.

I'm not sure I understand you.  Can you clarify?  set_ and clr_gpio_bit 
are used in more places than just here, so they can't just be rolled 
into msm_gpio_write and disappear.

>> +static int msm_gpio_remove(struct platform_device *dev)
>> +{
>> +	struct msm_gpio_dev *msm_gpio = platform_get_drvdata(dev);
>> +	int ret = gpiochip_remove(&msm_gpio->gpio_chip);
>> +
>> +	if (ret == 0)
>> +		kfree(msm_gpio);
>
> hmm, not sure if you really need to check the result here before
> kfrree() the memory.

I feel that this is important.  If any clients are still holding gpio 
lines, gpiochip_remove will fail.  In those circumstances, is it not 
important that the device not be freed (which would leave clients with 
stale references) and that the remove call return a proper failure code?
--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  parent reply	other threads:[~2010-06-12  5:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-11 19:58 [PATCH 0/2] Add gpiolib support for MSM chips Gregory Bean
2010-06-11 19:58 ` [PATCH 1/2] gpio: msm7200a: " Gregory Bean
2010-06-12  2:12   ` Ben Dooks
2010-06-12  2:34     ` Bryan Huntsman
2010-06-12  5:37     ` Gregory Bean [this message]
2010-06-13  5:30       ` Ben Dooks
2010-06-11 19:58 ` [PATCH 2/2] gpio: msm7200a: Add irq support to msm-gpiolib Gregory Bean
2010-06-11 23:12   ` Daniel Walker
2010-06-11 23:23     ` Greg Bean
2010-06-12  2:24   ` Ben Dooks

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=4C131D0E.60109@codeaurora.org \
    --to=gbean@codeaurora.org \
    --cc=akpm@linux-foundation.org \
    --cc=ben-linux@fluff.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=bryanh@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=davidb@codeaurora.org \
    --cc=dwalker@codeaurora.org \
    --cc=joe@perches.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    --cc=randy.dunlap@oracle.com \
    --cc=sameo@linux.intel.com \
    --cc=vapier@gentoo.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.