Commit 56c56a30 authored by Vincent Mailhol's avatar Vincent Mailhol Committed by Marc Kleine-Budde

can: gs_usb: remove gs_can::iface

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: default avatarVincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20221208081142.16936-3-mailhol.vincent@wanadoo.frSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent f54b101d
...@@ -299,7 +299,6 @@ struct gs_can { ...@@ -299,7 +299,6 @@ struct gs_can {
struct net_device *netdev; struct net_device *netdev;
struct usb_device *udev; struct usb_device *udev;
struct usb_interface *iface;
struct can_bittiming_const bt_const, data_bt_const; struct can_bittiming_const bt_const, data_bt_const;
unsigned int channel; /* channel number */ unsigned int channel; /* channel number */
...@@ -383,8 +382,7 @@ static int gs_cmd_reset(struct gs_can *dev) ...@@ -383,8 +382,7 @@ static int gs_cmd_reset(struct gs_can *dev)
.mode = GS_CAN_MODE_RESET, .mode = GS_CAN_MODE_RESET,
}; };
return usb_control_msg_send(interface_to_usbdev(dev->iface), 0, return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_MODE,
GS_USB_BREQ_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dm, sizeof(dm), 1000, dev->channel, 0, &dm, sizeof(dm), 1000,
GFP_KERNEL); GFP_KERNEL);
...@@ -396,8 +394,7 @@ static inline int gs_usb_get_timestamp(const struct gs_can *dev, ...@@ -396,8 +394,7 @@ static inline int gs_usb_get_timestamp(const struct gs_can *dev,
__le32 timestamp; __le32 timestamp;
int rc; int rc;
rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0, rc = usb_control_msg_recv(dev->udev, 0, GS_USB_BREQ_TIMESTAMP,
GS_USB_BREQ_TIMESTAMP,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, dev->channel, 0,
&timestamp, sizeof(timestamp), &timestamp, sizeof(timestamp),
...@@ -674,8 +671,7 @@ static int gs_usb_set_bittiming(struct net_device *netdev) ...@@ -674,8 +671,7 @@ static int gs_usb_set_bittiming(struct net_device *netdev)
}; };
/* request bit timings */ /* request bit timings */
return usb_control_msg_send(interface_to_usbdev(dev->iface), 0, return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_BITTIMING,
GS_USB_BREQ_BITTIMING,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dbt, sizeof(dbt), 1000, dev->channel, 0, &dbt, sizeof(dbt), 1000,
GFP_KERNEL); GFP_KERNEL);
...@@ -698,8 +694,7 @@ static int gs_usb_set_data_bittiming(struct net_device *netdev) ...@@ -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 = GS_USB_BREQ_QUIRK_CANTACT_PRO_DATA_BITTIMING;
/* request data bit timings */ /* request data bit timings */
return usb_control_msg_send(interface_to_usbdev(dev->iface), 0, return usb_control_msg_send(dev->udev, 0, request,
request,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dbt, sizeof(dbt), 1000, dev->channel, 0, &dbt, sizeof(dbt), 1000,
GFP_KERNEL); GFP_KERNEL);
...@@ -941,8 +936,7 @@ static int gs_can_open(struct net_device *netdev) ...@@ -941,8 +936,7 @@ static int gs_can_open(struct net_device *netdev)
/* finally start device */ /* finally start device */
dev->can.state = CAN_STATE_ERROR_ACTIVE; dev->can.state = CAN_STATE_ERROR_ACTIVE;
dm.flags = cpu_to_le32(flags); dm.flags = cpu_to_le32(flags);
rc = usb_control_msg_send(interface_to_usbdev(dev->iface), 0, rc = usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_MODE,
GS_USB_BREQ_MODE,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &dm, sizeof(dm), 1000, dev->channel, 0, &dm, sizeof(dm), 1000,
GFP_KERNEL); GFP_KERNEL);
...@@ -969,8 +963,7 @@ static int gs_usb_get_state(const struct net_device *netdev, ...@@ -969,8 +963,7 @@ static int gs_usb_get_state(const struct net_device *netdev,
struct gs_device_state ds; struct gs_device_state ds;
int rc; int rc;
rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0, rc = usb_control_msg_recv(dev->udev, 0, GS_USB_BREQ_GET_STATE,
GS_USB_BREQ_GET_STATE,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, dev->channel, 0,
&ds, sizeof(ds), &ds, sizeof(ds),
...@@ -1064,8 +1057,7 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify) ...@@ -1064,8 +1057,7 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
else else
imode.mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF); imode.mode = cpu_to_le32(GS_CAN_IDENTIFY_OFF);
return usb_control_msg_send(interface_to_usbdev(dev->iface), 0, return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_IDENTIFY,
GS_USB_BREQ_IDENTIFY,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, &imode, sizeof(imode), 100, dev->channel, 0, &imode, sizeof(imode), 100,
GFP_KERNEL); GFP_KERNEL);
...@@ -1118,8 +1110,7 @@ static int gs_usb_get_termination(struct net_device *netdev, u16 *term) ...@@ -1118,8 +1110,7 @@ static int gs_usb_get_termination(struct net_device *netdev, u16 *term)
struct gs_device_termination_state term_state; struct gs_device_termination_state term_state;
int rc; int rc;
rc = usb_control_msg_recv(interface_to_usbdev(dev->iface), 0, rc = usb_control_msg_recv(dev->udev, 0, GS_USB_BREQ_GET_TERMINATION,
GS_USB_BREQ_GET_TERMINATION,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, dev->channel, 0,
&term_state, sizeof(term_state), 1000, &term_state, sizeof(term_state), 1000,
...@@ -1145,8 +1136,7 @@ static int gs_usb_set_termination(struct net_device *netdev, u16 term) ...@@ -1145,8 +1136,7 @@ static int gs_usb_set_termination(struct net_device *netdev, u16 term)
else else
term_state.state = cpu_to_le32(GS_CAN_TERMINATION_STATE_OFF); term_state.state = cpu_to_le32(GS_CAN_TERMINATION_STATE_OFF);
return usb_control_msg_send(interface_to_usbdev(dev->iface), 0, return usb_control_msg_send(dev->udev, 0, GS_USB_BREQ_SET_TERMINATION,
GS_USB_BREQ_SET_TERMINATION,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE,
dev->channel, 0, dev->channel, 0,
&term_state, sizeof(term_state), 1000, &term_state, sizeof(term_state), 1000,
...@@ -1210,7 +1200,6 @@ static struct gs_can *gs_make_candev(unsigned int channel, ...@@ -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->bt_const.brp_inc = le32_to_cpu(bt_const.brp_inc);
dev->udev = interface_to_usbdev(intf); dev->udev = interface_to_usbdev(intf);
dev->iface = intf;
dev->netdev = netdev; dev->netdev = netdev;
dev->channel = channel; dev->channel = channel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment