From: Liu Ying <Ying.Liu@freescale.com>
To: <gregkh@linuxfoundation.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH] drvres: Improve grp->id setting logics in devres_open_group()
Date: Wed, 29 Oct 2014 17:59:47 +0800 [thread overview]
Message-ID: <1414576787-2074-1-git-send-email-Ying.Liu@freescale.com> (raw)
Instead of setting grp->id directly with a temporary value and
then changing it if a certain condition meets, we may check
the condition first and then decide which value should be set
to grp->id. This may save two lines of code and potentially
reduces a writing operation.
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
---
drivers/base/devres.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index c8a53d1..39e1856 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -544,9 +544,7 @@ void * devres_open_group(struct device *dev, void *id, gfp_t gfp)
INIT_LIST_HEAD(&grp->node[1].entry);
set_node_dbginfo(&grp->node[0], "grp<", 0);
set_node_dbginfo(&grp->node[1], "grp>", 0);
- grp->id = grp;
- if (id)
- grp->id = id;
+ grp->id = id ? id : grp;
spin_lock_irqsave(&dev->devres_lock, flags);
add_dr(dev, &grp->node[0]);
--
2.1.0
next reply other threads:[~2014-10-29 10:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 9:59 Liu Ying [this message]
2014-11-07 19:02 ` Greg KH
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=1414576787-2074-1-git-send-email-Ying.Liu@freescale.com \
--to=ying.liu@freescale.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®