From: Greg KH <gregkh@linuxfoundation.org>
To: Marcus Wolf <linux@wolf-entwicklungen.de>
Cc: dan.carpenter@oracle.com, devel@driverdev.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: pi433: rf69.c: Replace macros READ_REG and WRITE_REG with inline functions setBit rstBit and rmwBit
Date: Sat, 2 Dec 2017 15:03:20 +0000 [thread overview]
Message-ID: <20171202150320.GE1242@kroah.com> (raw)
In-Reply-To: <1512217292-8533-1-git-send-email-linux@wolf-entwicklungen.de>
On Sat, Dec 02, 2017 at 02:21:32PM +0200, Marcus Wolf wrote:
> To increase the readability of the register accesses, the abstraction of the
> helpers was increased from simple read and write to set bit, reset bit and
> read modify write bit. In addition - according to the proposal from Walter
> Harms from 20.07.2017 - instead of marcros inline functions were used.
>
> As a bonus, with this refactoring a lot of lines were shortened a lot. So
> some of them now undershoot 80 chars, thus reducing the total number of
> complaints of checkPatch.pl in rf69.c.
> ---
> drivers/staging/pi433/rf69.c | 347 ++++++++++++++++++++++--------------------
> 1 file changed, 185 insertions(+), 162 deletions(-)
No signed-off-by line. Always use scripts/checkpatch.pl so you don't
get grumpy emails from maintainers telling you to use
scripts/checkpatch.pl.
>
> diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
> index 0df084e..f6d0b82 100644
> --- a/drivers/staging/pi433/rf69.c
> +++ b/drivers/staging/pi433/rf69.c
> @@ -30,13 +30,37 @@
> #include "rf69.h"
> #include "rf69_registers.h"
>
> #define F_OSC 32000000 /* in Hz */
> #define FIFO_SIZE 66 /* in byte */
>
> /*-------------------------------------------------------------------------*/
>
> -#define READ_REG(x) rf69_read_reg (spi, x)
> -#define WRITE_REG(x, y) rf69_write_reg(spi, x, y)
> +inline static int setBit(struct spi_device *spi, u8 reg, u8 mask)
We have setbit functions, perhaps name this a bit differently as it is
doing something else? And no interCaps please.
> +{
What kind of crazy git options do you have that it creates so much
context for the diff?
> + u8 tmpVal;
> +
> + tmpVal = rf69_read_reg (spi, reg);
> + tmpVal = tmpVal | mask;
> + return rf69_write_reg(spi, reg, tmpVal);
> +}
> +
> +inline static int rstBit(struct spi_device *spi, u8 reg, u8 mask)
rstBit()? What does that mean?
> +{
> + u8 tmpVal;
> +
> + tmpVal = rf69_read_reg (spi, reg);
> + tmpVal = tmpVal & ~mask;
> + return rf69_write_reg(spi, reg, tmpVal);
> +}
> +
> +inline static int rmw(struct spi_device *spi, u8 reg, u8 mask, u8 value)
what does rmw() mean? Spell it out so no one has to try to guess :)
thanks,
greg k-h
prev parent reply other threads:[~2017-12-02 15:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-02 12:21 [PATCH] staging: pi433: rf69.c: Replace macros READ_REG and WRITE_REG with inline functions setBit rstBit and rmwBit Marcus Wolf
2017-12-02 15:03 ` Greg KH [this message]
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=20171202150320.GE1242@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@wolf-entwicklungen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox