From: Johan Hovold <johan@kernel.org>
To: Octavian Purdila <octavian.purdila@intel.com>
Cc: Johan Hovold <johan@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Wolfram Sang <wsa@the-dreams.de>,
Samuel Ortiz <sameo@linux.intel.com>,
Lee Jones <lee.jones@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
Daniel Baluta <daniel.baluta@intel.com>,
Laurentiu Palcu <laurentiu.palcu@intel.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
linux-i2c <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v8 1/4] mfd: add support for Diolan DLN-2 devices
Date: Mon, 27 Oct 2014 15:36:58 +0100 [thread overview]
Message-ID: <20141027143658.GB2006@localhost> (raw)
In-Reply-To: <CAE1zotKUk-LjLtb3X1tOdc+Xr4uiqn_Uxz8LKLpdQk59SWQ4hA@mail.gmail.com>
On Mon, Oct 27, 2014 at 03:21:10PM +0200, Octavian Purdila wrote:
> On Thu, Oct 23, 2014 at 6:16 PM, Johan Hovold <johan@kernel.org> wrote:
> > On Wed, Oct 15, 2014 at 05:48:08PM +0300, Octavian Purdila wrote:
> > > +struct dln2_event_cb_entry {
> > > + struct list_head list;
> > > + u16 id;
> > > + struct platform_device *pdev;
> > > + dln2_event_cb_t callback;
> > > +};
> > > +
> > > +int dln2_register_event_cb(struct platform_device *pdev, u16 id,
> > > + dln2_event_cb_t rx_cb)
> > > +{
> > > + struct dln2_dev *dln2 = dev_get_drvdata(pdev->dev.parent);
> > > + struct dln2_event_cb_entry *i, *new_cb;
> >
> > Can you use a name which does not have the same suffix as the actual
> > callback function (i.e. "_cb"). Just call it "entry" or something.
> >
>
> OK.
>
> > > + unsigned long flags;
> > > + int ret = 0;
> > > +
> > > + new_cb = kmalloc(sizeof(*new_cb), GFP_KERNEL);
> >
> > Use kzalloc here.
>
> Why kzalloc? All of the fields are initialized below.
It's good practise to clear any data structure at allocation. The cost
is negligible.
> > > + if (!new_cb)
> > > + return -ENOMEM;
> > > +
> > > + new_cb->id = id;
> > > + new_cb->callback = rx_cb;
> > > + new_cb->pdev = pdev;
> > > +
> > > + spin_lock_irqsave(&dln2->event_cb_lock, flags);
> > > +
> > > + list_for_each_entry(i, &dln2->event_cb_list, list) {
> > > + if (i->id == id) {
> > > + ret = -EBUSY;
> > > + break;
> > > + }
> > > + }
> > > +
> > > + if (!ret)
> > > + list_add_rcu(&new_cb->list, &dln2->event_cb_list);
> > > +
> > > + spin_unlock_irqrestore(&dln2->event_cb_lock, flags);
> > > +
> > > + if (ret)
> > > + kfree(new_cb);
> > > +
> > > + return ret;
> > > +}
> > > +EXPORT_SYMBOL(dln2_register_event_cb);
> > > + ret = mfd_add_hotplug_devices(dev, dln2_devs, ARRAY_SIZE(dln2_devs));
> >
> > So this now depends on 15bb4d6e8534 ("mfd: core: Add helper function to
> > register hotplug devices") in the MFD tree.
> >
> > Please mention what tree the patch is against in your cover letter (I
> > noticed you had rebased when it no longer applied to 3.17).
> >
> > You should drop the gpiolib patch now that v3.18-rc1 is out as well.
>
> This series is based against the Lee's for-mfd-next-v3.19 tree that
> does not yet contain the gpiolib patch.
Ok, but make sure to include that information in the cover letter.
Johan
next prev parent reply other threads:[~2014-10-27 14:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-15 14:48 [PATCH v8 0/4] mfd: add support for Diolan DLN-2 Octavian Purdila
2014-10-15 14:48 ` [PATCH v8 1/4] mfd: add support for Diolan DLN-2 devices Octavian Purdila
2014-10-23 15:16 ` Johan Hovold
2014-10-27 13:21 ` Octavian Purdila
2014-10-27 13:21 ` Octavian Purdila
2014-10-27 14:36 ` Johan Hovold [this message]
2014-10-15 14:48 ` [PATCH v8 2/4] i2c: add support for Diolan DLN-2 USB-I2C adapter Octavian Purdila
[not found] ` <1413384491-23703-3-git-send-email-octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-10-16 6:58 ` Wolfram Sang
2014-10-16 6:58 ` Wolfram Sang
2014-10-23 15:19 ` Johan Hovold
2014-10-23 15:19 ` Johan Hovold
2014-10-27 12:42 ` Octavian Purdila
2014-10-15 14:48 ` [PATCH v8 3/4] gpiolib: add irq_not_threaded flag to gpio_chip Octavian Purdila
2014-10-20 5:08 ` Alexandre Courbot
[not found] ` <CAAVeFuJ4B37YgvTBctXqmtWJtg3b19PDt1EEZF5Rc6KVXZzUtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-20 10:19 ` Octavian Purdila
2014-10-20 10:19 ` Octavian Purdila
[not found] ` <CAE1zot+FL54r3a6-qJwDti3D2dGCSwN=a0g0ki28cy1ToXgSfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-23 5:10 ` Alexandre Courbot
2014-10-23 5:10 ` Alexandre Courbot
2014-10-15 14:48 ` [PATCH v8 4/4] gpio: add support for the Diolan DLN-2 USB GPIO driver Octavian Purdila
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=20141027143658.GB2006@localhost \
--to=johan@kernel.org \
--cc=arnd@arndb.de \
--cc=daniel.baluta@intel.com \
--cc=gnurou@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=laurentiu.palcu@intel.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=octavian.purdila@intel.com \
--cc=sameo@linux.intel.com \
--cc=wsa@the-dreams.de \
/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.