linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ajay Singh <ajay.kathat@microchip.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: <linux-wireless@vger.kernel.org>, <devel@driverdev.osuosl.org>,
	<venkateswara.kaja@microchip.com>, <ganesh.krishna@microchip.com>,
	<adham.abozaeid@Microchip.com>, <aditya.shankar@microchip.com>
Subject: Re: [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE
Date: Thu, 26 Apr 2018 13:24:36 +0530	[thread overview]
Message-ID: <20180426132436.6317618e@ajaysk-VirtualBox> (raw)
In-Reply-To: <20180426074020.GA18831@kroah.com>

Hi Greg,

On Thu, 26 Apr 2018 09:40:20 +0200
Greg KH <gregkh@linuxfoundation.org> wrote:

> On Wed, Apr 25, 2018 at 10:48:06PM +0530, Ajay Singh wrote:
> > Replace the function call for crc7_byte() with macro CRC7_BYTE.
> > crc7_byte() was called in close while(), so replaced it with
> > macro to avoid extra functional call depth.
> > 
> > Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
> > ---
> >  drivers/staging/wilc1000/wilc_spi.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/wilc1000/wilc_spi.c
> > b/drivers/staging/wilc1000/wilc_spi.c index 2cb9f4e..3bb8fec
> > 100644 --- a/drivers/staging/wilc1000/wilc_spi.c
> > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > @@ -75,15 +75,12 @@ static const u8 crc7_syndrome_table[256] = {
> >  	0x46, 0x4f, 0x54, 0x5d, 0x62, 0x6b, 0x70, 0x79
> >  };
> >  
> > -static u8 crc7_byte(u8 crc, u8 data)
> > -{
> > -	return crc7_syndrome_table[(crc << 1) ^ data];
> > -}
> > +#define CRC7_BYTE(crc, data) crc7_syndrome_table[(crc << 1) ^
> > data]  
> 
> Ick, no.  That's not needed at all, a function is always much
> better.
> 
> And a good compiler will just inline this, are you _sure_ you are
> actually changing anything here?

As you mentioned, we can leave as it is for good compiler to
handle.

> 
> But most importantly, why not just use the build-in crc7
> functionality that the kernel already provides?  Don't have a
> duplicate version here.
> 
> That would be a much better cleanup, right?
> 

Thank you for your suggestion.

Yes, I agree its better to use the existing crc7 functionality.

It seems the same crc7() functions was available in kernel version
before v3.16-rc1 (in /lib/crc7.c) but later it got changed to
crc7_be() with a different crc lookup table. So i think it can not be
changed directly now.

I will check more on this and see how can we can make use of
modified version of crc7, by also considering the receiver end
changes.

> thanks,
> 
> greg k-h



Regards,
Ajay

  reply	other threads:[~2018-04-26  8:56 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 17:18 [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh
2018-04-25 17:18 ` [PATCH v2 01/21] staging: wilc1000: replace crc7_byte() with inline macro CRC7_BYTE Ajay Singh
2018-04-26  7:40   ` Greg KH
2018-04-26  7:54     ` Ajay Singh [this message]
2018-04-25 17:18 ` [PATCH v2 02/21] staging: wilc1000: align the #define in wilc_spi file Ajay Singh
2018-04-25 17:18 ` [PATCH v2 03/21] staging: wilc1000: remove unnecessary assingment from 'if' conditions Ajay Singh
2018-04-25 17:18 ` [PATCH v2 04/21] staging: wilc1000: remove 'cmd' variable in wilc_spi functions Ajay Singh
2018-04-25 17:18 ` [PATCH v2 05/21] staging: wicl1000: removed the unsed variables in wilc_parse_network_info() Ajay Singh
2018-04-25 17:18 ` [PATCH v2 06/21] staging: wilc1000: remove inner {} " Ajay Singh
2018-04-25 17:18 ` [PATCH v2 07/21] staging: wilc1000: simplified if conditions in spi_data_write() Ajay Singh
2018-04-25 17:18 ` [PATCH v2 08/21] staging: wilc1000: remove unused variable scan_while_connected Ajay Singh
2018-04-25 17:18 ` [PATCH v2 09/21] staging: wilc1000: remove unsed typedef wilc_debug_func Ajay Singh
2018-04-25 17:18 ` [PATCH v2 10/21] staging: wilc1000: remove used #define HIF_SDIO_GPIO_IRQ Ajay Singh
2018-04-25 17:18 ` [PATCH v2 11/21] staging: wilc1000: remove unused #define related to MAC status Ajay Singh
2018-04-25 17:18 ` [PATCH v2 12/21] staging: wilc1000: rename mac status macros and moved related #define together Ajay Singh
2018-04-25 17:18 ` [PATCH v2 13/21] staging: wilc1000: rename WILC_WFI_stats to avoid uppercase Ajay Singh
2018-04-25 17:18 ` [PATCH v2 14/21] staging: wilc1000: rename num_reg_frame macro to have uppercase in macro name Ajay Singh
2018-04-25 17:18 ` [PATCH v2 15/21] staging: wilc1000: rename wlan init and deinit function prefixed with wil1000 Ajay Singh
2018-04-25 17:18 ` [PATCH v2 16/21] staging: wilc1000: remove unused elements in 'wilc_priv' struct Ajay Singh
2018-04-25 17:18 ` [PATCH v2 17/21] staging: wilc1000: remove unused enum 'stats_flags' Ajay Singh
2018-04-25 17:18 ` [PATCH v2 18/21] staging: wilc1000: rename P2P_LISTEN_STATE variable to use lowercase Ajay Singh
2018-04-25 17:18 ` [PATCH v2 19/21] staging: wilc1000: remove inner block '{}' in handle_remain_on_chan() Ajay Singh
2018-04-25 17:18 ` [PATCH v2 20/21] staging: wilc1000: change function to static in linux_wlan Ajay Singh
2018-04-25 17:18 ` [PATCH v2 21/21] staging: wilc1000: reorder functions to avoid forward declaration " Ajay Singh
2018-04-26  6:16 ` [PATCH v2 00/21] staging: wilc1000: remove unused code and reorder functions Ajay Singh

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=20180426132436.6317618e@ajaysk-VirtualBox \
    --to=ajay.kathat@microchip.com \
    --cc=adham.abozaeid@Microchip.com \
    --cc=aditya.shankar@microchip.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=ganesh.krishna@microchip.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=venkateswara.kaja@microchip.com \
    /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).