Message ID | 20241023091414.18098-1-tony467913@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | usb: serial: mos7840: Fix coding style warnings | expand |
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
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
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
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");
I've sent the PATCH v2 which has fixed this build error. please check from the link below. Thanks. https://lore.kernel.org/lkml/20241025061711.198933-1-tony467913@gmail.com/
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);
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(-)