From: Greg KH <gregkh@linuxfoundation.org>
To: Arun Murthy <arun.murthy@stericsson.com>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-doc@vger.kernel.org, alan@lxorguk.ukuu.org.uk
Subject: Re: [PATCHv4 1/4] modem_shm: Add Modem Access Framework
Date: Fri, 28 Sep 2012 09:00:45 -0700 [thread overview]
Message-ID: <20120928160045.GD2625@kroah.com> (raw)
In-Reply-To: <1348819504-1303-2-git-send-email-arun.murthy@stericsson.com>
On Fri, Sep 28, 2012 at 01:35:01PM +0530, Arun Murthy wrote:
> +#include <linux/module.h>
> +#include <linux/slab.h>
> +#include <linux/err.h>
> +#include <linux/printk.h>
> +#include <linux/modem_shm/modem.h>
> +
> +static struct class *modem_class;
What's wrong with a bus_type instead?
> +static int __modem_is_requested(struct device *dev, void *data)
> +{
> + struct modem_desc *mdesc = (struct modem_desc *)data;
> +
> + if (!mdesc->mclients) {
> + printk(KERN_ERR "modem_access: modem description is NULL\n");
> + return 0;
> + }
> + return atomic_read(&mdesc->mclients->cnt);
> +}
> +
> +int modem_is_requested(struct modem_desc *mdesc)
> +{
> + return class_for_each_device(modem_class, NULL, (void *)mdesc, __modem_is_requested);
> +}
Where is the documentation for your public api functions like this?
> +
> +int modem_release(struct modem_desc *mdesc)
> +{
> + if (!mdesc->release)
> + return -EFAULT;
> +
> + if (modem_is_requested(mdesc)) {
> + atomic_dec(&mdesc->mclients->cnt);
> + if (atomic_read(&mdesc->use_cnt) == 1) {
> + mdesc->release(mdesc);
> + atomic_dec(&mdesc->use_cnt);
> + }
Eeek, why aren't you using the built-in reference counting that the
struct device provided to you, and instead are rolling your own? This
happens in many places, why?
greg k-h
next prev parent reply other threads:[~2012-09-28 16:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-28 8:05 [PATCHv4 0/4] modem_shm: U8500 SHaRed Memory driver(SHRM) Arun Murthy
2012-09-28 8:05 ` [PATCHv4 1/4] modem_shm: Add Modem Access Framework Arun Murthy
2012-09-28 16:00 ` Greg KH [this message]
2012-10-01 5:30 ` Arun MURTHY
2012-10-01 6:33 ` anish singh
2012-10-01 6:57 ` Arun MURTHY
2012-10-01 8:57 ` anish singh
2012-10-01 9:12 ` Arun MURTHY
2012-10-01 15:59 ` Greg KH
2012-10-03 3:54 ` Arun MURTHY
2012-10-03 4:17 ` anish singh
2012-10-03 4:31 ` Arun MURTHY
2012-10-03 15:17 ` Greg KH
2012-10-04 4:08 ` Arun MURTHY
2012-10-09 5:37 ` Arun MURTHY
2012-10-09 13:59 ` Greg KH
2012-10-11 9:37 ` Arun MURTHY
2012-10-11 11:01 ` Greg KH
2012-09-28 8:05 ` [PATCHv4 2/4] modem_shm: Register u8500 client for MAF Arun Murthy
2012-09-28 8:05 ` [PATCHv4 3/4] modem_shm: u8500-shm: U8500 Shared Memory Driver Arun Murthy
2012-09-28 8:05 ` [PATCHv4 4/4] Doc: Add u8500_shrm document Arun Murthy
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=20120928160045.GD2625@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=arun.murthy@stericsson.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.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