Skip to contentSkip to conversation

staging: rtl8712: Remove exceptional & on function name

PATCH Superseded Amitoj Kaur Chawla 2 participants 3 messages Feb 19, 2016 – Feb 20, 2016 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: rtl8712: Remove exceptional & on function name

In this file, function names are otherwise used as pointers without &.

The Coccinelle semantic patch that is used to make this change is as follows:

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

---
 drivers/staging/rtl8712/usb_intf.c |  4 ++--
 drivers/staging/rtl8712/usb_ops.c  | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/rtl8712/usb_intf.c +2 -2
index f1d3d70..bb2decd 100644
@@ -399,8 +399,8 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 	SET_NETDEV_DEV(pnetdev, &pusb_intf->dev);
 	pnetdev->dev.type = &wlan_type;
 	/* step 2. */
-	padapter->dvobj_init = &r8712_usb_dvobj_init;
-	padapter->dvobj_deinit = &r8712_usb_dvobj_deinit;
+	padapter->dvobj_init = r8712_usb_dvobj_init;
+	padapter->dvobj_deinit = r8712_usb_dvobj_deinit;
 	padapter->halpriv.hal_bus_init = &r8712_usb_hal_bus_init;
 	padapter->dvobjpriv.inirp_init = &r8712_usb_inirp_init;
 	padapter->dvobjpriv.inirp_deinit = &r8712_usb_inirp_deinit;
drivers/staging/rtl8712/usb_ops.c +10 -10
index 856f257..cf24007 100644
@@ -179,22 +179,22 @@ static void usb_intf_hdl_close(u8 *priv)
 
 void r8712_usb_set_intf_funs(struct intf_hdl *pintf_hdl)
 {
-	pintf_hdl->intf_hdl_init = &usb_intf_hdl_init;
-	pintf_hdl->intf_hdl_unload = &usb_intf_hdl_unload;
-	pintf_hdl->intf_hdl_open = &usb_intf_hdl_open;
-	pintf_hdl->intf_hdl_close = &usb_intf_hdl_close;
+	pintf_hdl->intf_hdl_init = usb_intf_hdl_init;
+	pintf_hdl->intf_hdl_unload = usb_intf_hdl_unload;
+	pintf_hdl->intf_hdl_open = usb_intf_hdl_open;
+	pintf_hdl->intf_hdl_close = usb_intf_hdl_close;
 }
 
 void r8712_usb_set_intf_ops(struct _io_ops	*pops)
 {
 	memset((u8 *)pops, 0, sizeof(struct _io_ops));
-	pops->_read8 = &usb_read8;
-	pops->_read16 = &usb_read16;
-	pops->_read32 = &usb_read32;
+	pops->_read8 = usb_read8;
+	pops->_read16 = usb_read16;
+	pops->_read32 = usb_read32;
 	pops->_read_port = &r8712_usb_read_port;
-	pops->_write8 = &usb_write8;
-	pops->_write16 = &usb_write16;
-	pops->_write32 = &usb_write32;
+	pops->_write8 = usb_write8;
+	pops->_write16 = usb_write16;
+	pops->_write32 = usb_write32;
 	pops->_write_mem = &r8712_usb_write_mem;
 	pops->_write_port = &r8712_usb_write_port;
 }
Signature · 1 line
1.9.1
#1 lore raw
Quoted 30 lines · Amitoj Kaur Chawla

In this file, function names are otherwise used as pointers without &.

The Coccinelle semantic patch that is used to make this change is as follows:

// <smpl>
@r@
identifier f;
@@

f(...) { ... }
@@
identifier r.f;
@@

- &f
+ f
// </smpl>

---
 drivers/staging/rtl8712/usb_intf.c |  4 ++--
 drivers/staging/rtl8712/usb_ops.c  | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/rtl8712/usb_intf.c +0 -0
index f1d3d70..bb2decd 100644

drivers/staging/rtl8712/usb_intf.c static int r871xu_drv_init(struct usb_interface *pusb_intf, · line 406

Quoted 10 lines
drivers/staging/rtl8712/usb_intf.c +2 -2
@@ -399,8 +399,8 @@ static int r871xu_drv_init(struct usb_interface *pusb_intf,
 	SET_NETDEV_DEV(pnetdev, &pusb_intf->dev);
 	pnetdev->dev.type = &wlan_type;
 	/* step 2. */
-	padapter->dvobj_init = &r8712_usb_dvobj_init;
-	padapter->dvobj_deinit = &r8712_usb_dvobj_deinit;
+	padapter->dvobj_init = r8712_usb_dvobj_init;
+	padapter->dvobj_deinit = r8712_usb_dvobj_deinit;
 	padapter->halpriv.hal_bus_init = &r8712_usb_hal_bus_init;
 	padapter->dvobjpriv.inirp_init = &r8712_usb_inirp_init;
 	padapter->dvobjpriv.inirp_deinit = &r8712_usb_inirp_deinit;

Aren't these functions too?

Quoted 26 lines
drivers/staging/rtl8712/usb_ops.c +6 -7
index 856f257..cf24007 100644
@@ -179,22 +179,22 @@ static void usb_intf_hdl_close(u8 *priv)
 
 void r8712_usb_set_intf_funs(struct intf_hdl *pintf_hdl)
 {
-	pintf_hdl->intf_hdl_init = &usb_intf_hdl_init;
-	pintf_hdl->intf_hdl_unload = &usb_intf_hdl_unload;
-	pintf_hdl->intf_hdl_open = &usb_intf_hdl_open;
-	pintf_hdl->intf_hdl_close = &usb_intf_hdl_close;
+	pintf_hdl->intf_hdl_init = usb_intf_hdl_init;
+	pintf_hdl->intf_hdl_unload = usb_intf_hdl_unload;
+	pintf_hdl->intf_hdl_open = usb_intf_hdl_open;
+	pintf_hdl->intf_hdl_close = usb_intf_hdl_close;
 }
 
 void r8712_usb_set_intf_ops(struct _io_ops	*pops)
 {
 	memset((u8 *)pops, 0, sizeof(struct _io_ops));
-	pops->_read8 = &usb_read8;
-	pops->_read16 = &usb_read16;
-	pops->_read32 = &usb_read32;
+	pops->_read8 = usb_read8;
+	pops->_read16 = usb_read16;

drivers/staging/rtl8712/usb_ops.c static void usb_intf_hdl_close(u8 *priv) · line 199

Quoted 10 lines
drivers/staging/rtl8712/usb_ops.c +4 -3
+	pops->_read32 = usb_read32;
 	pops->_read_port = &r8712_usb_read_port;
-	pops->_write8 = &usb_write8;
-	pops->_write16 = &usb_write16;
-	pops->_write32 = &usb_write32;
+	pops->_write8 = usb_write8;
+	pops->_write16 = usb_write16;
+	pops->_write32 = usb_write32;
 	pops->_write_mem = &r8712_usb_write_mem;
 	pops->_write_port = &r8712_usb_write_port;

Same here.

And is it really the case that there are more uses without & than with? Theer seem to be quite a lot of uses with, and at least the second file is rather small.

julia

#2 lore raw
Quoted 8 lines · Julia Lawall

Same here.

And is it really the case that there are more uses without & than with? Theer seem to be quite a lot of uses with, and at least the second file is rather small.

julia

I just checked the functions. The script seems to point to only static functions that should get the & removed.

Any reasons for that?

Amitoj