driverdev-devel.linuxdriverproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: rtl8712: Minor cleanups
@ 2020-07-01 21:44 Mauro Dreissig
  2020-07-01 21:44 ` [PATCH 1/2] staging: rtl8712: Replace FIELD_OFFSET() with offsetof() Mauro Dreissig
  2020-07-01 21:44 ` [PATCH 2/2] staging: rtl8712: base_types: Remove unused macros Mauro Dreissig
  0 siblings, 2 replies; 3+ messages in thread
From: Mauro Dreissig @ 2020-07-01 21:44 UTC (permalink / raw)
  To: gregkh, Larry.Finger, florian.c.schilhabel, driverdev-devel
  Cc: Mauro Dreissig

This series applies minor cleanups for rtl8712 staging driver.

Mauro Dreissig (2):
  staging: rtl8712: Replace FIELD_OFFSET() with offsetof()
  staging: rtl8712: base_types: Remove unused macros

 drivers/staging/rtl8712/basic_types.h         | 8 --------
 drivers/staging/rtl8712/hal_init.c            | 4 ++--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
 3 files changed, 4 insertions(+), 12 deletions(-)

-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] staging: rtl8712: Replace FIELD_OFFSET() with offsetof()
  2020-07-01 21:44 [PATCH 0/2] staging: rtl8712: Minor cleanups Mauro Dreissig
@ 2020-07-01 21:44 ` Mauro Dreissig
  2020-07-01 21:44 ` [PATCH 2/2] staging: rtl8712: base_types: Remove unused macros Mauro Dreissig
  1 sibling, 0 replies; 3+ messages in thread
From: Mauro Dreissig @ 2020-07-01 21:44 UTC (permalink / raw)
  To: gregkh, Larry.Finger, florian.c.schilhabel, driverdev-devel
  Cc: Mauro Dreissig

Use the existing offsetof() macro instead of duplicating code.

Signed-off-by: Mauro Dreissig <mukadr@gmail.com>
---
 drivers/staging/rtl8712/basic_types.h         | 1 -
 drivers/staging/rtl8712/hal_init.c            | 4 ++--
 drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8712/basic_types.h b/drivers/staging/rtl8712/basic_types.h
index 4ad7f35b1644..b8ecd92ca9d4 100644
--- a/drivers/staging/rtl8712/basic_types.h
+++ b/drivers/staging/rtl8712/basic_types.h
@@ -21,7 +21,6 @@
 
 #define SIZE_T __kernel_size_t
 #define sint signed int
-#define FIELD_OFFSET(s, field)	((addr_t)&((s *)(0))->field)
 
 /* Should we extend this to be host_addr_t and target_addr_t for case:
  *	host : x86_64
diff --git a/drivers/staging/rtl8712/hal_init.c b/drivers/staging/rtl8712/hal_init.c
index 40145c0338e4..7293cdc3a43b 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -133,7 +133,7 @@ static u8 chk_fwhdr(struct fw_hdr *pfwhdr, u32 ulfilelength)
 	if (pfwhdr->fw_priv_sz != sizeof(struct fw_priv))
 		return _FAIL;
 	/* check fw_sz & image_fw_sz */
-	fwhdrsz = FIELD_OFFSET(struct fw_hdr, fwpriv) + pfwhdr->fw_priv_sz;
+	fwhdrsz = offsetof(struct fw_hdr, fwpriv) + pfwhdr->fw_priv_sz;
 	fw_sz =  fwhdrsz + pfwhdr->img_IMEM_size + pfwhdr->img_SRAM_size +
 		 pfwhdr->dmem_size;
 	if (fw_sz != ulfilelength)
@@ -173,7 +173,7 @@ static u8 rtl8712_dl_fw(struct _adapter *adapter)
 		txdesc = (struct tx_desc *)(tmpchar + FWBUFF_ALIGN_SZ -
 			    ((addr_t)(tmpchar) & (FWBUFF_ALIGN_SZ - 1)));
 		payload = (u8 *)(txdesc) + txdscp_sz;
-		ptr = (u8 *)mappedfw + FIELD_OFFSET(struct fw_hdr, fwpriv) +
+		ptr = (u8 *)mappedfw + offsetof(struct fw_hdr, fwpriv) +
 		      fwhdr.fw_priv_sz;
 		/* Download FirmWare */
 		/* 1. determine IMEM code size and Load IMEM Code Section */
diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 36c89cde525d..90ffb7c9f299 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -407,7 +407,7 @@ static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param,
 			return -ENOMEM;
 		pwep->KeyLength = wep_key_len;
 		pwep->Length = wep_key_len +
-			FIELD_OFFSET(struct NDIS_802_11_WEP, KeyMaterial);
+			offsetof(struct NDIS_802_11_WEP, KeyMaterial);
 		if (wep_key_len == 13) {
 			padapter->securitypriv.PrivacyAlgrthm = _WEP104_;
 			padapter->securitypriv.XGrpPrivacy = _WEP104_;
@@ -1555,7 +1555,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
 	if (erq->length > 0) {
 		wep.KeyLength = erq->length <= 5 ? 5 : 13;
 		wep.Length = wep.KeyLength +
-			     FIELD_OFFSET(struct NDIS_802_11_WEP, KeyMaterial);
+			     offsetof(struct NDIS_802_11_WEP, KeyMaterial);
 	} else {
 		wep.KeyLength = 0;
 		if (keyindex_provided == 1) { /* set key_id only, no given
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] staging: rtl8712: base_types: Remove unused macros
  2020-07-01 21:44 [PATCH 0/2] staging: rtl8712: Minor cleanups Mauro Dreissig
  2020-07-01 21:44 ` [PATCH 1/2] staging: rtl8712: Replace FIELD_OFFSET() with offsetof() Mauro Dreissig
@ 2020-07-01 21:44 ` Mauro Dreissig
  1 sibling, 0 replies; 3+ messages in thread
From: Mauro Dreissig @ 2020-07-01 21:44 UTC (permalink / raw)
  To: gregkh, Larry.Finger, florian.c.schilhabel, driverdev-devel
  Cc: Mauro Dreissig

Those #define's are not used anywhere, get rid of them.

Signed-off-by: Mauro Dreissig <mukadr@gmail.com>
---
 drivers/staging/rtl8712/basic_types.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/rtl8712/basic_types.h b/drivers/staging/rtl8712/basic_types.h
index b8ecd92ca9d4..aecded87dd4c 100644
--- a/drivers/staging/rtl8712/basic_types.h
+++ b/drivers/staging/rtl8712/basic_types.h
@@ -14,12 +14,8 @@
 #ifndef __BASIC_TYPES_H__
 #define __BASIC_TYPES_H__
 
-#define SUCCESS	0
-#define FAIL	(-1)
-
 #include <linux/types.h>
 
-#define SIZE_T __kernel_size_t
 #define sint signed int
 
 /* Should we extend this to be host_addr_t and target_addr_t for case:
@@ -28,8 +24,5 @@
  */
 #define addr_t unsigned long
 
-#define MEM_ALIGNMENT_OFFSET	(sizeof(SIZE_T))
-#define MEM_ALIGNMENT_PADDING	(sizeof(SIZE_T) - 1)
-
 #endif /*__BASIC_TYPES_H__*/
 
-- 
2.25.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-01 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-01 21:44 [PATCH 0/2] staging: rtl8712: Minor cleanups Mauro Dreissig
2020-07-01 21:44 ` [PATCH 1/2] staging: rtl8712: Replace FIELD_OFFSET() with offsetof() Mauro Dreissig
2020-07-01 21:44 ` [PATCH 2/2] staging: rtl8712: base_types: Remove unused macros Mauro Dreissig

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).