From: broonie@opensource.wolfsonmicro.com (Mark Brown)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 2/2] Regulator: Add Anatop regulator driver
Date: Sun, 4 Mar 2012 13:29:53 +0000 [thread overview]
Message-ID: <20120304132953.GB3083@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <20120304065145.GD10743@S2101-09.ap.freescale.net>
On Sun, Mar 04, 2012 at 02:51:48PM +0800, Shawn Guo wrote:
> > + sreg = devm_kzalloc(dev, sizeof(struct anatop_regulator), GFP_KERNEL);
> > + if (!sreg)
> > + return -EINVAL;
> > + rdesc = devm_kzalloc(dev, sizeof(struct regulator_desc), GFP_KERNEL);
> > + if (!rdesc)
> > + return -EINVAL;
> Would something like the following be better?
> sreg = devm_kzalloc(dev, sizeof(*sreg) + sizeof(*rdesc), GFP_KERNEL);
> if (!sreg)
> return -ENOMEM;
> rdesc = (struct regulator_desc *)(sreg + 1);
No, that sort of pointer arithmetic would be much worse - it's harder to
read and more likely to break. However, embedding the regulator_desc in
sreg would achieve the same result without the legibility issues.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120304/81dfb3ad/attachment.sig>
next prev parent reply other threads:[~2012-03-04 13:29 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1324980994-18462-1-git-send-email-paul.liu@linaro.org>
2012-02-08 20:51 ` [PATCH v4 1/2] mfd: Add anatop mfd driver Ying-Chun Liu (PaulLiu)
2012-02-08 20:51 ` [PATCH v4 2/2] Regulator: Add Anatop regulator driver Ying-Chun Liu (PaulLiu)
2012-02-09 11:24 ` Mark Brown
2012-02-11 6:36 ` Shawn Guo
2012-02-11 13:17 ` Mark Brown
2012-02-11 6:05 ` [PATCH v4 1/2] mfd: Add anatop mfd driver Shawn Guo
2012-02-21 11:17 ` Samuel Ortiz
2012-03-01 9:19 ` Ying-Chun Liu (PaulLiu)
2012-03-01 9:10 ` [PATCH v5 " Ying-Chun Liu (PaulLiu)
2012-03-01 9:10 ` [PATCH v5 2/2] Regulator: Add Anatop regulator driver Ying-Chun Liu (PaulLiu)
2012-03-01 11:17 ` Mark Brown
2012-03-01 11:30 ` [PATCH v5 1/2] mfd: Add anatop mfd driver Mark Brown
2012-03-02 7:00 ` [PATCH v6 " Ying-Chun Liu (PaulLiu)
2012-03-02 7:00 ` [PATCH v6 2/2] Regulator: Add Anatop regulator driver Ying-Chun Liu (PaulLiu)
2012-03-04 6:51 ` Shawn Guo
2012-03-04 13:29 ` Mark Brown [this message]
2012-03-02 7:07 ` [PATCH v6 1/2] mfd: Add anatop mfd driver Venu Byravarasu
2012-03-02 7:51 ` Ying-Chun Liu (PaulLiu)
2012-03-02 8:02 ` Venu Byravarasu
2012-03-02 14:00 ` Peter Korsgaard
2012-03-03 17:39 ` [PATCH v7 " Ying-Chun Liu (PaulLiu)
2012-03-03 17:58 ` Mark Brown
2012-03-04 5:25 ` Shawn Guo
2012-03-04 5:42 ` Shawn Guo
2012-03-04 5:55 ` Shawn Guo
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=20120304132953.GB3083@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).