* [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures
@ 2022-12-08 8:11 Vincent Mailhol
2022-12-08 8:11 ` [PATCH 1/2] can: ucan: remove unused ucan_priv::intf Vincent Mailhol
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vincent Mailhol @ 2022-12-08 8:11 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can
Cc: Martin Elshuber, Jakob Unterwurzacher, Maximilian Schneider,
Peter Fink, Jeroen Hofstee, Christoph Möhring,
John Whittington, Vasanth Sadhasivan, netdev, linux-kernel,
Vincent Mailhol
The gs_can and ucan drivers keep a pointer to struct usb_interface in
their private structure. This is not needed. For gs_can the only use
is to retrieve struct usb_device, which is already available in
gs_usb::udev. For ucan, the field is set but never used.
Remove the struct usb_interface fields and clean up.
Vincent Mailhol (2):
can: ucan: remove unused ucan_priv::intf
can: gs_usb: remove gs_can::iface
drivers/net/can/usb/gs_usb.c | 29 +++++++++--------------------
drivers/net/can/usb/ucan.c | 2 --
2 files changed, 9 insertions(+), 22 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] can: ucan: remove unused ucan_priv::intf
2022-12-08 8:11 [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Vincent Mailhol
@ 2022-12-08 8:11 ` Vincent Mailhol
2022-12-08 8:11 ` [PATCH 2/2] can: gs_usb: remove gs_can::iface Vincent Mailhol
2022-12-08 9:10 ` [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Marc Kleine-Budde
2 siblings, 0 replies; 4+ messages in thread
From: Vincent Mailhol @ 2022-12-08 8:11 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can
Cc: Martin Elshuber, Jakob Unterwurzacher, Maximilian Schneider,
Peter Fink, Jeroen Hofstee, Christoph Möhring,
John Whittington, Vasanth Sadhasivan, netdev, linux-kernel,
Vincent Mailhol
Field intf of struct ucan_priv is set but never used. Remove it.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/ucan.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/can/usb/ucan.c b/drivers/net/can/usb/ucan.c
index ffa38f533c35..dc6158026a60 100644
--- a/drivers/net/can/usb/ucan.c
+++ b/drivers/net/can/usb/ucan.c
@@ -277,7 +277,6 @@ struct ucan_priv {
/* linux USB device structures */
struct usb_device *udev;
- struct usb_interface *intf;
struct net_device *netdev;
/* lock for can->echo_skb (used around
@@ -1501,7 +1500,6 @@ static int ucan_probe(struct usb_interface *intf,
/* initialize data */
up->udev = udev;
- up->intf = intf;
up->netdev = netdev;
up->intf_index = iface_desc->desc.bInterfaceNumber;
up->in_ep_addr = in_ep_addr;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] can: gs_usb: remove gs_can::iface
2022-12-08 8:11 [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Vincent Mailhol
2022-12-08 8:11 ` [PATCH 1/2] can: ucan: remove unused ucan_priv::intf Vincent Mailhol
@ 2022-12-08 8:11 ` Vincent Mailhol
2022-12-08 9:10 ` [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Marc Kleine-Budde
2 siblings, 0 replies; 4+ messages in thread
From: Vincent Mailhol @ 2022-12-08 8:11 UTC (permalink / raw)
To: Marc Kleine-Budde, linux-can
Cc: Martin Elshuber, Jakob Unterwurzacher, Maximilian Schneider,
Peter Fink, Jeroen Hofstee, Christoph Möhring,
John Whittington, Vasanth Sadhasivan, netdev, linux-kernel,
Vincent Mailhol
The iface field of struct gs_can is only used to retrieve the
usb_device which is already available in gs_can::udev.
Replace each occurrence of interface_to_usbdev(dev->iface) with
dev->udev. This done, remove gs_can::iface.
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
---
drivers/net/can/usb/gs_usb.c | 29 +++++++++--------------------
1 file changed, 9 insertions(+), 20 deletions(-)
diff --git a/drivers/net/can/usb/gs_usb.c b/drivers/net/can/usb/gs_usb.c
index 838744d2ce34..d476c2884008 100644
--- a/drivers/net/can/usb/gs_usb.c
+++ b/drivers/net/can/usb/gs_usb.c
@@ -299,7 +299,6 @@ struct gs_can {
struct net_device *netdev;
struct usb_device *udev;
- struct usb_interface *iface;
struct can_bittiming_const bt_const, data_bt_const;
unsigned int channel; /* channel number */
@@ -383,8 +382,7 @@ static int gs_cmd_reset(struct gs_can *dev)
.mode = GS_CAN_MODE_RESET,
};
- return usb_control_msg_send(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_MODE,
+ return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dm, sizeof(dm), 1000,
GFP_KERNEL);
@@ -396,8 +394,7 @@ static inline int gs_usb_get_timestamp(const struct gs_can *dev,
__le32 timestamp;
int rc;
- rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_TIMESTAMP,
+ rc = usb_control_msg_recv(dev->udev, 0, GS_USB_BREQ_TIMESTAMP,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0,
×tamp, sizeof(timestamp),
@@ -674,8 +671,7 @@ static int gs_usb_set_bittiming(struct net_device *netdev)
};
/* request bit timings */
- return usb_control_msg_send(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_BITTIMING,
+ return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_BITTIMING,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dbt, sizeof(dbt), 1000,
GFP_KERNEL);
@@ -698,8 +694,7 @@ static int gs_usb_set_data_bittiming(struct net_device *netdev)
request = GS_USB_BREQ_QUIRK_CANTACT_PRO_DATA_BITTIMING;
/* request data bit timings */
- return usb_control_msg_send(interface_to_usbdev(dev->iface), 0,
- request,
+ return usb_control_msg_send(dev->udev, 0, request,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dbt, sizeof(dbt), 1000,
GFP_KERNEL);
@@ -941,8 +936,7 @@ static int gs_can_open(struct net_device *netdev)
/* finally start device */
dev->can.state = CAN_STATE_ERROR_ACTIVE;
dm.flags = cpu_to_le32(flags);
- rc = usb_control_msg_send(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_MODE,
+ rc = usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dm, sizeof(dm), 1000,
GFP_KERNEL);
@@ -969,8 +963,7 @@ static int gs_usb_get_state(const struct net_device *netdev,
struct gs_device_state ds;
int rc;
- rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_GET_STATE,
+ rc = usb_control_msg_recv(dev->udev, 0, GS_USB_BREQ_GET_STATE,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0,
&ds, sizeof(ds),
@@ -1064,8 +1057,7 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
else
imode.mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF);
- return usb_control_msg_send(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_IDENTIFY,
+ return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_IDENTIFY,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &imode, sizeof(imode), 100,
GFP_KERNEL);
@@ -1118,8 +1110,7 @@ static int gs_usb_get_termination(struct net_device *netdev, u16 *term)
struct gs_device_termination_state term_state;
int rc;
- rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_GET_TERMINATION,
+ rc = usb_control_msg_recv(dev->udev, 0, GS_USB_BREQ_GET_TERMINATION,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0,
&term_state, sizeof(term_state), 1000,
@@ -1145,8 +1136,7 @@ static int gs_usb_set_termination(struct net_device *netdev, u16 term)
else
term_state.state = cpu_to_le32(GS_CAN_TERMINATION_STATE_OFF);
- return usb_control_msg_send(interface_to_usbdev(dev->iface), 0,
- GS_USB_BREQ_SET_TERMINATION,
+ return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_SET_TERMINATION,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0,
&term_state, sizeof(term_state), 1000,
@@ -1210,7 +1200,6 @@ static struct gs_can *gs_make_candev(unsigned int channel,
dev->bt_const.brp_inc = le32_to_cpu(bt_const.brp_inc);
dev->udev = interface_to_usbdev(intf);
- dev->iface = intf;
dev->netdev = netdev;
dev->channel = channel;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures
2022-12-08 8:11 [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Vincent Mailhol
2022-12-08 8:11 ` [PATCH 1/2] can: ucan: remove unused ucan_priv::intf Vincent Mailhol
2022-12-08 8:11 ` [PATCH 2/2] can: gs_usb: remove gs_can::iface Vincent Mailhol
@ 2022-12-08 9:10 ` Marc Kleine-Budde
2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2022-12-08 9:10 UTC (permalink / raw)
To: Vincent Mailhol
Cc: linux-can, Martin Elshuber, Jakob Unterwurzacher,
Maximilian Schneider, Peter Fink, Jeroen Hofstee,
Christoph Möhring, John Whittington, Vasanth Sadhasivan,
netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On 08.12.2022 17:11:40, Vincent Mailhol wrote:
> The gs_can and ucan drivers keep a pointer to struct usb_interface in
> their private structure. This is not needed. For gs_can the only use
> is to retrieve struct usb_device, which is already available in
> gs_usb::udev. For ucan, the field is set but never used.
>
> Remove the struct usb_interface fields and clean up.
Applied to linux-can-next.
Thanks,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Embedded Linux | https://www.pengutronix.de |
Vertretung West/Dortmund | Phone: +49-231-2826-924 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-12-08 9:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 8:11 [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Vincent Mailhol
2022-12-08 8:11 ` [PATCH 1/2] can: ucan: remove unused ucan_priv::intf Vincent Mailhol
2022-12-08 8:11 ` [PATCH 2/2] can: gs_usb: remove gs_can::iface Vincent Mailhol
2022-12-08 9:10 ` [PATCH 0/2] can: usb: remove pointers to struct usb_interface in device's priv structures Marc Kleine-Budde
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).