Re: [PATCH 3/3] Staging: rtl8192e: Add spaces around operators.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Aug 30, 2024 at 09:26:42PM +0200, Philipp Hortmann wrote:
> On 8/30/24 04:05, Tree Davies wrote:
> > Add spaces around arithmetic and bitwise operators to improve
> > readability of the code.
> > 
> > Signed-off-by: Tree Davies <tdavies@xxxxxxxxxxxxxxx>
> > ---
> >   drivers/staging/rtl8192e/rtllib.h | 62 +++++++++++++++----------------
> >   1 file changed, 31 insertions(+), 31 deletions(-)
> > 
> > diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h
> > index 76f53b797644..17a6fb565c9d 100644
> > --- a/drivers/staging/rtl8192e/rtllib.h
> > +++ b/drivers/staging/rtl8192e/rtllib.h
> > @@ -339,12 +339,12 @@ enum rt_op_mode {
> >   #define	FC_QOS_BIT					BIT(7)
> >   #define is_data_frame(pdu)	(((pdu[0] & 0x0C) == 0x08) ? true : false)
> > -#define	is_legacy_data_frame(pdu)	(is_data_frame(pdu) && (!(pdu[0]&FC_QOS_BIT)))
> > +#define	is_legacy_data_frame(pdu)	(is_data_frame(pdu) && (!(pdu[0] & FC_QOS_BIT)))
> >   #define is_qos_data_frame(pframe)			\
> > -	((*(u16 *)pframe&(IEEE80211_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA)) ==	\
> > -	(IEEE80211_STYPE_QOS_DATA|RTLLIB_FTYPE_DATA))
> > -#define frame_order(pframe)     (*(u16 *)pframe&IEEE80211_FCTL_ORDER)
> > -#define SN_LESS(a, b)		(((a-b)&0x800) != 0)
> > +	((*(u16 *)pframe & (IEEE80211_STYPE_QOS_DATA | RTLLIB_FTYPE_DATA)) ==	\
> > +	(IEEE80211_STYPE_QOS_DATA | RTLLIB_FTYPE_DATA))
> > +#define frame_order(pframe)     (*(u16 *)pframe & IEEE80211_FCTL_ORDER)
> > +#define SN_LESS(a, b)		(((a - b) & 0x800) != 0)
> >   #define SN_EQUAL(a, b)	(a == b)
> >   #define MAX_DEV_ADDR_SIZE 8
> > @@ -414,13 +414,13 @@ enum _REG_PREAMBLE_MODE {
> >   #define WLAN_GET_SEQ_FRAG(seq) ((seq) & RTLLIB_SCTL_FRAG)
> >   #define WLAN_GET_SEQ_SEQ(seq)  (((seq) & RTLLIB_SCTL_SEQ) >> 4)
> > -#define RTLLIB_STATMASK_SIGNAL (1<<0)
> > -#define RTLLIB_STATMASK_RSSI (1<<1)
> > -#define RTLLIB_STATMASK_NOISE (1<<2)
> > +#define RTLLIB_STATMASK_SIGNAL (1 << 0)
> > +#define RTLLIB_STATMASK_RSSI (1 << 1)
> > +#define RTLLIB_STATMASK_NOISE (1 << 2)
> >   #define RTLLIB_STATMASK_WEMASK 0x7
> > -#define RTLLIB_CCK_MODULATION    (1<<0)
> > -#define RTLLIB_OFDM_MODULATION   (1<<1)
> > +#define RTLLIB_CCK_MODULATION    (1 << 0)
> > +#define RTLLIB_OFDM_MODULATION   (1 << 1)
> >   #define RTLLIB_CCK_RATE_LEN		4
> >   #define RTLLIB_CCK_RATE_1MB			0x02
> > @@ -507,11 +507,11 @@ struct rtllib_frag_entry {
> >   struct rtllib_device;
> > -#define SEC_ACTIVE_KEY    (1<<4)
> > -#define SEC_AUTH_MODE     (1<<5)
> > -#define SEC_UNICAST_GROUP (1<<6)
> > -#define SEC_LEVEL	 (1<<7)
> > -#define SEC_ENABLED       (1<<8)
> > +#define SEC_ACTIVE_KEY    (1 << 4)
> > +#define SEC_AUTH_MODE     (1 << 5)
> > +#define SEC_UNICAST_GROUP (1 << 6)
> > +#define SEC_LEVEL	 (1 << 7)
> > +#define SEC_ENABLED       (1 << 8)
> >   #define SEC_LEVEL_0      0 /* None */
> >   #define SEC_LEVEL_1      1 /* WEP 40 and 104 bit */
> > @@ -696,17 +696,17 @@ union frameqos {
> >   #define MAX_WPA_IE_LEN 64
> >   #define MAX_WZC_IE_LEN 256
> > -#define NETWORK_EMPTY_ESSID (1<<0)
> > -#define NETWORK_HAS_OFDM    (1<<1)
> > -#define NETWORK_HAS_CCK     (1<<2)
> > +#define NETWORK_EMPTY_ESSID (1 << 0)
> > +#define NETWORK_HAS_OFDM    (1 << 1)
> > +#define NETWORK_HAS_CCK     (1 << 2)
> >   /* QoS structure */
> > -#define NETWORK_HAS_QOS_PARAMETERS      (1<<3)
> > -#define NETWORK_HAS_QOS_INFORMATION     (1<<4)
> > +#define NETWORK_HAS_QOS_PARAMETERS      (1 << 3)
> > +#define NETWORK_HAS_QOS_INFORMATION     (1 << 4)
> >   #define NETWORK_HAS_QOS_MASK	    (NETWORK_HAS_QOS_PARAMETERS | \
> >   					 NETWORK_HAS_QOS_INFORMATION)
> >   /* 802.11h */
> > -#define NETWORK_HAS_ERP_VALUE	   (1<<10)
> > +#define NETWORK_HAS_ERP_VALUE	   (1 << 10)
> >   #define QOS_QUEUE_NUM		   4
> >   #define QOS_OUI_LEN		     3
> > @@ -996,8 +996,8 @@ enum rtl_link_state {
> >   #define DEFAULT_MAX_SCAN_AGE (15 * HZ)
> >   #define DEFAULT_FTS 2346
> > -#define CFG_RTLLIB_RESERVE_FCS (1<<0)
> > -#define CFG_RTLLIB_COMPUTE_FCS (1<<1)
> > +#define CFG_RTLLIB_RESERVE_FCS (1 << 0)
> > +#define CFG_RTLLIB_COMPUTE_FCS (1 << 1)
> >   struct tx_pending {
> >   	int frag;
> > @@ -1288,7 +1288,7 @@ struct rtllib_device {
> >   	u16 scan_watch_dog;
> >   	/* map of allowed channels. 0 is dummy */
> > -	u8 active_channel_map[MAX_CHANNEL_NUMBER+1];
> > +	u8 active_channel_map[MAX_CHANNEL_NUMBER + 1];
> >   	int rate;       /* current rate */
> >   	int basic_rate;
> > @@ -1486,32 +1486,32 @@ struct rtllib_device {
> >   /* Uses the channel change callback directly
> >    * instead of [start/stop] scan callbacks
> >    */
> > -#define IEEE_SOFTMAC_SCAN (1<<2)
> > +#define IEEE_SOFTMAC_SCAN (1 << 2)
> >   /* Perform authentication and association handshake */
> > -#define IEEE_SOFTMAC_ASSOCIATE (1<<3)
> > +#define IEEE_SOFTMAC_ASSOCIATE (1 << 3)
> >   /* Generate probe requests */
> > -#define IEEE_SOFTMAC_PROBERQ (1<<4)
> > +#define IEEE_SOFTMAC_PROBERQ (1 << 4)
> >   /* Generate response to probe requests */
> > -#define IEEE_SOFTMAC_PROBERS (1<<5)
> > +#define IEEE_SOFTMAC_PROBERS (1 << 5)
> >   /* The ieee802.11 stack will manage the netif queue
> >    * wake/stop for the driver, taking care of 802.11
> >    * fragmentation. See softmac.c for details.
> >    */
> > -#define IEEE_SOFTMAC_TX_QUEUE (1<<7)
> > +#define IEEE_SOFTMAC_TX_QUEUE (1 << 7)
> >   /* Uses only the softmac_data_hard_start_xmit
> >    * even for TX management frames.
> >    */
> > -#define IEEE_SOFTMAC_SINGLE_QUEUE (1<<8)
> > +#define IEEE_SOFTMAC_SINGLE_QUEUE (1 << 8)
> >   /* Generate beacons.  The stack will enqueue beacons
> >    * to the card
> >    */
> > -#define IEEE_SOFTMAC_BEACONS (1<<6)
> > +#define IEEE_SOFTMAC_BEACONS (1 << 6)
> >   static inline void *rtllib_priv(struct net_device *dev)
> >   {
> 
> Hi Tree,
> 
> in many of the above cases checkpatch is asking for using the BIT macro. So
> when you add the spaces to those lines the next change requested by
> ckeckpatch is the BIT macro. I think we should switch only once.
> Find examples below:
> 
> CHECK: Prefer using the BIT macro
> #44: FILE: drivers/staging/rtl8192e/rtllib.h:417:
> +#define RTLLIB_STATMASK_SIGNAL (1 << 0)
> 
> CHECK: Prefer using the BIT macro
> #45: FILE: drivers/staging/rtl8192e/rtllib.h:418:
> +#define RTLLIB_STATMASK_RSSI (1 << 1)
> 
> CHECK: Prefer using the BIT macro
> #46: FILE: drivers/staging/rtl8192e/rtllib.h:419:
> +#define RTLLIB_STATMASK_NOISE (1 << 2)
> 
> CHECK: Prefer using the BIT macro
> #51: FILE: drivers/staging/rtl8192e/rtllib.h:422:
> +#define RTLLIB_CCK_MODULATION    (1 << 0)
> 
> CHECK: Prefer using the BIT macro
> #52: FILE: drivers/staging/rtl8192e/rtllib.h:423:
> +#define RTLLIB_OFDM_MODULATION   (1 << 1)

I'll take this now and then the BIT() conversion can happen later.

thanks,

greg k-h




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux