From: Ravi Teja Darbha <ravi2j@gmail.com>
To: Arjun Krishna Babu <arjunkrishnababu96@gmail.com>
Cc: lidza.louina@gmail.com, markh@compro.net,
devel@driverdev.osuosl.org, gregkh@linuxfoundation.org,
driverdev-devel@linuxdriverproject.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: dgnc: Replace macro with flow control statement by a function
Date: Mon, 6 Jul 2015 17:45:24 +0530 [thread overview]
Message-ID: <20150706121524.GB2226@gmail.com> (raw)
In-Reply-To: <1436120188-15368-1-git-send-email-arjunkrishnababu96@gmail.com>
What you need to do is to replace all DGNC_VERIFY_BOARD() macro calls with its definition.
Regards,
Ravi Teja
On Sun, Jul 05, 2015 at 11:46:28PM +0530, Arjun Krishna Babu wrote:
> This patch fixes the checkpatch.pl warning:
>
> WARNING: Macros with flow control statements should be avoided
>
> Replace the macro with a function doing the exact same task as the
> macro.
>
> Signed-off-by: Arjun Krishna Babu <arjunkrishnababu96@gmail.com>
> ---
> drivers/staging/dgnc/dgnc_sysfs.c | 22 ++++++++++------------
> 1 file changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/staging/dgnc/dgnc_sysfs.c b/drivers/staging/dgnc/dgnc_sysfs.c
> index 44db870..8ab0922 100644
> --- a/drivers/staging/dgnc/dgnc_sysfs.c
> +++ b/drivers/staging/dgnc/dgnc_sysfs.c
> @@ -92,19 +92,17 @@ void dgnc_remove_driver_sysfiles(struct pci_driver *dgnc_driver)
> }
>
>
> -#define DGNC_VERIFY_BOARD(p, bd) \
> - do { \
> - if (!p) \
> - return 0; \
> - \
> - bd = dev_get_drvdata(p); \
> - if (!bd || bd->magic != DGNC_BOARD_MAGIC) \
> - return 0; \
> - if (bd->state != BOARD_READY) \
> - return 0; \
> - } while (0)
> -
> +static int DGNC_VERIFY_BOARD(struct device *p, struct dgnc_board *bd)
> +{
> + if (!p)
> + return 0;
>
> + bd = dev_get_drvdata(p);
> + if (!bd || bd->magic != DGNC_BOARD_MAGIC)
> + return 0;
> + if (bd->state != BOARD_READY)
> + return 0;
> +}
>
> static ssize_t dgnc_vpd_show(struct device *p, struct device_attribute *attr,
> char *buf)
> --
> 1.9.1
>
> _______________________________________________
> devel mailing list
> devel@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
next prev parent reply other threads:[~2015-07-06 12:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-05 18:16 [PATCH] staging: dgnc: Replace macro with flow control statement by a function Arjun Krishna Babu
2015-07-06 7:32 ` Dan Carpenter
2015-07-06 12:15 ` Ravi Teja Darbha [this message]
2015-07-06 12:27 ` Sudip Mukherjee
2015-07-06 13:20 ` Ravi Teja Darbha
2015-07-06 13:28 ` Valdis.Kletnieks
2015-07-06 14:10 ` Dan Carpenter
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=20150706121524.GB2226@gmail.com \
--to=ravi2j@gmail.com \
--cc=arjunkrishnababu96@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=driverdev-devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=lidza.louina@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markh@compro.net \
/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.