Skip to contentSkip to conversation

fbdev: udlfb: Use usb_control_msg_send()

PATCH In review Helge Deller 2 participants 2 messages May 19, 2023 – May 20, 2023

Subsystems (2)
lore
Share & tools
lore

Helge Deller

author maintainer
#0 lore raw

PATCH 1/1 fbdev: udlfb: Use usb_control_msg_send()

Use the newly introduced usb_control_msg_send() instead of usb_control_msg() when selecting the channel.

---
 drivers/video/fbdev/udlfb.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/video/fbdev/udlfb.c +3 -11
index 256d9b61f4ea..dabc30a09f96 100644
@@ -1543,24 +1543,16 @@ static const struct device_attribute fb_device_attrs[] = {
 static int dlfb_select_std_channel(struct dlfb_data *dlfb)
 {
 	int ret;
-	void *buf;
 	static const u8 set_def_chn[] = {
 				0x57, 0xCD, 0xDC, 0xA7,
 				0x1C, 0x88, 0x5E, 0x15,
 				0x60, 0xFE, 0xC6, 0x97,
 				0x16, 0x3D, 0x47, 0xF2  };
 
-	buf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL);
-
-	if (!buf)
-		return -ENOMEM;
-
-	ret = usb_control_msg(dlfb->udev, usb_sndctrlpipe(dlfb->udev, 0),
-			NR_USB_REQUEST_CHANNEL,
+	ret = usb_control_msg_send(dlfb->udev, 0, NR_USB_REQUEST_CHANNEL,
 			(USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0,
-			buf, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT);
-
-	kfree(buf);
+			&set_def_chn, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT,
+			GFP_KERNEL);
 
 	return ret;
 }

--
2.40.0

Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · Helge Deller

Use the newly introduced usb_control_msg_send() instead of usb_control_msg() when selecting the channel.

---
 drivers/video/fbdev/udlfb.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)
drivers/video/fbdev/udlfb.c +0 -8
index 256d9b61f4ea..dabc30a09f96 100644
@@ -1543,24 +1543,16 @@ static const struct device_attribute fb_device_attrs[] = {
 static int dlfb_select_std_channel(struct dlfb_data *dlfb)
 {
 	int ret;
-	void *buf;
 	static const u8 set_def_chn[] = {
 				0x57, 0xCD, 0xDC, 0xA7,
 				0x1C, 0x88, 0x5E, 0x15,
 				0x60, 0xFE, 0xC6, 0x97,
 				0x16, 0x3D, 0x47, 0xF2  };
 
-	buf = kmemdup(set_def_chn, sizeof(set_def_chn), GFP_KERNEL);
-
-	if (!buf)
-		return -ENOMEM;
-
-	ret = usb_control_msg(dlfb->udev, usb_sndctrlpipe(dlfb->udev, 0),
-			NR_USB_REQUEST_CHANNEL,

drivers/video/fbdev/udlfb.c static const struct device_attribute fb_device_attrs[] = { · line 1558

Quoted 10 lines
drivers/video/fbdev/udlfb.c +3 -3
+	ret = usb_control_msg_send(dlfb->udev, 0, NR_USB_REQUEST_CHANNEL,
 			(USB_DIR_OUT | USB_TYPE_VENDOR), 0, 0,
-			buf, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT);
-
-	kfree(buf);
+			&set_def_chn, sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT,
+			GFP_KERNEL);
 
 	return ret;
 }