* [PATCH] usb: serial: mos7840: Fix coding style warnings
@ 2024-10-23 9:14 Tony Chung
2024-10-23 10:04 ` Greg KH
` (3 more replies)
0 siblings, 4 replies; 22+ messages in thread
From: Tony Chung @ 2024-10-23 9:14 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-usb, linux-kernel, Tony Chung
This commit fix the coding style warnings shown by checkpatch.pl
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 50 ++++++++++++++++++++++--------------
1 file changed, 31 insertions(+), 19 deletions(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index ca3da79af..2de5974d4 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -220,7 +220,7 @@ struct moschip_port {
/*
* mos7840_set_reg_sync
- * To set the Control register by calling usb_fill_control_urb function
+ * To set the Control register by calling usb_fill_control_urb function
* by passing usb_sndctrlpipe function as parameter.
*/
@@ -228,8 +228,9 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
__u16 val)
{
struct usb_device *dev = port->serial->dev;
+
val = val & 0x00ff;
- dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
+ dev_dbg(&port->dev, "%s offset is %x, value %x\n", __func__, reg, val);
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ,
MCS_WR_RTYPE, val, reg, NULL, 0,
@@ -238,7 +239,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
/*
* mos7840_get_reg_sync
- * To set the Uart register by calling usb_fill_control_urb function by
+ * To set the Uart register by calling usb_fill_control_urb function by
* passing usb_rcvctrlpipe function as parameter.
*/
@@ -280,9 +281,11 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg,
{
struct usb_device *dev = port->serial->dev;
+
val = val & 0x00ff;
/* For the UART control registers, the application number need
- to be Or'ed */
+ * to be Or'ed
+ */
if (port->serial->num_ports == 2 && port->port_number != 0)
val |= ((__u16)port->port_number + 2) << 8;
else
@@ -448,6 +451,7 @@ static void mos7840_bulk_in_callback(struct urb *urb)
if (urb->actual_length) {
struct tty_port *tport = &mos7840_port->port->port;
+
tty_insert_flip_string(tport, data, urb->actual_length);
tty_flip_buffer_push(tport);
port->icount.rx += urb->actual_length;
@@ -742,6 +746,7 @@ static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty)
for (i = 0; i < NUM_URBS; ++i) {
if (mos7840_port->busy[i]) {
struct urb *urb = mos7840_port->write_urb_pool[i];
+
chars += urb->transfer_buffer_length;
}
}
@@ -915,8 +920,8 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
if (status) {
mos7840_port->busy[i] = 0;
- dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
- "with status = %d\n", __func__, status);
+ dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
+ with status = %d\n", __func__, status);
bytes_sent = status;
goto exit;
}
@@ -943,6 +948,7 @@ static void mos7840_throttle(struct tty_struct *tty)
/* if we are implementing XON/XOFF, send the stop character */
if (I_IXOFF(tty)) {
unsigned char stop_char = STOP_CHAR(tty);
+
status = mos7840_write(tty, port, &stop_char, 1);
if (status <= 0)
return;
@@ -972,6 +978,7 @@ static void mos7840_unthrottle(struct tty_struct *tty)
/* if we are implementing XON/XOFF, send the start character */
if (I_IXOFF(tty)) {
unsigned char start_char = START_CHAR(tty);
+
status = mos7840_write(tty, port, &start_char, 1);
if (status <= 0)
return;
@@ -1194,7 +1201,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
{
struct usb_serial_port *port = mos7840_port->port;
int baud;
- unsigned cflag;
+ unsigned int cflag;
__u8 lData;
__u8 lParity;
__u8 lStop;
@@ -1352,16 +1359,16 @@ static void mos7840_set_termios(struct tty_struct *tty,
}
}
-/*****************************************************************************
+/*
* mos7840_get_lsr_info - get line status register info
*
* Purpose: Let user call ioctl() to get info when the UART physically
- * is emptied. On bus types like RS485, the transmitter must
- * release the bus after transmitting. This must be done when
- * the transmit shift register is empty, not be done when the
- * transmit holding register is empty. This functionality
- * allows an RS485 driver to be written in user space.
- *****************************************************************************/
+ * is emptied. On bus types like RS485, the transmitter must
+ * release the bus after transmitting. This must be done when
+ * the transmit shift register is empty, not be done when the
+ * transmit holding register is empty. This functionality
+ * allows an RS485 driver to be written in user space.
+ */
static int mos7840_get_lsr_info(struct tty_struct *tty,
unsigned int __user *value)
@@ -1540,7 +1547,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
__u16 Data;
/* we set up the pointers to the endpoints in the mos7840_open *
- * function, as the structures aren't created yet. */
+ * function, as the structures aren't created yet.
+ */
pnum = port->port_number;
@@ -1551,14 +1559,16 @@ static int mos7840_port_probe(struct usb_serial_port *port)
/* Initialize all port interrupt end point to port 0 int
* endpoint. Our device has only one interrupt end point
- * common to all port */
+ * common to all port
+ */
mos7840_port->port = port;
spin_lock_init(&mos7840_port->pool_lock);
/* minor is not initialised until later by
* usb-serial.c:get_free_serial() and cannot therefore be used
- * to index device instances */
+ * to index device instances
+ */
mos7840_port->port_num = pnum + 1;
dev_dbg(&port->dev, "port->minor = %d\n", port->minor);
dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
@@ -1591,7 +1601,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status);
Data |= 0x08; /* setting driver done bit */
Data |= 0x04; /* sp1_bit to have cts change reflect in
- modem status reg */
+ * modem status reg
+ */
/* Data |= 0x20; //rx_disable bit */
status = mos7840_set_reg_sync(port,
@@ -1603,7 +1614,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "ControlReg Writing success(rx_disable) status%d\n", status);
/* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2
- and 0x24 in DCR3 */
+ * and 0x24 in DCR3
+ */
Data = 0x01;
status = mos7840_set_reg_sync(port,
(__u16) (mos7840_port->DcrRegOffset + 0), Data);
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH] usb: serial: mos7840: Fix coding style warnings
2024-10-23 9:14 [PATCH] usb: serial: mos7840: Fix coding style warnings Tony Chung
@ 2024-10-23 10:04 ` Greg KH
2024-10-24 17:37 ` kernel test robot
` (2 subsequent siblings)
3 siblings, 0 replies; 22+ messages in thread
From: Greg KH @ 2024-10-23 10:04 UTC (permalink / raw)
To: Tony Chung; +Cc: johan, linux-usb, linux-kernel
On Wed, Oct 23, 2024 at 05:14:15PM +0800, Tony Chung wrote:
> This commit fix the coding style warnings shown by checkpatch.pl
>
> Signed-off-by: Tony Chung <tony467913@gmail.com>
> ---
> drivers/usb/serial/mos7840.c | 50 ++++++++++++++++++++++--------------
> 1 file changed, 31 insertions(+), 19 deletions(-)
>
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him
a patch that has triggered this response. He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created. Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.
You are receiving this message because of the following common error(s)
as indicated below:
- Your patch did many different things all at once, making it difficult
to review. All Linux kernel patches need to only do one thing at a
time. If you need to do multiple things (such as clean up all coding
style issues in a file/driver), do it in a sequence of patches, each
one doing only one thing. This will make it easier to review the
patches to ensure that they are correct, and to help alleviate any
merge issues that larger patches can cause.
If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.
thanks,
greg k-h's patch email bot
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH] usb: serial: mos7840: Fix coding style warnings
2024-10-23 9:14 [PATCH] usb: serial: mos7840: Fix coding style warnings Tony Chung
2024-10-23 10:04 ` Greg KH
@ 2024-10-24 17:37 ` kernel test robot
2024-10-24 17:58 ` kernel test robot
2024-10-25 7:49 ` [PATCH] usb: serial: mos7840: Fix coding style warnings kernel test robot
3 siblings, 0 replies; 22+ messages in thread
From: kernel test robot @ 2024-10-24 17:37 UTC (permalink / raw)
To: Tony Chung, johan
Cc: llvm, oe-kbuild-all, gregkh, linux-usb, linux-kernel, Tony Chung
Hi Tony,
kernel test robot noticed the following build errors:
[auto build test ERROR on johan-usb-serial/usb-next]
[also build test ERROR on johan-usb-serial/usb-linus usb/usb-testing usb/usb-next usb/usb-linus tty/tty-testing tty/tty-next tty/tty-linus linus/master v6.12-rc4 next-20241024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Tony-Chung/usb-serial-mos7840-Fix-coding-style-warnings/20241023-171615
base: https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git usb-next
patch link: https://lore.kernel.org/r/20241023091414.18098-1-tony467913%40gmail.com
patch subject: [PATCH] usb: serial: mos7840: Fix coding style warnings
config: i386-buildonly-randconfig-005-20241024 (https://download.01.org/0day-ci/archive/20241025/202410250138.OhF04o8W-lkp@intel.com/config)
compiler: clang version 19.1.2 (https://github.com/llvm/llvm-project 7ba7d8e2f7b6445b60679da826210cdde29eaf8b)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410250138.OhF04o8W-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410250138.OhF04o8W-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/usb/serial/mos7840.c:15:
In file included from include/linux/tty.h:11:
In file included from include/linux/tty_port.h:5:
In file included from include/linux/kfifo.h:40:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:8:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
drivers/usb/serial/mos7840.c:923:25: warning: missing terminating '"' character [-Winvalid-pp-token]
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^
drivers/usb/serial/mos7840.c:924:22: warning: missing terminating '"' character [-Winvalid-pp-token]
924 | with status = %d\n", __func__, status);
| ^
>> drivers/usb/serial/mos7840.c:923:3: error: unterminated function-like macro invocation
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^
include/linux/usb/serial.h:399:9: note: macro 'dev_err_console' defined here
399 | #define dev_err_console(usport, fmt, ...) \
| ^
>> drivers/usb/serial/mos7840.c:1832:23: error: expected '}'
1832 | MODULE_LICENSE("GPL");
| ^
drivers/usb/serial/mos7840.c:921:14: note: to match this '{'
921 | if (status) {
| ^
>> drivers/usb/serial/mos7840.c:1832:23: error: expected '}'
1832 | MODULE_LICENSE("GPL");
| ^
drivers/usb/serial/mos7840.c:851:1: note: to match this '{'
851 | {
| ^
>> drivers/usb/serial/mos7840.c:879:8: error: use of undeclared label 'exit'
879 | goto exit;
| ^
3 warnings and 4 errors generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION
Depends on [n]: SPARSEMEM [=n]
Selected by [y]:
- RESOURCE_KUNIT_TEST [=y] && RUNTIME_TESTING_MENU [=y] && KUNIT [=y]
vim +923 drivers/usb/serial/mos7840.c
840
841 /*****************************************************************************
842 * mos7840_write
843 * this function is called by the tty driver when data should be written to
844 * the port.
845 * If successful, we return the number of bytes written, otherwise we
846 * return a negative error number.
847 *****************************************************************************/
848
849 static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
850 const unsigned char *data, int count)
851 {
852 struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
853 struct usb_serial *serial = port->serial;
854 int status;
855 int i;
856 int bytes_sent = 0;
857 int transfer_size;
858 unsigned long flags;
859 struct urb *urb;
860 /* __u16 Data; */
861 const unsigned char *current_position = data;
862
863 /* try to find a free urb in the list */
864 urb = NULL;
865
866 spin_lock_irqsave(&mos7840_port->pool_lock, flags);
867 for (i = 0; i < NUM_URBS; ++i) {
868 if (!mos7840_port->busy[i]) {
869 mos7840_port->busy[i] = 1;
870 urb = mos7840_port->write_urb_pool[i];
871 dev_dbg(&port->dev, "URB:%d\n", i);
872 break;
873 }
874 }
875 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
876
877 if (urb == NULL) {
878 dev_dbg(&port->dev, "%s - no more free urbs\n", __func__);
> 879 goto exit;
880 }
881
882 if (urb->transfer_buffer == NULL) {
883 urb->transfer_buffer = kmalloc(URB_TRANSFER_BUFFER_SIZE,
884 GFP_ATOMIC);
885 if (!urb->transfer_buffer) {
886 bytes_sent = -ENOMEM;
887 goto exit;
888 }
889 }
890 transfer_size = min(count, URB_TRANSFER_BUFFER_SIZE);
891
892 memcpy(urb->transfer_buffer, current_position, transfer_size);
893
894 /* fill urb with data and submit */
895 if ((serial->num_ports == 2) && (((__u16)port->port_number % 2) != 0)) {
896 usb_fill_bulk_urb(urb,
897 serial->dev,
898 usb_sndbulkpipe(serial->dev,
899 (port->bulk_out_endpointAddress) + 2),
900 urb->transfer_buffer,
901 transfer_size,
902 mos7840_bulk_out_data_callback, mos7840_port);
903 } else {
904 usb_fill_bulk_urb(urb,
905 serial->dev,
906 usb_sndbulkpipe(serial->dev,
907 port->bulk_out_endpointAddress),
908 urb->transfer_buffer,
909 transfer_size,
910 mos7840_bulk_out_data_callback, mos7840_port);
911 }
912
913 dev_dbg(&port->dev, "bulkout endpoint is %d\n", port->bulk_out_endpointAddress);
914
915 if (mos7840_port->has_led)
916 mos7840_led_activity(port);
917
918 /* send it down the pipe */
919 status = usb_submit_urb(urb, GFP_ATOMIC);
920
921 if (status) {
922 mos7840_port->busy[i] = 0;
> 923 dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
924 with status = %d\n", __func__, status);
925 bytes_sent = status;
926 goto exit;
927 }
928 bytes_sent = transfer_size;
929 port->icount.tx += transfer_size;
930 dev_dbg(&port->dev, "icount.tx is %d:\n", port->icount.tx);
931 exit:
932 return bytes_sent;
933
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH] usb: serial: mos7840: Fix coding style warnings
2024-10-23 9:14 [PATCH] usb: serial: mos7840: Fix coding style warnings Tony Chung
2024-10-23 10:04 ` Greg KH
2024-10-24 17:37 ` kernel test robot
@ 2024-10-24 17:58 ` kernel test robot
2024-10-25 6:17 ` [PATCH v2 0/6] " Tony Chung
` (6 more replies)
2024-10-25 7:49 ` [PATCH] usb: serial: mos7840: Fix coding style warnings kernel test robot
3 siblings, 7 replies; 22+ messages in thread
From: kernel test robot @ 2024-10-24 17:58 UTC (permalink / raw)
To: Tony Chung, johan
Cc: oe-kbuild-all, gregkh, linux-usb, linux-kernel, Tony Chung
Hi Tony,
kernel test robot noticed the following build warnings:
[auto build test WARNING on johan-usb-serial/usb-next]
[also build test WARNING on johan-usb-serial/usb-linus usb/usb-testing usb/usb-next usb/usb-linus tty/tty-testing tty/tty-next tty/tty-linus linus/master v6.12-rc4 next-20241024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Tony-Chung/usb-serial-mos7840-Fix-coding-style-warnings/20241023-171615
base: https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git usb-next
patch link: https://lore.kernel.org/r/20241023091414.18098-1-tony467913%40gmail.com
patch subject: [PATCH] usb: serial: mos7840: Fix coding style warnings
config: s390-allyesconfig (https://download.01.org/0day-ci/archive/20241025/202410250141.AEkzzW60-lkp@intel.com/config)
compiler: s390-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410250141.AEkzzW60-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410250141.AEkzzW60-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/usb/serial/mos7840.c: In function 'mos7840_write':
drivers/usb/serial/mos7840.c:923:39: warning: missing terminating " character
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^
drivers/usb/serial/mos7840.c:924:43: warning: missing terminating " character
924 | with status = %d\n", __func__, status);
| ^
drivers/usb/serial/mos7840.c:1832:23: error: unterminated argument list invoking macro "dev_err_console"
1832 | MODULE_LICENSE("GPL");
| ^
drivers/usb/serial/mos7840.c:923:17: error: 'dev_err_console' undeclared (first use in this function); did you mean 'dev_err_probe'?
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^~~~~~~~~~~~~~~
| dev_err_probe
drivers/usb/serial/mos7840.c:923:17: note: each undeclared identifier is reported only once for each function it appears in
drivers/usb/serial/mos7840.c:923:32: error: expected ';' at end of input
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^
| ;
......
drivers/usb/serial/mos7840.c:923:17: error: expected declaration or statement at end of input
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^~~~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:923:17: error: expected declaration or statement at end of input
drivers/usb/serial/mos7840.c:887:25: error: label 'exit' used but not defined
887 | goto exit;
| ^~~~
drivers/usb/serial/mos7840.c:856:13: warning: variable 'bytes_sent' set but not used [-Wunused-but-set-variable]
856 | int bytes_sent = 0;
| ^~~~~~~~~~
drivers/usb/serial/mos7840.c: At top level:
drivers/usb/serial/mos7840.c:849:12: warning: 'mos7840_write' defined but not used [-Wunused-function]
849 | static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
| ^~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:820:21: warning: 'mos7840_write_room' defined but not used [-Wunused-function]
820 | static unsigned int mos7840_write_room(struct tty_struct *tty)
| ^~~~~~~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:795:12: warning: 'mos7840_break' defined but not used [-Wunused-function]
795 | static int mos7840_break(struct tty_struct *tty, int break_state)
| ^~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:764:13: warning: 'mos7840_close' defined but not used [-Wunused-function]
764 | static void mos7840_close(struct usb_serial_port *port)
| ^~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:737:21: warning: 'mos7840_chars_in_buffer' defined but not used [-Wunused-function]
737 | static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty)
| ^~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:516:12: warning: 'mos7840_open' defined but not used [-Wunused-function]
516 | static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
| ^~~~~~~~~~~~
drivers/usb/serial/mos7840.c:410:13: warning: 'mos7840_led_flag_off' defined but not used [-Wunused-function]
410 | static void mos7840_led_flag_off(struct timer_list *t)
| ^~~~~~~~~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:400:13: warning: 'mos7840_led_off' defined but not used [-Wunused-function]
400 | static void mos7840_led_off(struct timer_list *t)
| ^~~~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:391:13: warning: 'mos7840_set_led_sync' defined but not used [-Wunused-function]
391 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg,
| ^~~~~~~~~~~~~~~~~~~~
drivers/usb/serial/mos7840.c:337:13: warning: 'mos7840_dump_serial_port' defined but not used [-Wunused-function]
337 | static void mos7840_dump_serial_port(struct usb_serial_port *port,
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:168:35: warning: 'id_table' defined but not used [-Wunused-const-variable=]
168 | static const struct usb_device_id id_table[] = {
| ^~~~~~~~
vim +/id_table +168 drivers/usb/serial/mos7840.c
375cb533c00a237 Johan Hovold 2019-11-07 164
375cb533c00a237 Johan Hovold 2019-11-07 165 #define MCS_DEVICE(vid, pid, flags) \
375cb533c00a237 Johan Hovold 2019-11-07 166 USB_DEVICE((vid), (pid)), .driver_info = (flags)
375cb533c00a237 Johan Hovold 2019-11-07 167
b9c87663eead64c Tony Zelenoff 2012-06-05 @168 static const struct usb_device_id id_table[] = {
375cb533c00a237 Johan Hovold 2019-11-07 169 { MCS_DEVICE(0x0557, 0x2011, MCS_PORTS(4)) }, /* ATEN UC2324 */
375cb533c00a237 Johan Hovold 2019-11-07 170 { MCS_DEVICE(0x0557, 0x7820, MCS_PORTS(2)) }, /* ATEN UC2322 */
375cb533c00a237 Johan Hovold 2019-11-07 171 { MCS_DEVICE(0x110a, 0x2210, MCS_PORTS(2)) }, /* Moxa UPort 2210 */
375cb533c00a237 Johan Hovold 2019-11-07 172 { MCS_DEVICE(0x9710, 0x7810, MCS_PORTS(1) | MCS_LED) }, /* ASIX MCS7810 */
375cb533c00a237 Johan Hovold 2019-11-07 173 { MCS_DEVICE(0x9710, 0x7820, MCS_PORTS(2)) }, /* MosChip MCS7820 */
375cb533c00a237 Johan Hovold 2019-11-07 174 { MCS_DEVICE(0x9710, 0x7840, MCS_PORTS(4)) }, /* MosChip MCS7840 */
375cb533c00a237 Johan Hovold 2019-11-07 175 { MCS_DEVICE(0x9710, 0x7843, MCS_PORTS(3)) }, /* ASIX MCS7840 3 port */
acf509ae28301d7 Cliff Brake 2009-12-01 176 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2) },
870408c82910158 Dave Ludlow 2010-09-01 177 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2P) },
acf509ae28301d7 Cliff Brake 2009-12-01 178 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4) },
870408c82910158 Dave Ludlow 2010-09-01 179 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4P) },
acf509ae28301d7 Cliff Brake 2009-12-01 180 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2) },
acf509ae28301d7 Cliff Brake 2009-12-01 181 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4) },
acf509ae28301d7 Cliff Brake 2009-12-01 182 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2) },
acf509ae28301d7 Cliff Brake 2009-12-01 183 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4) },
11e1abb453690a9 David Ludlow 2008-02-25 184 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2) },
870408c82910158 Dave Ludlow 2010-09-01 185 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2P) },
acf509ae28301d7 Cliff Brake 2009-12-01 186 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4) },
870408c82910158 Dave Ludlow 2010-09-01 187 { USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4P) },
3f5429746d91f21 Paul B Schroeder 2006-08-31 188 {} /* terminating entry */
3f5429746d91f21 Paul B Schroeder 2006-08-31 189 };
68e24113457e437 Greg Kroah-Hartman 2012-05-08 190 MODULE_DEVICE_TABLE(usb, id_table);
3f5429746d91f21 Paul B Schroeder 2006-08-31 191
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 22+ messages in thread* [PATCH v2 0/6] usb: serial: mos7840: Fix coding style warnings
2024-10-24 17:58 ` kernel test robot
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:15 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 1/6] driver: usb: serial: mos7840: fix " Tony Chung
` (5 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
This patch series fix all the coding style warnings shown by checkpatch.pl
I have tested Patch v2 and it has no driver build warnings.
Please have a look and let me know if something is wrong. Thanks.
Tony Chung (6):
driver: usb: serial: mos7840: fix warnings "no space before tabs"
drivers: usb: serial: mos7840: Fix Block comments coding style
warnings
drivers: usb: serial: mos7840: fix coding style warnings
drivers: usb: serial: mos7840: using '__func__' to replace function
name in dbg message
drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int'
drivers: usb: serial: mos7840: fix the quoted string split across
lines
drivers/usb/serial/mos7840.c | 49 +++++++++++++++++++++++-------------
1 file changed, 31 insertions(+), 18 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: [PATCH v2 0/6] usb: serial: mos7840: Fix coding style warnings
2024-10-25 6:17 ` [PATCH v2 0/6] " Tony Chung
@ 2025-02-11 9:15 ` Johan Hovold
0 siblings, 0 replies; 22+ messages in thread
From: Johan Hovold @ 2025-02-11 9:15 UTC (permalink / raw)
To: Tony Chung; +Cc: gregkh, linux-kernel, linux-usb
Hi Tony,
and sorry about the late feedback on this one and your other series for
this driver.
On Fri, Oct 25, 2024 at 02:17:06PM +0800, Tony Chung wrote:
> This patch series fix all the coding style warnings shown by checkpatch.pl
Checkpatch should generally not be run on code that is already in the
tree. It's meant as a tool to be run on patches before submitting them
and you always have to use your own judgement whether its output makes
sense or not.
That said, since you are actually doing real work on this driver and
there certainly are some real style issues with this driver, I'll review
these.
> I have tested Patch v2 and it has no driver build warnings.
> Please have a look and let me know if something is wrong. Thanks.
>
> Tony Chung (6):
> driver: usb: serial: mos7840: fix warnings "no space before tabs"
> drivers: usb: serial: mos7840: Fix Block comments coding style
> warnings
> drivers: usb: serial: mos7840: fix coding style warnings
> drivers: usb: serial: mos7840: using '__func__' to replace function
> name in dbg message
> drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int'
> drivers: usb: serial: mos7840: fix the quoted string split across
> lines
First, please try to use the established patch prefix for the drivers
you are changing (e.g. as can often be determined by running git log
--oneline on the files in question). In this case
USB: serial: mos7840: ...
Second, please rephrase the patch summaries and commit messages so that
they don't give the impression that you're doing this just to make
checkpatch happy. Instead say, for example:
Add newlines after declarations to improve readability.
as that is a valid motivation for doing clean ups like this as part of
other work on the driver (and try to rephrase as "clean up" instead of
"fix" as I think the latter should be reserved for bug fixes).
Johan
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 1/6] driver: usb: serial: mos7840: fix style warnings
2024-10-24 17:58 ` kernel test robot
2024-10-25 6:17 ` [PATCH v2 0/6] " Tony Chung
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:20 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 2/6] drivers: usb: serial: mos7840: Fix Block comments coding " Tony Chung
` (4 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
fix "no space before tabs" coding style warnings.
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index ca3da79af..dcaed0f26 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -220,7 +220,7 @@ struct moschip_port {
/*
* mos7840_set_reg_sync
- * To set the Control register by calling usb_fill_control_urb function
+ * To set the Control register by calling usb_fill_control_urb function
* by passing usb_sndctrlpipe function as parameter.
*/
@@ -238,7 +238,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
/*
* mos7840_get_reg_sync
- * To set the Uart register by calling usb_fill_control_urb function by
+ * To set the Uart register by calling usb_fill_control_urb function by
* passing usb_rcvctrlpipe function as parameter.
*/
@@ -1356,11 +1356,11 @@ static void mos7840_set_termios(struct tty_struct *tty,
* mos7840_get_lsr_info - get line status register info
*
* Purpose: Let user call ioctl() to get info when the UART physically
- * is emptied. On bus types like RS485, the transmitter must
- * release the bus after transmitting. This must be done when
- * the transmit shift register is empty, not be done when the
- * transmit holding register is empty. This functionality
- * allows an RS485 driver to be written in user space.
+ * is emptied. On bus types like RS485, the transmitter must
+ * release the bus after transmitting. This must be done when
+ * the transmit shift register is empty, not be done when the
+ * transmit holding register is empty. This functionality
+ * allows an RS485 driver to be written in user space.
*****************************************************************************/
static int mos7840_get_lsr_info(struct tty_struct *tty,
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 1/6] driver: usb: serial: mos7840: fix style warnings
2024-10-25 6:17 ` [PATCH v2 1/6] driver: usb: serial: mos7840: fix " Tony Chung
@ 2025-02-11 9:20 ` Johan Hovold
0 siblings, 0 replies; 22+ messages in thread
From: Johan Hovold @ 2025-02-11 9:20 UTC (permalink / raw)
To: Tony Chung; +Cc: gregkh, linux-kernel, linux-usb
On Fri, Oct 25, 2024 at 02:17:08PM +0800, Tony Chung wrote:
> fix "no space before tabs" coding style warnings.
Perhaps rephrase as:
Replace spaces before tabs, which some editors and pagers
highlight as errors.
Getting rid of those red higlights I see in vim should be motivation
enough here (again, as you're doing other changes to the driver).
> Signed-off-by: Tony Chung <tony467913@gmail.com>
> ---
> drivers/usb/serial/mos7840.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> index ca3da79af..dcaed0f26 100644
> --- a/drivers/usb/serial/mos7840.c
> +++ b/drivers/usb/serial/mos7840.c
> @@ -220,7 +220,7 @@ struct moschip_port {
>
> /*
> * mos7840_set_reg_sync
> - * To set the Control register by calling usb_fill_control_urb function
> + * To set the Control register by calling usb_fill_control_urb function
> * by passing usb_sndctrlpipe function as parameter.
> */
>
> @@ -238,7 +238,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
>
> /*
> * mos7840_get_reg_sync
> - * To set the Uart register by calling usb_fill_control_urb function by
> + * To set the Uart register by calling usb_fill_control_urb function by
> * passing usb_rcvctrlpipe function as parameter.
> */
>
> @@ -1356,11 +1356,11 @@ static void mos7840_set_termios(struct tty_struct *tty,
> * mos7840_get_lsr_info - get line status register info
> *
> * Purpose: Let user call ioctl() to get info when the UART physically
> - * is emptied. On bus types like RS485, the transmitter must
> - * release the bus after transmitting. This must be done when
> - * the transmit shift register is empty, not be done when the
> - * transmit holding register is empty. This functionality
> - * allows an RS485 driver to be written in user space.
> + * is emptied. On bus types like RS485, the transmitter must
> + * release the bus after transmitting. This must be done when
> + * the transmit shift register is empty, not be done when the
> + * transmit holding register is empty. This functionality
> + * allows an RS485 driver to be written in user space.
But perhaps you should keep the indentation here (all lines are aligned
under "Let") as the author intended.
Johan
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 2/6] drivers: usb: serial: mos7840: Fix Block comments coding style warnings
2024-10-24 17:58 ` kernel test robot
2024-10-25 6:17 ` [PATCH v2 0/6] " Tony Chung
2024-10-25 6:17 ` [PATCH v2 1/6] driver: usb: serial: mos7840: fix " Tony Chung
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:27 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 3/6] drivers: usb: serial: mos7840: fix " Tony Chung
` (3 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
fix block comments coding style warnings.
1. Block comments use * on subsequent lines
2. Block comments use a trailing */ on a separate line
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index dcaed0f26..b1a794f99 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -282,7 +282,8 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg,
struct usb_device *dev = port->serial->dev;
val = val & 0x00ff;
/* For the UART control registers, the application number need
- to be Or'ed */
+ * to be Or'ed
+ */
if (port->serial->num_ports == 2 && port->port_number != 0)
val |= ((__u16)port->port_number + 2) << 8;
else
@@ -1539,8 +1540,9 @@ static int mos7840_port_probe(struct usb_serial_port *port)
int pnum;
__u16 Data;
- /* we set up the pointers to the endpoints in the mos7840_open *
- * function, as the structures aren't created yet. */
+ /* we set up the pointers to the endpoints in the mos7840_open
+ * function, as the structures aren't created yet.
+ */
pnum = port->port_number;
@@ -1551,14 +1553,16 @@ static int mos7840_port_probe(struct usb_serial_port *port)
/* Initialize all port interrupt end point to port 0 int
* endpoint. Our device has only one interrupt end point
- * common to all port */
+ * common to all port
+ */
mos7840_port->port = port;
spin_lock_init(&mos7840_port->pool_lock);
/* minor is not initialised until later by
* usb-serial.c:get_free_serial() and cannot therefore be used
- * to index device instances */
+ * to index device instances
+ */
mos7840_port->port_num = pnum + 1;
dev_dbg(&port->dev, "port->minor = %d\n", port->minor);
dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
@@ -1591,7 +1595,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status);
Data |= 0x08; /* setting driver done bit */
Data |= 0x04; /* sp1_bit to have cts change reflect in
- modem status reg */
+ * modem status reg
+ */
/* Data |= 0x20; //rx_disable bit */
status = mos7840_set_reg_sync(port,
@@ -1603,7 +1608,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
dev_dbg(&port->dev, "ControlReg Writing success(rx_disable) status%d\n", status);
/* Write default values in DCR (i.e 0x01 in DCR0, 0x05 in DCR2
- and 0x24 in DCR3 */
+ * and 0x24 in DCR3
+ */
Data = 0x01;
status = mos7840_set_reg_sync(port,
(__u16) (mos7840_port->DcrRegOffset + 0), Data);
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 2/6] drivers: usb: serial: mos7840: Fix Block comments coding style warnings
2024-10-25 6:17 ` [PATCH v2 2/6] drivers: usb: serial: mos7840: Fix Block comments coding " Tony Chung
@ 2025-02-11 9:27 ` Johan Hovold
0 siblings, 0 replies; 22+ messages in thread
From: Johan Hovold @ 2025-02-11 9:27 UTC (permalink / raw)
To: Tony Chung; +Cc: gregkh, linux-kernel, linux-usb
On Fri, Oct 25, 2024 at 02:17:10PM +0800, Tony Chung wrote:
> fix block comments coding style warnings.
> 1. Block comments use * on subsequent lines
> 2. Block comments use a trailing */ on a separate line
Just say something like:
Clean up the style of the block comments.
or similar.
> Signed-off-by: Tony Chung <tony467913@gmail.com>
> ---
> drivers/usb/serial/mos7840.c | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> index dcaed0f26..b1a794f99 100644
> --- a/drivers/usb/serial/mos7840.c
> +++ b/drivers/usb/serial/mos7840.c
> @@ -282,7 +282,8 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg,
> struct usb_device *dev = port->serial->dev;
> val = val & 0x00ff;
> /* For the UART control registers, the application number need
> - to be Or'ed */
> + * to be Or'ed
> + */
> if (port->serial->num_ports == 2 && port->port_number != 0)
> val |= ((__u16)port->port_number + 2) << 8;
> else
> @@ -1539,8 +1540,9 @@ static int mos7840_port_probe(struct usb_serial_port *port)
> int pnum;
> __u16 Data;
>
> - /* we set up the pointers to the endpoints in the mos7840_open *
> - * function, as the structures aren't created yet. */
> + /* we set up the pointers to the endpoints in the mos7840_open
This style is only valid in networking code; the format for block
comments should generally be:
/*
* ...
*/
> + * function, as the structures aren't created yet.
> + */
>
> pnum = port->port_number;
>
> @@ -1551,14 +1553,16 @@ static int mos7840_port_probe(struct usb_serial_port *port)
>
> /* Initialize all port interrupt end point to port 0 int
> * endpoint. Our device has only one interrupt end point
> - * common to all port */
> + * common to all port
> + */
>
> mos7840_port->port = port;
> spin_lock_init(&mos7840_port->pool_lock);
>
> /* minor is not initialised until later by
> * usb-serial.c:get_free_serial() and cannot therefore be used
> - * to index device instances */
> + * to index device instances
> + */
> mos7840_port->port_num = pnum + 1;
> dev_dbg(&port->dev, "port->minor = %d\n", port->minor);
> dev_dbg(&port->dev, "mos7840_port->port_num = %d\n", mos7840_port->port_num);
> @@ -1591,7 +1595,8 @@ static int mos7840_port_probe(struct usb_serial_port *port)
> dev_dbg(&port->dev, "ControlReg Reading success val is %x, status%d\n", Data, status);
> Data |= 0x08; /* setting driver done bit */
> Data |= 0x04; /* sp1_bit to have cts change reflect in
> - modem status reg */
> + * modem status reg
> + */
Just drop the new line, this can be an exception to the 80 char rule if
you can't find a good way to rephrase this.
> /* Data |= 0x20; //rx_disable bit */
> status = mos7840_set_reg_sync(port,
Johan
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 3/6] drivers: usb: serial: mos7840: fix coding style warnings
2024-10-24 17:58 ` kernel test robot
` (2 preceding siblings ...)
2024-10-25 6:17 ` [PATCH v2 2/6] drivers: usb: serial: mos7840: Fix Block comments coding " Tony Chung
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:28 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message Tony Chung
` (2 subsequent siblings)
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
fix coding style warning of
"Missing a blank line after declarations"
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index b1a794f99..b48a26468 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -228,6 +228,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
__u16 val)
{
struct usb_device *dev = port->serial->dev;
+
val = val & 0x00ff;
dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
@@ -280,6 +281,7 @@ static int mos7840_set_uart_reg(struct usb_serial_port *port, __u16 reg,
{
struct usb_device *dev = port->serial->dev;
+
val = val & 0x00ff;
/* For the UART control registers, the application number need
* to be Or'ed
@@ -449,6 +451,7 @@ static void mos7840_bulk_in_callback(struct urb *urb)
if (urb->actual_length) {
struct tty_port *tport = &mos7840_port->port->port;
+
tty_insert_flip_string(tport, data, urb->actual_length);
tty_flip_buffer_push(tport);
port->icount.rx += urb->actual_length;
@@ -743,6 +746,7 @@ static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty)
for (i = 0; i < NUM_URBS; ++i) {
if (mos7840_port->busy[i]) {
struct urb *urb = mos7840_port->write_urb_pool[i];
+
chars += urb->transfer_buffer_length;
}
}
@@ -944,6 +948,7 @@ static void mos7840_throttle(struct tty_struct *tty)
/* if we are implementing XON/XOFF, send the stop character */
if (I_IXOFF(tty)) {
unsigned char stop_char = STOP_CHAR(tty);
+
status = mos7840_write(tty, port, &stop_char, 1);
if (status <= 0)
return;
@@ -973,6 +978,7 @@ static void mos7840_unthrottle(struct tty_struct *tty)
/* if we are implementing XON/XOFF, send the start character */
if (I_IXOFF(tty)) {
unsigned char start_char = START_CHAR(tty);
+
status = mos7840_write(tty, port, &start_char, 1);
if (status <= 0)
return;
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message
2024-10-24 17:58 ` kernel test robot
` (3 preceding siblings ...)
2024-10-25 6:17 ` [PATCH v2 3/6] drivers: usb: serial: mos7840: fix " Tony Chung
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:29 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 5/6] drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int' Tony Chung
2024-10-25 6:17 ` [PATCH v2 6/6] drivers: usb: serial: mos7840: fix the quoted string split across lines Tony Chung
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
fix warning of Prefer '"%s...",__func__' to using 'function name'.
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index b48a26468..31ec2cf1b 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -230,7 +230,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
struct usb_device *dev = port->serial->dev;
val = val & 0x00ff;
- dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
+ dev_dbg(&port->dev, "%s offset is %x, value %x\n", __func__, reg, val);
return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), MCS_WRREQ,
MCS_WR_RTYPE, val, reg, NULL, 0,
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message
2024-10-25 6:17 ` [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message Tony Chung
@ 2025-02-11 9:29 ` Johan Hovold
2025-02-11 9:32 ` Greg KH
0 siblings, 1 reply; 22+ messages in thread
From: Johan Hovold @ 2025-02-11 9:29 UTC (permalink / raw)
To: Tony Chung; +Cc: gregkh, linux-kernel, linux-usb
On Fri, Oct 25, 2024 at 02:17:14PM +0800, Tony Chung wrote:
> fix warning of Prefer '"%s...",__func__' to using 'function name'.
>
> Signed-off-by: Tony Chung <tony467913@gmail.com>
> ---
> drivers/usb/serial/mos7840.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> index b48a26468..31ec2cf1b 100644
> --- a/drivers/usb/serial/mos7840.c
> +++ b/drivers/usb/serial/mos7840.c
> @@ -230,7 +230,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
> struct usb_device *dev = port->serial->dev;
>
> val = val & 0x00ff;
> - dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
> + dev_dbg(&port->dev, "%s offset is %x, value %x\n", __func__, reg, val);
I suggest you just leave this as is.
Johan
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message
2025-02-11 9:29 ` Johan Hovold
@ 2025-02-11 9:32 ` Greg KH
2025-02-11 9:38 ` Johan Hovold
0 siblings, 1 reply; 22+ messages in thread
From: Greg KH @ 2025-02-11 9:32 UTC (permalink / raw)
To: Johan Hovold; +Cc: Tony Chung, linux-kernel, linux-usb
On Tue, Feb 11, 2025 at 10:29:22AM +0100, Johan Hovold wrote:
> On Fri, Oct 25, 2024 at 02:17:14PM +0800, Tony Chung wrote:
> > fix warning of Prefer '"%s...",__func__' to using 'function name'.
> >
> > Signed-off-by: Tony Chung <tony467913@gmail.com>
> > ---
> > drivers/usb/serial/mos7840.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> > index b48a26468..31ec2cf1b 100644
> > --- a/drivers/usb/serial/mos7840.c
> > +++ b/drivers/usb/serial/mos7840.c
> > @@ -230,7 +230,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
> > struct usb_device *dev = port->serial->dev;
> >
> > val = val & 0x00ff;
> > - dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
> > + dev_dbg(&port->dev, "%s offset is %x, value %x\n", __func__, reg, val);
>
> I suggest you just leave this as is.
__func__ should NEVER be added to dev_dbg() lines as it is already
available if the user want it. Adding it explicitly to the string is
just redundant.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message
2025-02-11 9:32 ` Greg KH
@ 2025-02-11 9:38 ` Johan Hovold
0 siblings, 0 replies; 22+ messages in thread
From: Johan Hovold @ 2025-02-11 9:38 UTC (permalink / raw)
To: Greg KH; +Cc: Tony Chung, linux-kernel, linux-usb
On Tue, Feb 11, 2025 at 10:32:14AM +0100, Greg Kroah-Hartman wrote:
> On Tue, Feb 11, 2025 at 10:29:22AM +0100, Johan Hovold wrote:
> > On Fri, Oct 25, 2024 at 02:17:14PM +0800, Tony Chung wrote:
> > > fix warning of Prefer '"%s...",__func__' to using 'function name'.
> > >
> > > Signed-off-by: Tony Chung <tony467913@gmail.com>
> > > ---
> > > drivers/usb/serial/mos7840.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> > > index b48a26468..31ec2cf1b 100644
> > > --- a/drivers/usb/serial/mos7840.c
> > > +++ b/drivers/usb/serial/mos7840.c
> > > @@ -230,7 +230,7 @@ static int mos7840_set_reg_sync(struct usb_serial_port *port, __u16 reg,
> > > struct usb_device *dev = port->serial->dev;
> > >
> > > val = val & 0x00ff;
> > > - dev_dbg(&port->dev, "mos7840_set_reg_sync offset is %x, value %x\n", reg, val);
> > > + dev_dbg(&port->dev, "%s offset is %x, value %x\n", __func__, reg, val);
> >
> > I suggest you just leave this as is.
>
> __func__ should NEVER be added to dev_dbg() lines as it is already
> available if the user want it. Adding it explicitly to the string is
> just redundant.
It can sometimes be useful to allow for compact but self-contained debug
messages that makes sense also when the generic function prefix is not
printed (I tend not to enable those myself).
But in general, try to follow the style of the driver you're changing.
Johan
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 5/6] drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int'
2024-10-24 17:58 ` kernel test robot
` (4 preceding siblings ...)
2024-10-25 6:17 ` [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message Tony Chung
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:31 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 6/6] drivers: usb: serial: mos7840: fix the quoted string split across lines Tony Chung
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
Fix coding style "Prefer 'unsigned int' to bare use of 'unsigned'"
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index 31ec2cf1b..d2cae6619 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -1201,7 +1201,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
{
struct usb_serial_port *port = mos7840_port->port;
int baud;
- unsigned cflag;
+ unsigned int cflag;
__u8 lData;
__u8 lParity;
__u8 lStop;
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread* Re: [PATCH v2 5/6] drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int'
2024-10-25 6:17 ` [PATCH v2 5/6] drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int' Tony Chung
@ 2025-02-11 9:31 ` Johan Hovold
0 siblings, 0 replies; 22+ messages in thread
From: Johan Hovold @ 2025-02-11 9:31 UTC (permalink / raw)
To: Tony Chung; +Cc: gregkh, linux-kernel, linux-usb
On Fri, Oct 25, 2024 at 02:17:16PM +0800, Tony Chung wrote:
> Fix coding style "Prefer 'unsigned int' to bare use of 'unsigned'"
>
> Signed-off-by: Tony Chung <tony467913@gmail.com>
> ---
> drivers/usb/serial/mos7840.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> index 31ec2cf1b..d2cae6619 100644
> --- a/drivers/usb/serial/mos7840.c
> +++ b/drivers/usb/serial/mos7840.c
> @@ -1201,7 +1201,7 @@ static void mos7840_change_port_settings(struct tty_struct *tty,
> {
> struct usb_serial_port *port = mos7840_port->port;
> int baud;
> - unsigned cflag;
> + unsigned int cflag;
Just drop this one too.
You can follow this style suggestion in your own code, but there's
really no need to go around changing perfectly valid code just to
silence checkpatch.
Johan
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 6/6] drivers: usb: serial: mos7840: fix the quoted string split across lines
2024-10-24 17:58 ` kernel test robot
` (5 preceding siblings ...)
2024-10-25 6:17 ` [PATCH v2 5/6] drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int' Tony Chung
@ 2024-10-25 6:17 ` Tony Chung
2025-02-11 9:32 ` Johan Hovold
6 siblings, 1 reply; 22+ messages in thread
From: Tony Chung @ 2024-10-25 6:17 UTC (permalink / raw)
To: johan; +Cc: gregkh, linux-kernel, linux-usb, Tony Chung
fix the coding style warning: quoted string split across lines
Signed-off-by: Tony Chung <tony467913@gmail.com>
---
drivers/usb/serial/mos7840.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
index d2cae6619..e3100ebbc 100644
--- a/drivers/usb/serial/mos7840.c
+++ b/drivers/usb/serial/mos7840.c
@@ -920,8 +920,9 @@ static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
if (status) {
mos7840_port->busy[i] = 0;
- dev_err_console(port, "%s - usb_submit_urb(write bulk) failed "
- "with status = %d\n", __func__, status);
+ dev_err_console(port,
+ "%s - usb_submit_urb(write bulk) failed with status = %d\n",
+ __func__, status);
bytes_sent = status;
goto exit;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH] usb: serial: mos7840: Fix coding style warnings
2024-10-23 9:14 [PATCH] usb: serial: mos7840: Fix coding style warnings Tony Chung
` (2 preceding siblings ...)
2024-10-24 17:58 ` kernel test robot
@ 2024-10-25 7:49 ` kernel test robot
2024-10-28 5:27 ` Tony Chung
3 siblings, 1 reply; 22+ messages in thread
From: kernel test robot @ 2024-10-25 7:49 UTC (permalink / raw)
To: Tony Chung, johan
Cc: oe-kbuild-all, gregkh, linux-usb, linux-kernel, Tony Chung
Hi Tony,
kernel test robot noticed the following build errors:
[auto build test ERROR on johan-usb-serial/usb-next]
[also build test ERROR on johan-usb-serial/usb-linus usb/usb-testing usb/usb-next usb/usb-linus tty/tty-testing tty/tty-next tty/tty-linus linus/master v6.12-rc4 next-20241024]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Tony-Chung/usb-serial-mos7840-Fix-coding-style-warnings/20241023-171615
base: https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git usb-next
patch link: https://lore.kernel.org/r/20241023091414.18098-1-tony467913%40gmail.com
patch subject: [PATCH] usb: serial: mos7840: Fix coding style warnings
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20241025/202410251501.9hTgSYCH-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241025/202410251501.9hTgSYCH-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410251501.9hTgSYCH-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/usb/serial/mos7840.c: In function 'mos7840_write':
>> drivers/usb/serial/mos7840.c:923:39: warning: missing terminating " character
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^
drivers/usb/serial/mos7840.c:924:43: warning: missing terminating " character
924 | with status = %d\n", __func__, status);
| ^
>> drivers/usb/serial/mos7840.c:1832:23: error: unterminated argument list invoking macro "dev_err_console"
1832 | MODULE_LICENSE("GPL");
| ^
>> drivers/usb/serial/mos7840.c:923:17: error: 'dev_err_console' undeclared (first use in this function); did you mean 'dev_err_probe'?
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^~~~~~~~~~~~~~~
| dev_err_probe
drivers/usb/serial/mos7840.c:923:17: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/usb/serial/mos7840.c:923:32: error: expected ';' at end of input
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^
| ;
......
>> drivers/usb/serial/mos7840.c:923:17: error: expected declaration or statement at end of input
923 | dev_err_console(port, "%s - usb_submit_urb(write bulk) failed
| ^~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:923:17: error: expected declaration or statement at end of input
>> drivers/usb/serial/mos7840.c:887:25: error: label 'exit' used but not defined
887 | goto exit;
| ^~~~
>> drivers/usb/serial/mos7840.c:856:13: warning: variable 'bytes_sent' set but not used [-Wunused-but-set-variable]
856 | int bytes_sent = 0;
| ^~~~~~~~~~
drivers/usb/serial/mos7840.c: At top level:
>> drivers/usb/serial/mos7840.c:849:12: warning: 'mos7840_write' defined but not used [-Wunused-function]
849 | static int mos7840_write(struct tty_struct *tty, struct usb_serial_port *port,
| ^~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:820:21: warning: 'mos7840_write_room' defined but not used [-Wunused-function]
820 | static unsigned int mos7840_write_room(struct tty_struct *tty)
| ^~~~~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:795:12: warning: 'mos7840_break' defined but not used [-Wunused-function]
795 | static int mos7840_break(struct tty_struct *tty, int break_state)
| ^~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:764:13: warning: 'mos7840_close' defined but not used [-Wunused-function]
764 | static void mos7840_close(struct usb_serial_port *port)
| ^~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:737:21: warning: 'mos7840_chars_in_buffer' defined but not used [-Wunused-function]
737 | static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty)
| ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:516:12: warning: 'mos7840_open' defined but not used [-Wunused-function]
516 | static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
| ^~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:410:13: warning: 'mos7840_led_flag_off' defined but not used [-Wunused-function]
410 | static void mos7840_led_flag_off(struct timer_list *t)
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:400:13: warning: 'mos7840_led_off' defined but not used [-Wunused-function]
400 | static void mos7840_led_off(struct timer_list *t)
| ^~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:391:13: warning: 'mos7840_set_led_sync' defined but not used [-Wunused-function]
391 | static void mos7840_set_led_sync(struct usb_serial_port *port, __u16 reg,
| ^~~~~~~~~~~~~~~~~~~~
>> drivers/usb/serial/mos7840.c:337:13: warning: 'mos7840_dump_serial_port' defined but not used [-Wunused-function]
337 | static void mos7840_dump_serial_port(struct usb_serial_port *port,
| ^~~~~~~~~~~~~~~~~~~~~~~~
vim +/dev_err_console +1832 drivers/usb/serial/mos7840.c
3f5429746d91f2 Paul B Schroeder 2006-08-31 1830
3f5429746d91f2 Paul B Schroeder 2006-08-31 1831 MODULE_DESCRIPTION(DRIVER_DESC);
3f5429746d91f2 Paul B Schroeder 2006-08-31 @1832 MODULE_LICENSE("GPL");
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-02-11 9:38 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-23 9:14 [PATCH] usb: serial: mos7840: Fix coding style warnings Tony Chung
2024-10-23 10:04 ` Greg KH
2024-10-24 17:37 ` kernel test robot
2024-10-24 17:58 ` kernel test robot
2024-10-25 6:17 ` [PATCH v2 0/6] " Tony Chung
2025-02-11 9:15 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 1/6] driver: usb: serial: mos7840: fix " Tony Chung
2025-02-11 9:20 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 2/6] drivers: usb: serial: mos7840: Fix Block comments coding " Tony Chung
2025-02-11 9:27 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 3/6] drivers: usb: serial: mos7840: fix " Tony Chung
2025-02-11 9:28 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 4/6] drivers: usb: serial: mos7840: using '__func__' to replace function name in dbg message Tony Chung
2025-02-11 9:29 ` Johan Hovold
2025-02-11 9:32 ` Greg KH
2025-02-11 9:38 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 5/6] drivers: usb: serial: mos7840: replace 'unsigned' w/ 'unsigned int' Tony Chung
2025-02-11 9:31 ` Johan Hovold
2024-10-25 6:17 ` [PATCH v2 6/6] drivers: usb: serial: mos7840: fix the quoted string split across lines Tony Chung
2025-02-11 9:32 ` Johan Hovold
2024-10-25 7:49 ` [PATCH] usb: serial: mos7840: Fix coding style warnings kernel test robot
2024-10-28 5:27 ` Tony Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox