From 642aadf148573d0b6c43707593ff144e0aaea9a6 Mon Sep 17 00:00:00 2001 From: Paolo Perego Date: Wed, 20 Nov 2024 14:57:27 +0100 Subject: [PATCH 01/38] staging:fbtft: Using str_true_false() helper instead of hardcoded strings Using str_true_false() helper instead of hardcoded strings. Signed-off-by: Paolo Perego Link: https://lore.kernel.org/r/20241120135727.376556-1-pperego@suse.de Signed-off-by: Greg Kroah-Hartman --- drivers/staging/fbtft/fb_ssd1351.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fb_ssd1351.c b/drivers/staging/fbtft/fb_ssd1351.c index f6db2933ebba..6736b09b2f45 100644 --- a/drivers/staging/fbtft/fb_ssd1351.c +++ b/drivers/staging/fbtft/fb_ssd1351.c @@ -6,6 +6,7 @@ #include #include #include +#include #include "fbtft.h" @@ -162,7 +163,7 @@ static int set_gamma(struct fbtft_par *par, u32 *curves) static int blank(struct fbtft_par *par, bool on) { fbtft_par_dbg(DEBUG_BLANK, par, "(%s=%s)\n", - __func__, on ? "true" : "false"); + __func__, str_true_false(on)); if (on) write_reg(par, 0xAE); else From da6c337a8c075de5bf96139321fa4f67e004dd38 Mon Sep 17 00:00:00 2001 From: Marcelo Moreira Date: Sat, 23 Nov 2024 18:03:06 -0300 Subject: [PATCH 02/38] staging: rtl8723bs: change pointer initialization style Separated pdata and ptail initialization for clarity and to avoid potential issues. Signed-off-by: Marcelo Moreira Link: https://lore.kernel.org/r/20241123210329.70906-1-marcelomoreira1905@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_xmit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_xmit.c b/drivers/staging/rtl8723bs/core/rtw_xmit.c index 699cff7b0ac9..297c93d65315 100644 --- a/drivers/staging/rtl8723bs/core/rtw_xmit.c +++ b/drivers/staging/rtl8723bs/core/rtw_xmit.c @@ -1467,7 +1467,8 @@ struct xmit_buf *rtw_alloc_xmitbuf_ext(struct xmit_priv *pxmitpriv) pxmitbuf->priv_data = NULL; pxmitbuf->len = 0; - pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; + pxmitbuf->pdata = pxmitbuf->phead; + pxmitbuf->ptail = pxmitbuf->phead; pxmitbuf->agg_num = 1; if (pxmitbuf->sctx) @@ -1526,7 +1527,8 @@ struct xmit_buf *rtw_alloc_xmitbuf(struct xmit_priv *pxmitpriv) pxmitbuf->priv_data = NULL; pxmitbuf->len = 0; - pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead; + pxmitbuf->pdata = pxmitbuf->phead; + pxmitbuf->ptail = pxmitbuf->phead; pxmitbuf->agg_num = 0; pxmitbuf->pg_num = 0; From 724cc0cc17d9431f59b69f1e1d22c880c1e7ba60 Mon Sep 17 00:00:00 2001 From: Prarit Bhargava Date: Mon, 2 Dec 2024 11:03:57 -0500 Subject: [PATCH 03/38] staging: Fix tnt4882 license to be SPDX compliant "GPL-2" is not a valid SPDX license identifier[1]. Update to SPDX compliant string "GPL-2.0-only". [1] https://spdx.org/licenses Signed-off-by: Prarit Bhargava Cc: Dave Penkler Cc: Rohit Chavan Signed-off-by: Prarit Bhargava Link: https://lore.kernel.org/r/20241202160404.262993-1-prarit@redhat.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/tnt4882/mite.c | 2 +- drivers/staging/gpib/tnt4882/mite.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gpib/tnt4882/mite.c b/drivers/staging/gpib/tnt4882/mite.c index 0edf34d243e9..90341f8c394e 100644 --- a/drivers/staging/gpib/tnt4882/mite.c +++ b/drivers/staging/gpib/tnt4882/mite.c @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: GPL-2 +// SPDX-License-Identifier: GPL-2.0-only /* * Hardware driver for NI Mite PCI interface chip, diff --git a/drivers/staging/gpib/tnt4882/mite.h b/drivers/staging/gpib/tnt4882/mite.h index 6454d069b8cc..fb84eaa83de3 100644 --- a/drivers/staging/gpib/tnt4882/mite.h +++ b/drivers/staging/gpib/tnt4882/mite.h @@ -1,4 +1,4 @@ -/* SPDX-License-Identifier: GPL-2 */ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * Hardware driver for NI Mite PCI interface chip From 2ff5bc6f5b4bb531907a9a2f57aec764c57fd4cb Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Wed, 4 Dec 2024 15:57:10 +0100 Subject: [PATCH 04/38] staging: gpib: Remove useless include linux/version.h not needed. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202410102259.zcoS9Eiu-lkp@intel.com/ Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20241204145713.11889-2-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index 796c3a5be545..9a3271e885d2 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -10,7 +10,6 @@ /* base module includes */ -#include #include #include #include From 0a4edbeef1e415f2eeaaae01b129f53f33c24d95 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Wed, 4 Dec 2024 15:57:11 +0100 Subject: [PATCH 05/38] staging: gpib: Remove duplicate include linux/uaccess.h is included more than once. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202410110406.mQENnj09-lkp@intel.com/ Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20241204145713.11889-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index 9a3271e885d2..47db17418a74 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include "gpibP.h" From a99e5c8853f4b018b003641ad532059169e271a5 Mon Sep 17 00:00:00 2001 From: Chenguang Zhao Date: Thu, 5 Dec 2024 10:16:10 +0800 Subject: [PATCH 06/38] staging: rtl8723bs: Cleanups for rtw_inc_and_chk_continual_io_error There's a warning when using checkpatch.pl check rtw_io.c: WARNING: Missing a blank line after declarations 146: FILE: drivers/staging/rtl8723bs/core/rtw_io.c:146: int value = atomic_inc_return(&dvobj->continual_io_error); if (value > MAX_CONTINUAL_IO_ERR) The patch fixes it. In addition, also rename 'value' variable to 'error_count' and drop 'ret' variable. Signed-off-by: Chenguang Zhao Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20241205021610.523528-1-zhaochenguang@kylinos.cn Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_io.c b/drivers/staging/rtl8723bs/core/rtw_io.c index fcda9db6ebb5..79d543d88278 100644 --- a/drivers/staging/rtl8723bs/core/rtw_io.c +++ b/drivers/staging/rtl8723bs/core/rtw_io.c @@ -141,12 +141,12 @@ int rtw_init_io_priv(struct adapter *padapter, void (*set_intf_ops)(struct adapt */ int rtw_inc_and_chk_continual_io_error(struct dvobj_priv *dvobj) { - int ret = false; - int value = atomic_inc_return(&dvobj->continual_io_error); - if (value > MAX_CONTINUAL_IO_ERR) - ret = true; + int error_count = atomic_inc_return(&dvobj->continual_io_error); - return ret; + if (error_count > MAX_CONTINUAL_IO_ERR) + return true; + + return false; } /* From 2bc2c3640039520d7cc0ea1e4c91fb0a8126fdda Mon Sep 17 00:00:00 2001 From: Rodrigo Gobbi Date: Wed, 11 Dec 2024 20:26:39 -0300 Subject: [PATCH 07/38] staging: rtl8723bs: delete DBG_RX_SIGNAL_DISPLAY_RAW_DATA ifdef code remove code depending on cflag since it's not compiling and there is no reference for it's usage; Signed-off-by: Rodrigo Gobbi Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20241211233415.37702-2-rodrigo.gobbi.7@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/hal/hal_com.c | 53 ------------------- .../staging/rtl8723bs/hal/rtl8723b_rxdesc.c | 4 -- drivers/staging/rtl8723bs/include/hal_com.h | 5 -- drivers/staging/rtl8723bs/include/rtw_recv.h | 18 ------- 4 files changed, 80 deletions(-) diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 95fb38283c58..1803c0cd3a7e 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -683,12 +683,6 @@ u8 SetHalDefVar( switch (variable) { case HAL_DEF_DBG_RX_INFO_DUMP: - - if (odm->bLinked) { - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA - rtw_dump_raw_rssi_info(adapter); - #endif - } break; case HW_DEF_ODM_DBG_FLAG: ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_COMP, *((u64 *)value)); @@ -879,53 +873,6 @@ void rtw_hal_check_rxfifo_full(struct adapter *adapter) } } -#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA -void rtw_dump_raw_rssi_info(struct adapter *padapter) -{ - u8 isCCKrate, rf_path; - struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; - - isCCKrate = psample_pkt_rssi->data_rate <= DESC_RATE11M; - - if (isCCKrate) - psample_pkt_rssi->mimo_signal_strength[0] = psample_pkt_rssi->pwdball; - - for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { - if (!isCCKrate) { - netdev_dbg(padapter->pnetdev, ", rx_ofdm_pwr:%d(dBm), rx_ofdm_snr:%d(dB)\n", - psample_pkt_rssi->ofdm_pwr[rf_path], - psample_pkt_rssi->ofdm_snr[rf_path]); - } - } -} - -void rtw_store_phy_info(struct adapter *padapter, union recv_frame *prframe) -{ - u8 isCCKrate, rf_path; - struct hal_com_data *pHalData = GET_HAL_DATA(padapter); - struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib; - - struct odm_phy_info *pPhyInfo = (PODM_PHY_INFO_T)(&pattrib->phy_info); - struct rx_raw_rssi *psample_pkt_rssi = &padapter->recvpriv.raw_rssi_info; - - psample_pkt_rssi->data_rate = pattrib->data_rate; - isCCKrate = pattrib->data_rate <= DESC_RATE11M; - - psample_pkt_rssi->pwdball = pPhyInfo->rx_pwd_ba11; - psample_pkt_rssi->pwr_all = pPhyInfo->recv_signal_power; - - for (rf_path = 0; rf_path < pHalData->NumTotalRFPath; rf_path++) { - psample_pkt_rssi->mimo_signal_strength[rf_path] = pPhyInfo->rx_mimo_signal_strength[rf_path]; - psample_pkt_rssi->mimo_signal_quality[rf_path] = pPhyInfo->rx_mimo_signal_quality[rf_path]; - if (!isCCKrate) { - psample_pkt_rssi->ofdm_pwr[rf_path] = pPhyInfo->RxPwr[rf_path]; - psample_pkt_rssi->ofdm_snr[rf_path] = pPhyInfo->RxSNR[rf_path]; - } - } -} -#endif - static u32 Array_kfreemap[] = { 0xf8, 0xe, 0xf6, 0xc, diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_rxdesc.c b/drivers/staging/rtl8723bs/hal/rtl8723b_rxdesc.c index 717faebf8aca..db3d7d72bffa 100644 --- a/drivers/staging/rtl8723bs/hal/rtl8723b_rxdesc.c +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_rxdesc.c @@ -67,8 +67,4 @@ void rtl8723b_process_phy_info(struct adapter *padapter, void *prframe) /* Check EVM */ /* */ process_link_qual(padapter, precvframe); - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA - rtw_store_phy_info(padapter, prframe); - #endif - } diff --git a/drivers/staging/rtl8723bs/include/hal_com.h b/drivers/staging/rtl8723bs/include/hal_com.h index 4db93484725f..258a74076dd9 100644 --- a/drivers/staging/rtl8723bs/include/hal_com.h +++ b/drivers/staging/rtl8723bs/include/hal_com.h @@ -149,11 +149,6 @@ bool eqNByte(u8 *str1, u8 *str2, u32 num); bool GetU1ByteIntegerFromStringInDecimal(char *str, u8 *in); -#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA -void rtw_store_phy_info(struct adapter *padapter, union recv_frame *prframe); -void rtw_dump_raw_rssi_info(struct adapter *padapter); -#endif - #define HWSET_MAX_SIZE 512 void rtw_bb_rf_gain_offset(struct adapter *padapter); diff --git a/drivers/staging/rtl8723bs/include/rtw_recv.h b/drivers/staging/rtl8723bs/include/rtw_recv.h index 18dd1464e0c2..aa9f9d5ecd01 100644 --- a/drivers/staging/rtl8723bs/include/rtw_recv.h +++ b/drivers/staging/rtl8723bs/include/rtw_recv.h @@ -89,21 +89,6 @@ struct phy_info { u8 btCoexPwrAdjust; }; -#ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA -struct rx_raw_rssi { - u8 data_rate; - u8 pwdball; - s8 pwr_all; - - u8 mimo_signal_strength[4];/* in 0~100 index */ - u8 mimo_signal_quality[4]; - - s8 ofdm_pwr[4]; - u8 ofdm_snr[4]; - -}; -#endif - struct rx_pkt_attrib { u16 pkt_len; u8 physt; @@ -221,9 +206,6 @@ struct recv_priv { u8 signal_strength; u8 signal_qual; s8 rssi; /* translate_percentage_to_dbm(ptarget_wlan->network.PhyInfo.SignalStrength); */ - #ifdef DBG_RX_SIGNAL_DISPLAY_RAW_DATA - struct rx_raw_rssi raw_rssi_info; - #endif /* s8 rxpwdb; */ s16 noise; /* int RxSNRdB[2]; */ From 716eefc88c2f784ef16395d6a3eea8670847bba4 Mon Sep 17 00:00:00 2001 From: Rodrigo Gobbi Date: Wed, 11 Dec 2024 20:26:40 -0300 Subject: [PATCH 08/38] staging: rtl8723bs: delete HAL_DEF_DBG_RX_INFO_DUMP enum and caller After removing code isolated by DBG_RX_SIGNAL_DISPLAY_RAW_DATA cflag, HAL_DEF_DBG_RX_INFO_DUMP enum lost it's use. Removing the enum and the caller. Signed-off-by: Rodrigo Gobbi Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20241211233415.37702-3-rodrigo.gobbi.7@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 1 - drivers/staging/rtl8723bs/hal/hal_com.c | 2 -- drivers/staging/rtl8723bs/include/hal_intf.h | 1 - 3 files changed, 4 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c index 317f3db19397..952ce6dd5af9 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c @@ -4959,7 +4959,6 @@ void _linked_info_dump(struct adapter *padapter) rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &i); } } - rtw_hal_set_def_var(padapter, HAL_DEF_DBG_RX_INFO_DUMP, NULL); } } diff --git a/drivers/staging/rtl8723bs/hal/hal_com.c b/drivers/staging/rtl8723bs/hal/hal_com.c index 1803c0cd3a7e..b41ec89932af 100644 --- a/drivers/staging/rtl8723bs/hal/hal_com.c +++ b/drivers/staging/rtl8723bs/hal/hal_com.c @@ -682,8 +682,6 @@ u8 SetHalDefVar( u8 bResult = _SUCCESS; switch (variable) { - case HAL_DEF_DBG_RX_INFO_DUMP: - break; case HW_DEF_ODM_DBG_FLAG: ODM_CmnInfoUpdate(odm, ODM_CMNINFO_DBG_COMP, *((u64 *)value)); break; diff --git a/drivers/staging/rtl8723bs/include/hal_intf.h b/drivers/staging/rtl8723bs/include/hal_intf.h index 282e141616b0..85de862823c2 100644 --- a/drivers/staging/rtl8723bs/include/hal_intf.h +++ b/drivers/staging/rtl8723bs/include/hal_intf.h @@ -144,7 +144,6 @@ enum hal_def_variable { HAL_DEF_PCI_AMD_L1_SUPPORT, HAL_DEF_PCI_ASPM_OSC, /* Support for ASPM OSC, added by Roger, 2013.03.27. */ HAL_DEF_MACID_SLEEP, /* Support for MACID sleep */ - HAL_DEF_DBG_RX_INFO_DUMP, }; enum hal_odm_variable { From 5d4db9cf4135d82634c7f31aac73081fba3a356e Mon Sep 17 00:00:00 2001 From: Santosh Mahto Date: Thu, 12 Dec 2024 21:51:04 +0530 Subject: [PATCH 09/38] staging: gpib: Replace semaphore with completion for one-time signaling Replaced 'down_interruptible()' and 'up()' calls with 'wait_for_completion_interruptible()' and 'complete()' respectively. The completion API simplifies the code and adheres to kernel best practices for synchronization primitive Signed-off-by: Santosh Mahto Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20241212162112.13083-1-eisantosh95@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 16 ++++++++-------- drivers/staging/gpib/ni_usb/ni_usb_gpib.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c index b7b6fb1be379..70b8b305e13b 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -85,7 +85,7 @@ static void ni_usb_bulk_complete(struct urb *urb) // printk("debug: %s: status=0x%x, error_count=%i, actual_length=%i\n", __func__, // urb->status, urb->error_count, urb->actual_length); - up(&context->complete); + complete(&context->complete); } static void ni_usb_timeout_handler(struct timer_list *t) @@ -94,7 +94,7 @@ static void ni_usb_timeout_handler(struct timer_list *t) struct ni_usb_urb_ctx *context = &ni_priv->context; context->timed_out = 1; - up(&context->complete); + complete(&context->complete); }; // I'm using nonblocking loosely here, it only means -EAGAIN can be returned in certain cases @@ -124,7 +124,7 @@ static int ni_usb_nonblocking_send_bulk_msg(struct ni_usb_priv *ni_priv, void *d } usb_dev = interface_to_usbdev(ni_priv->bus_interface); out_pipe = usb_sndbulkpipe(usb_dev, ni_priv->bulk_out_endpoint); - sema_init(&context->complete, 0); + init_completion(&context->complete); context->timed_out = 0; usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, out_pipe, data, data_length, &ni_usb_bulk_complete, context); @@ -143,7 +143,7 @@ static int ni_usb_nonblocking_send_bulk_msg(struct ni_usb_priv *ni_priv, void *d return retval; } mutex_unlock(&ni_priv->bulk_transfer_lock); - down(&context->complete); // wait for ni_usb_bulk_complete + wait_for_completion(&context->complete); // wait for ni_usb_bulk_complete if (context->timed_out) { usb_kill_urb(ni_priv->bulk_urb); dev_err(&usb_dev->dev, "%s: killed urb due to timeout\n", __func__); @@ -210,7 +210,7 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct ni_usb_priv *ni_priv, } usb_dev = interface_to_usbdev(ni_priv->bus_interface); in_pipe = usb_rcvbulkpipe(usb_dev, ni_priv->bulk_in_endpoint); - sema_init(&context->complete, 0); + init_completion(&context->complete); context->timed_out = 0; usb_fill_bulk_urb(ni_priv->bulk_urb, usb_dev, in_pipe, data, data_length, &ni_usb_bulk_complete, context); @@ -231,7 +231,7 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct ni_usb_priv *ni_priv, } mutex_unlock(&ni_priv->bulk_transfer_lock); if (interruptible) { - if (down_interruptible(&context->complete)) { + if (wait_for_completion_interruptible(&context->complete)) { /* If we got interrupted by a signal while * waiting for the usb gpib to respond, we * should send a stop command so it will @@ -243,10 +243,10 @@ static int ni_usb_nonblocking_receive_bulk_msg(struct ni_usb_priv *ni_priv, /* now do an uninterruptible wait, it shouldn't take long * for the board to respond now. */ - down(&context->complete); + wait_for_completion(&context->complete); } } else { - down(&context->complete); + wait_for_completion(&context->complete); } if (context->timed_out) { usb_kill_urb(ni_priv->bulk_urb); diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.h b/drivers/staging/gpib/ni_usb/ni_usb_gpib.h index 9b21dfa0f3f6..4b297db09a9b 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.h +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.h @@ -56,7 +56,7 @@ enum hs_plus_endpoint_addresses { }; struct ni_usb_urb_ctx { - struct semaphore complete; + struct completion complete; unsigned timed_out : 1; }; From 33bd6465275a11d4dbeceb9fe1b439d54e14fafe Mon Sep 17 00:00:00 2001 From: Antonio Riccio Date: Thu, 26 Dec 2024 10:38:31 +0000 Subject: [PATCH 10/38] staging: vme_user: vme_tsi148.c: avoid parenthesis line ending Adhere to Linux Kernel coding style. Reported by checkpatch CHECK: Lines should not end with a '(' Signed-off-by: Antonio Riccio Link: https://lore.kernel.org/r/Z20yIvcQOGHMfufx@stream-circuit Signed-off-by: Greg Kroah-Hartman --- drivers/staging/vme_user/vme_tsi148.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/vme_user/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c index 31a44025e08f..733594dde9ae 100644 --- a/drivers/staging/vme_user/vme_tsi148.c +++ b/drivers/staging/vme_user/vme_tsi148.c @@ -761,8 +761,7 @@ static int tsi148_alloc_resource(struct vme_master_resource *image, goto err_resource; } - image->kern_base = ioremap( - image->bus_resource.start, size); + image->kern_base = ioremap(image->bus_resource.start, size); if (!image->kern_base) { dev_err(tsi148_bridge->parent, "Failed to remap resource\n"); retval = -ENOMEM; From e999bd2a897e7d70fa1fca6b80873529532322fe Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:21 +0530 Subject: [PATCH 11/38] staging: gpib: Modify gpib_register_driver() to return error if it fails The function gpib_register_driver() can fail if kmalloc() fails, but it doesn't return any error if that happens. Modify the function to return error i.e int. Return the appropriate error code if it fails. Remove the pr_info() statement. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-2-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/common/gpib_os.c | 7 ++++--- drivers/staging/gpib/include/gpibP.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c index 405237d8cb47..07795df3b721 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -2094,18 +2094,19 @@ void init_gpib_descriptor(gpib_descriptor_t *desc) atomic_set(&desc->io_in_progress, 0); } -void gpib_register_driver(gpib_interface_t *interface, struct module *provider_module) +int gpib_register_driver(gpib_interface_t *interface, struct module *provider_module) { struct gpib_interface_list_struct *entry; entry = kmalloc(sizeof(*entry), GFP_KERNEL); if (!entry) - return; + return -ENOMEM; entry->interface = interface; entry->module = provider_module; list_add(&entry->list, ®istered_drivers); - pr_info("gpib: registered %s interface\n", interface->name); + + return 0; } EXPORT_SYMBOL(gpib_register_driver); diff --git a/drivers/staging/gpib/include/gpibP.h b/drivers/staging/gpib/include/gpibP.h index 5fc42b645ab7..d0cd42c1a0ad 100644 --- a/drivers/staging/gpib/include/gpibP.h +++ b/drivers/staging/gpib/include/gpibP.h @@ -17,7 +17,7 @@ #include #include -void gpib_register_driver(gpib_interface_t *interface, struct module *mod); +int gpib_register_driver(gpib_interface_t *interface, struct module *mod); void gpib_unregister_driver(gpib_interface_t *interface); struct pci_dev *gpib_pci_get_device(const gpib_board_config_t *config, unsigned int vendor_id, unsigned int device_id, struct pci_dev *from); From f546fa464031423be3dbebc966ad4703f985c9d5 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:22 +0530 Subject: [PATCH 12/38] staging: gpib: agilent_82350b: Handle gpib_register_driver() errors The function gpib_register_driver() can fail which can result in semi-registered module. In case gpib_register_driver() fails unregister the previous gpib and pci registering functions, return the error value. Add pr_err() when registering driver fails also indicate the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-3-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../gpib/agilent_82350b/agilent_82350b.c | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c index 53006d0cc79c..e9c1f0100b2a 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c @@ -910,13 +910,30 @@ static int __init agilent_82350b_init_module(void) result = pci_register_driver(&agilent_82350b_pci_driver); if (result) { - pr_err("agilent_82350b: pci_driver_register failed!\n"); + pr_err("agilent_82350b: pci_register_driver failed: error = %d\n", result); return result; } - gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE); - gpib_register_driver(&agilent_82350b_interface, THIS_MODULE); + result = gpib_register_driver(&agilent_82350b_unaccel_interface, THIS_MODULE); + if (result) { + pr_err("agilent_82350b: gpib_register_driver failed: error = %d\n", result); + goto err_unaccel; + } + + result = gpib_register_driver(&agilent_82350b_interface, THIS_MODULE); + if (result) { + pr_err("agilent_82350b: gpib_register_driver failed: error = %d\n", result); + goto err_interface; + } + return 0; + +err_interface: + gpib_unregister_driver(&agilent_82350b_unaccel_interface); +err_unaccel: + pci_unregister_driver(&agilent_82350b_pci_driver); + + return result; } static void __exit agilent_82350b_exit_module(void) From 9e43ebc613e2adb9b9e900e11a4099e104b61f2d Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:23 +0530 Subject: [PATCH 13/38] staging: gpib: agilent_82357a: Handle gpib_register_driver() errors The usb_register() function can fail and returns an error value which is not returned. The function gpib_register_driver() can also fail which can result in semi-registered module. In case gpib_register_driver() fails unregister the previous usb driver registering function. Return the error value if gpib_register_driver() or usb_register() functions fail. Add pr_err when registering driver fails also indicating the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-4-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../staging/gpib/agilent_82357a/agilent_82357a.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c index bf05fb4a736b..261fb6d2e991 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -1691,12 +1691,24 @@ static struct usb_driver agilent_82357a_bus_driver = { static int __init agilent_82357a_init_module(void) { int i; + int ret; pr_info("agilent_82357a_gpib driver loading"); for (i = 0; i < MAX_NUM_82357A_INTERFACES; ++i) agilent_82357a_driver_interfaces[i] = NULL; - usb_register(&agilent_82357a_bus_driver); - gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE); + + ret = usb_register(&agilent_82357a_bus_driver); + if (ret) { + pr_err("agilent_82357a: usb_register failed: error = %d\n", ret); + return ret; + } + + ret = gpib_register_driver(&agilent_82357a_gpib_interface, THIS_MODULE); + if (ret) { + pr_err("agilent_82357a: gpib_register_driver failed: error = %d\n", ret); + usb_deregister(&agilent_82357a_bus_driver); + return ret; + } return 0; } From 65aff9b75bbda0d9f71130d3be2f3f76db193966 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:24 +0530 Subject: [PATCH 14/38] staging: gpib: cb7210: Handle gpib_register_driver() errors The function cb_pcmcia_init_module() can be replaced by calling pcmcia_register_driver() directly. The error value from this function is not returned and the previous registering functions are not unregistered. The function gpib_register_driver() can fail and similar to pcmcia_register_driver() function failing, the previous registering functions are not unregistered. Replace cb_pcmcia_init_module() with pcmcia_register_driver(). Unregister the gpib and pci register functions if the subsequent gpib or pcmcia register functions fail and return the error value. Add pr_err() statements to indicate the fail and also the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-5-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/cb7210/cb7210.c | 114 +++++++++++++++++++++------ 1 file changed, 89 insertions(+), 25 deletions(-) diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c index 63df7f3eb3f3..45a54219ea6d 100644 --- a/drivers/staging/gpib/cb7210/cb7210.c +++ b/drivers/staging/gpib/cb7210/cb7210.c @@ -1351,12 +1351,6 @@ static struct pcmcia_driver cb_gpib_cs_driver = { .resume = cb_gpib_resume, }; -int cb_pcmcia_init_module(void) -{ - pcmcia_register_driver(&cb_gpib_cs_driver); - return 0; -} - void cb_pcmcia_cleanup_module(void) { DEBUG(0, "cb_gpib_cs: unloading\n"); @@ -1506,32 +1500,102 @@ void cb_pcmcia_detach(gpib_board_t *board) static int __init cb7210_init_module(void) { - int err = 0; - int result; + int ret; - result = pci_register_driver(&cb7210_pci_driver); - if (result) { - pr_err("cb7210: pci_driver_register failed!\n"); - return result; + ret = pci_register_driver(&cb7210_pci_driver); + if (ret) { + pr_err("cb7210: pci_register_driver failed: error = %d\n", ret); + return ret; } - gpib_register_driver(&cb_pci_interface, THIS_MODULE); - gpib_register_driver(&cb_isa_interface, THIS_MODULE); - gpib_register_driver(&cb_pci_accel_interface, THIS_MODULE); - gpib_register_driver(&cb_pci_unaccel_interface, THIS_MODULE); - gpib_register_driver(&cb_isa_accel_interface, THIS_MODULE); - gpib_register_driver(&cb_isa_unaccel_interface, THIS_MODULE); + ret = gpib_register_driver(&cb_pci_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_pci; + } -#ifdef GPIB__PCMCIA - gpib_register_driver(&cb_pcmcia_interface, THIS_MODULE); - gpib_register_driver(&cb_pcmcia_accel_interface, THIS_MODULE); - gpib_register_driver(&cb_pcmcia_unaccel_interface, THIS_MODULE); - err += cb_pcmcia_init_module(); + ret = gpib_register_driver(&cb_isa_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_isa; + } + + ret = gpib_register_driver(&cb_pci_accel_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_pci_accel; + } + + ret = gpib_register_driver(&cb_pci_unaccel_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_pci_unaccel; + } + + ret = gpib_register_driver(&cb_isa_accel_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_isa_accel; + } + + ret = gpib_register_driver(&cb_isa_unaccel_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_isa_unaccel; + } + +#ifdef GPIB_PCMCIA + ret = gpib_register_driver(&cb_pcmcia_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_pcmcia; + } + + ret = gpib_register_driver(&cb_pcmcia_accel_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_pcmcia_accel; + } + + ret = gpib_register_driver(&cb_pcmcia_unaccel_interface, THIS_MODULE); + if (ret) { + pr_err("cb7210: gpib_register_driver failed: error = %d\n", ret); + goto err_pcmcia_unaccel; + } + + ret = pcmcia_register_driver(&cb_gpib_cs_driver); + if (ret) { + pr_err("cb7210: pcmcia_register_driver failed: error = %d\n", ret); + goto err_pcmcia_driver; + } #endif - if (err) - return -1; return 0; + +#ifdef GPIB_PCMCIA +err_pcmcia_driver: + gpib_unregister_driver(&cb_pcmcia_unaccel_interface); +err_pcmcia_unaccel: + gpib_unregister_driver(&cb_pcmcia_accel_interface); +err_pcmcia_accel: + gpib_unregister_driver(&cb_pcmcia_interface); +err_pcmcia: +#endif + gpib_unregister_driver(&cb_isa_unaccel_interface); +err_isa_unaccel: + gpib_unregister_driver(&cb_isa_accel_interface); +err_isa_accel: + gpib_unregister_driver(&cb_pci_unaccel_interface); +err_pci_unaccel: + gpib_unregister_driver(&cb_pci_accel_interface); +err_pci_accel: + gpib_unregister_driver(&cb_isa_interface); +err_isa: + gpib_unregister_driver(&cb_pci_interface); +err_pci: + pci_unregister_driver(&cb7210_pci_driver); + + return ret; } static void __exit cb7210_exit_module(void) From f07296bc75ba01bd260b8f805725b2217750b7e3 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:25 +0530 Subject: [PATCH 15/38] staging: gpib: cec: Handle gpib_register_driver() errors The function gpib_register_driver() can fail and result in a semi-registered module and does not return an error value if it fails. Unregister the pci registering function in case gpib_register_driver() fails and return the error value. Add pr_err() statements indicating the fail and also the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-6-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/cec/cec_gpib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gpib/cec/cec_gpib.c b/drivers/staging/gpib/cec/cec_gpib.c index 3dc933deb401..e5b0941872f5 100644 --- a/drivers/staging/gpib/cec/cec_gpib.c +++ b/drivers/staging/gpib/cec/cec_gpib.c @@ -365,11 +365,15 @@ static int __init cec_init_module(void) result = pci_register_driver(&cec_pci_driver); if (result) { - pr_err("cec_gpib: pci_driver_register failed!\n"); + pr_err("cec_gpib: pci_register_driver failed: error = %d\n", result); return result; } - gpib_register_driver(&cec_pci_interface, THIS_MODULE); + result = gpib_register_driver(&cec_pci_interface, THIS_MODULE); + if (result) { + pr_err("cec_gpib: gpib_register_driver failed: error = %d\n", result); + return result; + } return 0; } From cf95c0c4e06353e647520132bb90e1c2fea1ffb7 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:26 +0530 Subject: [PATCH 16/38] staging: gpib: fluke: Handle gpib_register_driver() errors The function gpib_register_driver() can fail, resulting in a semi-registered module and does not return an error value if it fails. Unregister the previous platform driver and gpib registering functions if subsequent gpib_register_driver() fail and return the error value. Add pr_err() statements indicating the fail and the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-7-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/eastwood/fluke_gpib.c | 32 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/drivers/staging/gpib/eastwood/fluke_gpib.c b/drivers/staging/gpib/eastwood/fluke_gpib.c index 3f938ab0c84d..875b3adcb584 100644 --- a/drivers/staging/gpib/eastwood/fluke_gpib.c +++ b/drivers/staging/gpib/eastwood/fluke_gpib.c @@ -1155,16 +1155,38 @@ static int __init fluke_init_module(void) result = platform_driver_register(&fluke_gpib_platform_driver); if (result) { - pr_err("fluke_gpib: platform_driver_register failed!\n"); + pr_err("fluke_gpib: platform_driver_register failed: error = %d\n", result); return result; } - gpib_register_driver(&fluke_unaccel_interface, THIS_MODULE); - gpib_register_driver(&fluke_hybrid_interface, THIS_MODULE); - gpib_register_driver(&fluke_interface, THIS_MODULE); + result = gpib_register_driver(&fluke_unaccel_interface, THIS_MODULE); + if (result) { + pr_err("fluke_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_unaccel; + } + + result = gpib_register_driver(&fluke_hybrid_interface, THIS_MODULE); + if (result) { + pr_err("fluke_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_hybrid; + } + + result = gpib_register_driver(&fluke_interface, THIS_MODULE); + if (result) { + pr_err("fluke_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_interface; + } - pr_info("fluke_gpib\n"); return 0; + +err_interface: + gpib_unregister_driver(&fluke_hybrid_interface); +err_hybrid: + gpib_unregister_driver(&fluke_unaccel_interface); +err_unaccel: + platform_driver_unregister(&fluke_gpib_platform_driver); + + return result; } static void __exit fluke_exit_module(void) From 10ca8c3b51f7ad557fdd1953eaad8b5a91774ecd Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:27 +0530 Subject: [PATCH 17/38] staging: gpib: fmh: Handle gpib_register_driver() errors The function gpib_register_driver() can fail, resulting in a semi-registered module and does not return an error value if it fails. Unregister the previous platform driver, pci and gpib registering functions if subsequent gpib_register_driver() fail and return the error value. Add pr_err() statements indicating the fail and also the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-8-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/fmh_gpib/fmh_gpib.c | 47 ++++++++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c index 62791db1c34a..90108ce0304a 100644 --- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c +++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c @@ -1691,23 +1691,54 @@ static int __init fmh_gpib_init_module(void) result = platform_driver_register(&fmh_gpib_platform_driver); if (result) { - pr_err("fmh_gpib: platform_driver_register failed!\n"); + pr_err("fmh_gpib: platform_driver_register failed: error = %d\n", result); return result; } result = pci_register_driver(&fmh_gpib_pci_driver); if (result) { - pr_err("fmh_gpib: pci_driver_register failed!\n"); - return result; + pr_err("fmh_gpib: pci_register_driver failed: error = %d\n", result); + goto err_pci_driver; } - gpib_register_driver(&fmh_gpib_unaccel_interface, THIS_MODULE); - gpib_register_driver(&fmh_gpib_interface, THIS_MODULE); - gpib_register_driver(&fmh_gpib_pci_unaccel_interface, THIS_MODULE); - gpib_register_driver(&fmh_gpib_pci_interface, THIS_MODULE); + result = gpib_register_driver(&fmh_gpib_unaccel_interface, THIS_MODULE); + if (result) { + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_unaccel; + } + + result = gpib_register_driver(&fmh_gpib_interface, THIS_MODULE); + if (result) { + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_interface; + } + + result = gpib_register_driver(&fmh_gpib_pci_unaccel_interface, THIS_MODULE); + if (result) { + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_pci_unaccel; + } + + result = gpib_register_driver(&fmh_gpib_pci_interface, THIS_MODULE); + if (result) { + pr_err("fmh_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_pci; + } - pr_info("fmh_gpib\n"); return 0; + +err_pci: + gpib_unregister_driver(&fmh_gpib_pci_unaccel_interface); +err_pci_unaccel: + gpib_unregister_driver(&fmh_gpib_interface); +err_interface: + gpib_unregister_driver(&fmh_gpib_unaccel_interface); +err_unaccel: + pci_unregister_driver(&fmh_gpib_pci_driver); +err_pci_driver: + platform_driver_unregister(&fmh_gpib_platform_driver); + + return result; } static void __exit fmh_gpib_exit_module(void) From 908ff8d49e725c6b29aa9fc2dbfd10fa87223492 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:28 +0530 Subject: [PATCH 18/38] staging: gpib: gpio: Return error value from gpib_register_driver() The function gpib_register_driver() can fail and does not return an error value if it fails. Return the error value if gpib_register_driver() fails. Add pr_err() statement indicating the fail and also the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-9-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/gpio/gpib_bitbang.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c index a2d562cbd65b..057f9264de34 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -1341,7 +1341,12 @@ return_to_local : bb_return_to_local, static int __init bb_init_module(void) { - gpib_register_driver(&bb_interface, THIS_MODULE); + int result = gpib_register_driver(&bb_interface, THIS_MODULE); + + if (result) { + pr_err("gpib_bitbang: gpib_register_driver failed: error = %d\n", result); + return result; + } dbg_printk(0, "module loaded with pin map \"%s\"%s\n", pin_map, (sn7516x_used) ? " and SN7516x driver support" : ""); From 4e12a0928978451f92f6c10f71ef251a082acb3f Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:29 +0530 Subject: [PATCH 19/38] staging: gpib: hp_82335: Return error value from gpib_register_driver() The function gpib_register_driver() can fail and does not return an error value if it fails. Return the error value if gpib_register_driver() fails. Add pr_err() statement indicating the fail and also the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-10-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/hp_82335/hp82335.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gpib/hp_82335/hp82335.c b/drivers/staging/gpib/hp_82335/hp82335.c index 40afe42aea47..45157ad65d53 100644 --- a/drivers/staging/gpib/hp_82335/hp82335.c +++ b/drivers/staging/gpib/hp_82335/hp82335.c @@ -325,7 +325,13 @@ void hp82335_detach(gpib_board_t *board) static int __init hp82335_init_module(void) { - gpib_register_driver(&hp82335_interface, THIS_MODULE); + int result = gpib_register_driver(&hp82335_interface, THIS_MODULE); + + if (result) { + pr_err("hp82335: gpib_register_driver failed: error = %d\n", result); + return result; + } + return 0; } From 44aaeb2c0843ea37f6235c173d2e8f8df3be1704 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:30 +0530 Subject: [PATCH 20/38] staging: gpib: hp_82341: Handle gpib_register_driver() errors The function gpib_register_driver() can fail, resulting in a semi-registered module and does not return an error value if it fails. Return the error value if the first gpib_register_driver() fails and if the second gpib_register_driver() fails unregister the first gpib_register_driver() and return the error value. Add pr_err() statements indicating the fail and the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-11-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/hp_82341/hp_82341.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gpib/hp_82341/hp_82341.c b/drivers/staging/gpib/hp_82341/hp_82341.c index 8ad1c885a9fb..4953dac1e177 100644 --- a/drivers/staging/gpib/hp_82341/hp_82341.c +++ b/drivers/staging/gpib/hp_82341/hp_82341.c @@ -807,8 +807,21 @@ MODULE_DEVICE_TABLE(pnp, hp_82341_pnp_table); static int __init hp_82341_init_module(void) { - gpib_register_driver(&hp_82341_unaccel_interface, THIS_MODULE); - gpib_register_driver(&hp_82341_interface, THIS_MODULE); + int ret; + + ret = gpib_register_driver(&hp_82341_unaccel_interface, THIS_MODULE); + if (ret) { + pr_err("hp_82341: gpib_register_driver failed: error = %d\n", ret); + return ret; + } + + ret = gpib_register_driver(&hp_82341_interface, THIS_MODULE); + if (ret) { + pr_err("hp_82341: gpib_register_driver failed: error = %d\n", ret); + gpib_unregister_driver(&hp_82341_unaccel_interface); + return ret; + } + return 0; } From 26098b787c3fd1de6ab40d26b6283c4a5e24543a Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:31 +0530 Subject: [PATCH 21/38] staging: gpib: ines: Handle gpib_register_driver() errors The function ines_pcmcia_init_module() can be replaced by calling pcmcia_register_driver() directly. The error value from this function is not returned and the previous registering functions are not unregistered. The function gpib_register_driver() can fail and similar to pcmcia_register_driver() function failing, the previous registering functions are not unregistered. Replace cb_pcmcia_init_module() with pcmcia_register_driver(). Unregister the gpib and pci register functions if the subsequent gpib or pcmcia register functions fail and return the error value. Add pr_err() statements indicating the fail and error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-12-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/ines/ines_gpib.c | 94 +++++++++++++++++++++------ 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c index 9d8387c3bf01..9d4bbb8e8a75 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -1227,12 +1227,6 @@ static struct pcmcia_driver ines_gpib_cs_driver = { .resume = ines_gpib_resume, }; -int ines_pcmcia_init_module(void) -{ - pcmcia_register_driver(&ines_gpib_cs_driver); - return 0; -} - void ines_pcmcia_cleanup_module(void) { DEBUG(0, "ines_cs: unloading\n"); @@ -1420,28 +1414,86 @@ void ines_pcmcia_detach(gpib_board_t *board) static int __init ines_init_module(void) { - int err = 0; + int ret; - err = pci_register_driver(&ines_pci_driver); - if (err) { - pr_err("ines_gpib: pci_driver_register failed!\n"); - return err; + ret = pci_register_driver(&ines_pci_driver); + if (ret) { + pr_err("ines_gpib: pci_register_driver failed: error = %d\n", ret); + return ret; + } + + ret = gpib_register_driver(&ines_pci_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pci; + } + + ret = gpib_register_driver(&ines_pci_unaccel_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pci_unaccel; + } + + ret = gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pci_accel; + } + + ret = gpib_register_driver(&ines_isa_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_isa; } - gpib_register_driver(&ines_pci_interface, THIS_MODULE); - gpib_register_driver(&ines_pci_unaccel_interface, THIS_MODULE); - gpib_register_driver(&ines_pci_accel_interface, THIS_MODULE); - gpib_register_driver(&ines_isa_interface, THIS_MODULE); #ifdef GPIB_PCMCIA - gpib_register_driver(&ines_pcmcia_interface, THIS_MODULE); - gpib_register_driver(&ines_pcmcia_unaccel_interface, THIS_MODULE); - gpib_register_driver(&ines_pcmcia_accel_interface, THIS_MODULE); - err += ines_pcmcia_init_module(); + ret = gpib_register_driver(&ines_pcmcia_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pcmcia; + } + + ret = gpib_register_driver(&ines_pcmcia_unaccel_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pcmcia_unaccel; + } + + ret = gpib_register_driver(&ines_pcmcia_accel_interface, THIS_MODULE); + if (ret) { + pr_err("ines_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pcmcia_accel; + } + + ret = pcmcia_register_driver(&ines_gpib_cs_driver); + if (ret) { + pr_err("ines_gpib: pcmcia_register_driver failed: error = %d\n", ret); + goto err_pcmcia_driver; + } #endif - if (err) - return -1; return 0; + +#ifdef GPIB_PCMCIA +err_pcmcia_driver: + gpib_unregister_driver(&ines_pcmcia_accel_interface); +err_pcmcia_accel: + gpib_unregister_driver(&ines_pcmcia_unaccel_interface); +err_pcmcia_unaccel: + gpib_unregister_driver(&ines_pcmcia_interface); +err_pcmcia: +#endif + gpib_unregister_driver(&ines_isa_interface); +err_isa: + gpib_unregister_driver(&ines_pci_accel_interface); +err_pci_accel: + gpib_unregister_driver(&ines_pci_unaccel_interface); +err_pci_unaccel: + gpib_unregister_driver(&ines_pci_interface); +err_pci: + pci_unregister_driver(&ines_pci_driver); + + return ret; } static void __exit ines_exit_module(void) From e3f4b64edb242ba59095b57f54df64ccecc67aac Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:32 +0530 Subject: [PATCH 22/38] staging: gpib: lpvo_usb: Return error value from gpib_register_driver() The function gpib_register_driver() can fail and does not return an error value if it fails. Return the error value if gpib_register_driver() fails. Add pr_err() statement indicating the fail and error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-13-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index 1a8eb3bfb61c..69cf4cb284f9 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -1179,7 +1179,11 @@ static int usb_gpib_init_module(struct usb_interface *interface) return rv; if (!assigned_usb_minors) { - gpib_register_driver(&usb_gpib_interface, THIS_MODULE); + rv = gpib_register_driver(&usb_gpib_interface, THIS_MODULE); + if (rv) { + pr_err("lpvo_usb_gpib: gpib_register_driver failed: error = %d\n", rv); + goto exit; + } } else { /* check if minor is already registered - maybe useless, but if * it happens the code is inconsistent somewhere From 635ddb8ccdbde0d917b0a7448b0fd9d6cc27a2a9 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:33 +0530 Subject: [PATCH 23/38] staging: gpib: ni_usb: Handle gpib_register_driver() errors The usb_register() function can fail and returns an error value which is not returned. The function gpib_register_driver() can also fail which can result in semi-registered module. In case gpib_register_driver() fails unregister the previous usb driver registering function. Return the error value if gpib_register_driver() or usb_register() functions fail. Add pr_err() statements indicating the fail and error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-14-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c index 70b8b305e13b..3c4132fd6de9 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -2619,12 +2619,23 @@ static struct usb_driver ni_usb_bus_driver = { static int __init ni_usb_init_module(void) { int i; + int ret; pr_info("ni_usb_gpib driver loading\n"); for (i = 0; i < MAX_NUM_NI_USB_INTERFACES; i++) ni_usb_driver_interfaces[i] = NULL; - usb_register(&ni_usb_bus_driver); - gpib_register_driver(&ni_usb_gpib_interface, THIS_MODULE); + + ret = usb_register(&ni_usb_bus_driver); + if (ret) { + pr_err("ni_usb_gpib: usb_register failed: error = %d\n", ret); + return ret; + } + + ret = gpib_register_driver(&ni_usb_gpib_interface, THIS_MODULE); + if (ret) { + pr_err("ni_usb_gpib: gpib_register_driver failed: error = %d\n", ret); + return ret; + } return 0; } From 942b483ef3db0a74910b7c7f500bd0ed063767e0 Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:34 +0530 Subject: [PATCH 24/38] staging: gpib: pc2: Handle gpib_register_driver() errors The function gpib_register_driver() can fail, resulting in a semi-registered module and does not return an error value if it fails. Unregister the previous gpib registering functions if subsequent gpib_register_driver() fail and return the error value. Add pr_err() statements indicating the fail and error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-15-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/pc2/pc2_gpib.c | 38 ++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/staging/gpib/pc2/pc2_gpib.c b/drivers/staging/gpib/pc2/pc2_gpib.c index 7b3b34f47341..a9aae563f60a 100644 --- a/drivers/staging/gpib/pc2/pc2_gpib.c +++ b/drivers/staging/gpib/pc2/pc2_gpib.c @@ -635,12 +635,42 @@ void pc2_2a_detach(gpib_board_t *board) static int __init pc2_init_module(void) { - gpib_register_driver(&pc2_interface, THIS_MODULE); - gpib_register_driver(&pc2a_interface, THIS_MODULE); - gpib_register_driver(&pc2a_cb7210_interface, THIS_MODULE); - gpib_register_driver(&pc2_2a_interface, THIS_MODULE); + int ret; + + ret = gpib_register_driver(&pc2_interface, THIS_MODULE); + if (ret) { + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); + return ret; + } + + ret = gpib_register_driver(&pc2a_interface, THIS_MODULE); + if (ret) { + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pc2a; + } + + ret = gpib_register_driver(&pc2a_cb7210_interface, THIS_MODULE); + if (ret) { + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_cb7210; + } + + ret = gpib_register_driver(&pc2_2a_interface, THIS_MODULE); + if (ret) { + pr_err("pc2_gpib: gpib_register_driver failed: error = %d\n", ret); + goto err_pc2_2a; + } return 0; + +err_pc2_2a: + gpib_unregister_driver(&pc2a_cb7210_interface); +err_cb7210: + gpib_unregister_driver(&pc2a_interface); +err_pc2a: + gpib_unregister_driver(&pc2_interface); + + return ret; } static void __exit pc2_exit_module(void) From 1737aaefa33555b38d3fe11191490df9e9df81cd Mon Sep 17 00:00:00 2001 From: Nihar Chaithanya Date: Tue, 31 Dec 2024 00:26:35 +0530 Subject: [PATCH 25/38] staging: gpib: tnt4882: Handle gpib_register_driver() errors The error value from the init_ni_gpib_cs() function is not returned and the previous registering functions are not unregistered. The function gpib_register_driver() can fail and similar to pcmcia_register_driver() function failing, the previous registering functions are not unregistered. Unregister the gpib and pci register functions if the subsequent gpib or pcmcia register functions fail and return the error value. Add pr_err() statements indicating the fail and the error value. Signed-off-by: Nihar Chaithanya Link: https://lore.kernel.org/r/20241230185633.175690-16-niharchaithanya@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 106 +++++++++++++++++--- 1 file changed, 93 insertions(+), 13 deletions(-) diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c index e49a952fa0d8..a2549231525b 100644 --- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c +++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c @@ -1524,29 +1524,109 @@ static int __init tnt4882_init_module(void) result = pci_register_driver(&tnt4882_pci_driver); if (result) { - pr_err("tnt4882: pci_driver_register failed!\n"); + pr_err("tnt4882_gpib: pci_register_driver failed: error = %d\n", result); return result; } - gpib_register_driver(&ni_isa_interface, THIS_MODULE); - gpib_register_driver(&ni_isa_accel_interface, THIS_MODULE); - gpib_register_driver(&ni_nat4882_isa_interface, THIS_MODULE); - gpib_register_driver(&ni_nat4882_isa_accel_interface, THIS_MODULE); - gpib_register_driver(&ni_nec_isa_interface, THIS_MODULE); - gpib_register_driver(&ni_nec_isa_accel_interface, THIS_MODULE); - gpib_register_driver(&ni_pci_interface, THIS_MODULE); - gpib_register_driver(&ni_pci_accel_interface, THIS_MODULE); + result = gpib_register_driver(&ni_isa_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_isa; + } + + result = gpib_register_driver(&ni_isa_accel_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_isa_accel; + } + + result = gpib_register_driver(&ni_nat4882_isa_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_nat4882_isa; + } + + result = gpib_register_driver(&ni_nat4882_isa_accel_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_nat4882_isa_accel; + } + + result = gpib_register_driver(&ni_nec_isa_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_nec_isa; + } + + result = gpib_register_driver(&ni_nec_isa_accel_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_nec_isa_accel; + } + + result = gpib_register_driver(&ni_pci_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_pci; + } + + result = gpib_register_driver(&ni_pci_accel_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_pci_accel; + } + #ifdef GPIB_PCMCIA - gpib_register_driver(&ni_pcmcia_interface, THIS_MODULE); - gpib_register_driver(&ni_pcmcia_accel_interface, THIS_MODULE); - if (init_ni_gpib_cs() < 0) - return -1; + result = gpib_register_driver(&ni_pcmcia_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_pcmcia; + } + + result = gpib_register_driver(&ni_pcmcia_accel_interface, THIS_MODULE); + if (result) { + pr_err("tnt4882_gpib: gpib_register_driver failed: error = %d\n", result); + goto err_pcmcia_accel; + } + + result = init_ni_gpib_cs(); + if (result) { + pr_err("tnt4882_gpib: pcmcia_register_driver failed: error = %d\n", result); + goto err_pcmcia_driver; + } #endif mite_init(); mite_list_devices(); return 0; + +#ifdef GPIB_PCMCIA +err_pcmcia_driver: + gpib_unregister_driver(&ni_pcmcia_accel_interface); +err_pcmcia_accel: + gpib_unregister_driver(&ni_pcmcia_interface); +err_pcmcia: +#endif + gpib_unregister_driver(&ni_pci_accel_interface); +err_pci_accel: + gpib_unregister_driver(&ni_pci_interface); +err_pci: + gpib_unregister_driver(&ni_nec_isa_accel_interface); +err_nec_isa_accel: + gpib_unregister_driver(&ni_nec_isa_interface); +err_nec_isa: + gpib_unregister_driver(&ni_nat4882_isa_accel_interface); +err_nat4882_isa_accel: + gpib_unregister_driver(&ni_nat4882_isa_interface); +err_nat4882_isa: + gpib_unregister_driver(&ni_isa_accel_interface); +err_isa_accel: + gpib_unregister_driver(&ni_isa_interface); +err_isa: + pci_unregister_driver(&tnt4882_pci_driver); + + return result; } static void __exit tnt4882_exit_module(void) From e7cd121cbf1bec05e50335f82d4aa7d8fa700538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B0=A2=E8=87=B4=E9=82=A6=20=28XIE=20Zhibang=29?= Date: Thu, 9 Jan 2025 13:20:48 +0000 Subject: [PATCH 26/38] staging: rtl8723bs: Remove ioctl interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wireless drivers should not use the ioctl interface, so remove this interface for the rtl8723bs driver. (found by code inspection) Signed-off-by: 谢致邦 (XIE Zhibang) Tested-by: Philipp Hortmann Link: https://lore.kernel.org/r/tencent_E4A835D41FF1F35C7BDFCF4EA0136D548F06@qq.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/Makefile | 1 - .../staging/rtl8723bs/include/osdep_intf.h | 2 - .../staging/rtl8723bs/os_dep/ioctl_linux.c | 1286 ----------------- drivers/staging/rtl8723bs/os_dep/os_intfs.c | 1 - 4 files changed, 1290 deletions(-) delete mode 100644 drivers/staging/rtl8723bs/os_dep/ioctl_linux.c diff --git a/drivers/staging/rtl8723bs/Makefile b/drivers/staging/rtl8723bs/Makefile index ba200ee669f3..8560b84a3146 100644 --- a/drivers/staging/rtl8723bs/Makefile +++ b/drivers/staging/rtl8723bs/Makefile @@ -48,7 +48,6 @@ r8723bs-y = \ hal/HalHWImg8723B_RF.o \ hal/HalPhyRf_8723B.o \ os_dep/ioctl_cfg80211.o \ - os_dep/ioctl_linux.o \ os_dep/mlme_linux.o \ os_dep/osdep_service.o \ os_dep/os_intfs.o \ diff --git a/drivers/staging/rtl8723bs/include/osdep_intf.h b/drivers/staging/rtl8723bs/include/osdep_intf.h index 215ece612f71..73199be78139 100644 --- a/drivers/staging/rtl8723bs/include/osdep_intf.h +++ b/drivers/staging/rtl8723bs/include/osdep_intf.h @@ -47,8 +47,6 @@ u32 rtw_start_drv_threads(struct adapter *padapter); void rtw_stop_drv_threads(struct adapter *padapter); void rtw_cancel_all_timer(struct adapter *padapter); -int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); - int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname); struct net_device *rtw_init_netdev(struct adapter *padapter); void rtw_unregister_netdevs(struct dvobj_priv *dvobj); diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c b/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c deleted file mode 100644 index 793b051536f3..000000000000 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_linux.c +++ /dev/null @@ -1,1286 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/****************************************************************************** - * - * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved. - * - ******************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#define RTL_IOCTL_WPA_SUPPLICANT (SIOCIWFIRSTPRIV + 30) - -static int wpa_set_auth_algs(struct net_device *dev, u32 value) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - int ret = 0; - - if ((value & IW_AUTH_ALG_SHARED_KEY) && (value & IW_AUTH_ALG_OPEN_SYSTEM)) { - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeAutoSwitch; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - } else if (value & IW_AUTH_ALG_SHARED_KEY) { - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeShared; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Shared; - } else if (value & IW_AUTH_ALG_OPEN_SYSTEM) { - /* padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; */ - if (padapter->securitypriv.ndisauthtype < Ndis802_11AuthModeWPAPSK) { - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeOpen; - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - } - } else { - ret = -EINVAL; - } - - return ret; -} - -static int wpa_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) -{ - int ret = 0; - u8 max_idx; - u32 wep_key_idx, wep_key_len, wep_total_len; - struct ndis_802_11_wep *pwep = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - if (param_len < (u32)((u8 *)param->u.crypt.key - (u8 *)param) + param->u.crypt.key_len) { - ret = -EINVAL; - goto exit; - } - - if (param->sta_addr[0] != 0xff || param->sta_addr[1] != 0xff || - param->sta_addr[2] != 0xff || param->sta_addr[3] != 0xff || - param->sta_addr[4] != 0xff || param->sta_addr[5] != 0xff) { - ret = -EINVAL; - goto exit; - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0) - max_idx = WEP_KEYS - 1; - else - max_idx = BIP_MAX_KEYID; - - if (param->u.crypt.idx > max_idx) { - netdev_err(dev, "Error crypt.idx %d > %d\n", param->u.crypt.idx, max_idx); - ret = -EINVAL; - goto exit; - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; - padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; - - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - - if (wep_key_len > 0) { - wep_key_len = wep_key_len <= 5 ? 5 : 13; - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); - /* Allocate a full structure to avoid potentially running off the end. */ - pwep = kzalloc(sizeof(*pwep), GFP_KERNEL); - if (!pwep) { - ret = -ENOMEM; - goto exit; - } - - pwep->key_length = wep_key_len; - pwep->length = wep_total_len; - - if (wep_key_len == 13) { - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; - padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; - } - } else { - ret = -EINVAL; - goto exit; - } - - pwep->key_index = wep_key_idx; - pwep->key_index |= 0x80000000; - - memcpy(pwep->key_material, param->u.crypt.key, pwep->key_length); - - if (param->u.crypt.set_tx) { - if (rtw_set_802_11_add_wep(padapter, pwep) == (u8)_FAIL) - ret = -EOPNOTSUPP; - } else { - /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ - /* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to fw/cam */ - - if (wep_key_idx >= WEP_KEYS) { - ret = -EOPNOTSUPP; - goto exit; - } - - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; - rtw_set_key(padapter, psecuritypriv, wep_key_idx, 0, true); - } - - goto exit; - } - - if (padapter->securitypriv.dot11AuthAlgrthm == dot11AuthAlgrthm_8021X) { /* 802_1x */ - struct sta_info *psta, *pbcmc_sta; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_MP_STATE) == true) { /* sta mode */ - psta = rtw_get_stainfo(pstapriv, get_bssid(pmlmepriv)); - if (psta) { - /* Jeff: don't disable ieee8021x_blocked while clearing key */ - if (strcmp(param->u.crypt.alg, "none") != 0) - psta->ieee8021x_blocked = false; - - if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) || - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { - psta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } - - if (param->u.crypt.set_tx == 1) { /* pairwise key */ - memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */ - memcpy(psta->dot11tkiptxmickey.skey, ¶m->u.crypt.key[16], 8); - memcpy(psta->dot11tkiprxmickey.skey, ¶m->u.crypt.key[24], 8); - - padapter->securitypriv.busetkipkey = false; - /* _set_timer(&padapter->securitypriv.tkip_timer, 50); */ - } - - rtw_setstakey_cmd(padapter, psta, true, true); - } else { /* group key */ - if (strcmp(param->u.crypt.alg, "TKIP") == 0 || strcmp(param->u.crypt.alg, "CCMP") == 0) { - memcpy(padapter->securitypriv.dot118021XGrpKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - /* only TKIP group key need to install this */ - if (param->u.crypt.key_len > 16) { - memcpy(padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[16], 8); - memcpy(padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[24], 8); - } - padapter->securitypriv.binstallGrpkey = true; - - padapter->securitypriv.dot118021XGrpKeyid = param->u.crypt.idx; - - rtw_set_key(padapter, &padapter->securitypriv, param->u.crypt.idx, 1, true); - } else if (strcmp(param->u.crypt.alg, "BIP") == 0) { - /* save the IGTK key, length 16 bytes */ - memcpy(padapter->securitypriv.dot11wBIPKey[param->u.crypt.idx].skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - padapter->securitypriv.dot11wBIPKeyid = param->u.crypt.idx; - padapter->securitypriv.binstallBIPkey = true; - } - } - } - - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) { - /* Jeff: don't disable ieee8021x_blocked while clearing key */ - if (strcmp(param->u.crypt.alg, "none") != 0) - pbcmc_sta->ieee8021x_blocked = false; - - if ((padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption2Enabled) || - (padapter->securitypriv.ndisencryptstatus == Ndis802_11Encryption3Enabled)) { - pbcmc_sta->dot118021XPrivacy = padapter->securitypriv.dot11PrivacyAlgrthm; - } - } - } else if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) { - /* adhoc mode */ - } - } - -exit: - - kfree(pwep); - return ret; -} - -static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ielen) -{ - u8 *buf = NULL; - int group_cipher = 0, pairwise_cipher = 0; - int ret = 0; - u8 null_addr[] = {0, 0, 0, 0, 0, 0}; - - if (ielen > MAX_WPA_IE_LEN || !pie) { - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - if (!pie) - return ret; - else - return -EINVAL; - } - - if (ielen) { - buf = rtw_zmalloc(ielen); - if (!buf) { - ret = -ENOMEM; - goto exit; - } - - memcpy(buf, pie, ielen); - - if (ielen < RSN_HEADER_LEN) { - ret = -1; - goto exit; - } - - if (rtw_parse_wpa_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; - memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); - } - - if (rtw_parse_wpa2_ie(buf, ielen, &group_cipher, &pairwise_cipher, NULL) == _SUCCESS) { - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; - memcpy(padapter->securitypriv.supplicant_ie, &buf[0], ielen); - } - - if (group_cipher == 0) - group_cipher = WPA_CIPHER_NONE; - if (pairwise_cipher == 0) - pairwise_cipher = WPA_CIPHER_NONE; - - switch (group_cipher) { - case WPA_CIPHER_NONE: - padapter->securitypriv.dot118021XGrpPrivacy = _NO_PRIVACY_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; - break; - case WPA_CIPHER_WEP40: - padapter->securitypriv.dot118021XGrpPrivacy = _WEP40_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WPA_CIPHER_TKIP: - padapter->securitypriv.dot118021XGrpPrivacy = _TKIP_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WPA_CIPHER_CCMP: - padapter->securitypriv.dot118021XGrpPrivacy = _AES_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - case WPA_CIPHER_WEP104: - padapter->securitypriv.dot118021XGrpPrivacy = _WEP104_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - } - - switch (pairwise_cipher) { - case WPA_CIPHER_NONE: - padapter->securitypriv.dot11PrivacyAlgrthm = _NO_PRIVACY_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11EncryptionDisabled; - break; - case WPA_CIPHER_WEP40: - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP40_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - case WPA_CIPHER_TKIP: - padapter->securitypriv.dot11PrivacyAlgrthm = _TKIP_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case WPA_CIPHER_CCMP: - padapter->securitypriv.dot11PrivacyAlgrthm = _AES_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - case WPA_CIPHER_WEP104: - padapter->securitypriv.dot11PrivacyAlgrthm = _WEP104_; - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption1Enabled; - break; - } - - _clr_fwstate_(&padapter->mlmepriv, WIFI_UNDER_WPS); - {/* set wps_ie */ - u16 cnt = 0; - u8 eid, wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; - - while (cnt < ielen) { - eid = buf[cnt]; - - if ((eid == WLAN_EID_VENDOR_SPECIFIC) && (!memcmp(&buf[cnt + 2], wps_oui, 4))) { - padapter->securitypriv.wps_ie_len = ((buf[cnt + 1] + 2) < MAX_WPS_IE_LEN) ? (buf[cnt + 1] + 2) : MAX_WPS_IE_LEN; - - memcpy(padapter->securitypriv.wps_ie, &buf[cnt], padapter->securitypriv.wps_ie_len); - - set_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS); - - cnt += buf[cnt + 1] + 2; - - break; - } else { - cnt += buf[cnt + 1] + 2; /* goto next */ - } - } - } - } - - /* TKIP and AES disallow multicast packets until installing group key */ - if (padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_ || - padapter->securitypriv.dot11PrivacyAlgrthm == _TKIP_WTMIC_ || - padapter->securitypriv.dot11PrivacyAlgrthm == _AES_) - /* WPS open need to enable multicast */ - /* check_fwstate(&padapter->mlmepriv, WIFI_UNDER_WPS) == true) */ - rtw_hal_set_hwreg(padapter, HW_VAR_OFF_RCR_AM, null_addr); - -exit: - - kfree(buf); - - return ret; -} - -static int wpa_set_param(struct net_device *dev, u8 name, u32 value) -{ - uint ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - - switch (name) { - case IEEE_PARAM_WPA_ENABLED: - - padapter->securitypriv.dot11AuthAlgrthm = dot11AuthAlgrthm_8021X; /* 802.1x */ - - /* ret = ieee80211_wpa_enable(ieee, value); */ - - switch ((value) & 0xff) { - case 1: /* WPA */ - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPAPSK; /* WPA_PSK */ - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption2Enabled; - break; - case 2: /* WPA2 */ - padapter->securitypriv.ndisauthtype = Ndis802_11AuthModeWPA2PSK; /* WPA2_PSK */ - padapter->securitypriv.ndisencryptstatus = Ndis802_11Encryption3Enabled; - break; - } - - break; - - case IEEE_PARAM_TKIP_COUNTERMEASURES: - /* ieee->tkip_countermeasures =value; */ - break; - - case IEEE_PARAM_DROP_UNENCRYPTED: - { - /* HACK: - * - * wpa_supplicant calls set_wpa_enabled when the driver - * is loaded and unloaded, regardless of if WPA is being - * used. No other calls are made which can be used to - * determine if encryption will be used or not prior to - * association being expected. If encryption is not being - * used, drop_unencrypted is set to false, else true -- we - * can use this to determine if the CAP_PRIVACY_ON bit should - * be set. - */ - break; - } - case IEEE_PARAM_PRIVACY_INVOKED: - - /* ieee->privacy_invoked =value; */ - - break; - - case IEEE_PARAM_AUTH_ALGS: - - ret = wpa_set_auth_algs(dev, value); - - break; - - case IEEE_PARAM_IEEE_802_1X: - - /* ieee->ieee802_1x =value; */ - - break; - - case IEEE_PARAM_WPAX_SELECT: - - /* added for WPA2 mixed mode */ - /* - spin_lock_irqsave(&ieee->wpax_suitlist_lock, flags); - ieee->wpax_type_set = 1; - ieee->wpax_type_notify = value; - spin_unlock_irqrestore(&ieee->wpax_suitlist_lock, flags); - */ - - break; - - default: - - ret = -EOPNOTSUPP; - - break; - } - - return ret; -} - -static int wpa_mlme(struct net_device *dev, u32 command, u32 reason) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - - switch (command) { - case IEEE_MLME_STA_DEAUTH: - - if (!rtw_set_802_11_disassociate(padapter)) - ret = -1; - - break; - - case IEEE_MLME_STA_DISASSOC: - - if (!rtw_set_802_11_disassociate(padapter)) - ret = -1; - - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} - -static int wpa_supplicant_ioctl(struct net_device *dev, struct iw_point *p) -{ - struct ieee_param *param; - uint ret = 0; - - /* down(&ieee->wx_sem); */ - - if (!p->pointer || p->length != sizeof(struct ieee_param)) - return -EINVAL; - - param = rtw_malloc(p->length); - if (!param) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - kfree(param); - return -EFAULT; - } - - switch (param->cmd) { - case IEEE_CMD_SET_WPA_PARAM: - ret = wpa_set_param(dev, param->u.wpa_param.name, param->u.wpa_param.value); - break; - - case IEEE_CMD_SET_WPA_IE: - /* ret = wpa_set_wpa_ie(dev, param, p->length); */ - ret = rtw_set_wpa_ie(rtw_netdev_priv(dev), (char *)param->u.wpa_ie.data, (u16)param->u.wpa_ie.len); - break; - - case IEEE_CMD_SET_ENCRYPTION: - ret = wpa_set_encryption(dev, param, p->length); - break; - - case IEEE_CMD_MLME: - ret = wpa_mlme(dev, param->u.mlme.command, param->u.mlme.reason_code); - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); - - /* up(&ieee->wx_sem); */ - return ret; -} - -static int rtw_set_encryption(struct net_device *dev, struct ieee_param *param, u32 param_len) -{ - int ret = 0; - u32 wep_key_idx, wep_key_len, wep_total_len; - struct ndis_802_11_wep *pwep = NULL; - struct sta_info *psta = NULL, *pbcmc_sta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct security_priv *psecuritypriv = &padapter->securitypriv; - struct sta_priv *pstapriv = &padapter->stapriv; - char *txkey = padapter->securitypriv.dot118021XGrptxmickey[param->u.crypt.idx].skey; - char *rxkey = padapter->securitypriv.dot118021XGrprxmickey[param->u.crypt.idx].skey; - char *grpkey = psecuritypriv->dot118021XGrpKey[param->u.crypt.idx].skey; - - param->u.crypt.err = 0; - param->u.crypt.alg[IEEE_CRYPT_ALG_NAME_LEN - 1] = '\0'; - - /* sizeof(struct ieee_param) = 64 bytes; */ - /* if (param_len != (u32) ((u8 *) param->u.crypt.key - (u8 *) param) + param->u.crypt.key_len) */ - if (param_len != sizeof(struct ieee_param) + param->u.crypt.key_len) { - ret = -EINVAL; - goto exit; - } - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - if (param->u.crypt.idx >= WEP_KEYS) { - ret = -EINVAL; - goto exit; - } - } else { - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (!psta) - /* ret = -EINVAL; */ - goto exit; - } - - if (strcmp(param->u.crypt.alg, "none") == 0 && !psta) { - /* todo:clear default encryption keys */ - - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Open; - psecuritypriv->ndisencryptstatus = Ndis802_11EncryptionDisabled; - psecuritypriv->dot11PrivacyAlgrthm = _NO_PRIVACY_; - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - - goto exit; - } - - if (strcmp(param->u.crypt.alg, "WEP") == 0 && !psta) { - wep_key_idx = param->u.crypt.idx; - wep_key_len = param->u.crypt.key_len; - - if ((wep_key_idx >= WEP_KEYS) || (wep_key_len <= 0)) { - ret = -EINVAL; - goto exit; - } - - if (wep_key_len > 0) { - wep_key_len = wep_key_len <= 5 ? 5 : 13; - wep_total_len = wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, key_material); - /* Allocate a full structure to avoid potentially running off the end. */ - pwep = kzalloc(sizeof(*pwep), GFP_KERNEL); - if (!pwep) - goto exit; - - pwep->key_length = wep_key_len; - pwep->length = wep_total_len; - } - - pwep->key_index = wep_key_idx; - - memcpy(pwep->key_material, param->u.crypt.key, pwep->key_length); - - if (param->u.crypt.set_tx) { - psecuritypriv->dot11AuthAlgrthm = dot11AuthAlgrthm_Auto; - psecuritypriv->ndisencryptstatus = Ndis802_11Encryption1Enabled; - psecuritypriv->dot11PrivacyAlgrthm = _WEP40_; - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - - if (pwep->key_length == 13) { - psecuritypriv->dot11PrivacyAlgrthm = _WEP104_; - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } - - psecuritypriv->dot11PrivacyKeyIndex = wep_key_idx; - - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); - - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; - - rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 1); - } else { - /* don't update "psecuritypriv->dot11PrivacyAlgrthm" and */ - /* psecuritypriv->dot11PrivacyKeyIndex =keyid", but can rtw_set_key to cam */ - - memcpy(&psecuritypriv->dot11DefKey[wep_key_idx].skey[0], pwep->key_material, pwep->key_length); - - psecuritypriv->dot11DefKeylen[wep_key_idx] = pwep->key_length; - - rtw_ap_set_wep_key(padapter, pwep->key_material, pwep->key_length, wep_key_idx, 0); - } - - goto exit; - } - - if (!psta && check_fwstate(pmlmepriv, WIFI_AP_STATE)) { /* group key */ - if (param->u.crypt.set_tx == 1) { - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - /* set mic key */ - memcpy(txkey, ¶m->u.crypt.key[16], 8); - memcpy(psecuritypriv->dot118021XGrprxmickey[param->u.crypt.idx].skey, ¶m->u.crypt.key[24], 8); - - psecuritypriv->busetkipkey = true; - - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _AES_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - } else { - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - } - - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - - psecuritypriv->binstallGrpkey = true; - - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/* */ - - rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) { - pbcmc_sta->ieee8021x_blocked = false; - pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ - } - } - - goto exit; - } - - if (psecuritypriv->dot11AuthAlgrthm == dot11AuthAlgrthm_8021X && psta) { /* psk/802_1x */ - if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) { - if (param->u.crypt.set_tx == 1) { - memcpy(psta->dot118021x_UncstKey.skey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - psta->dot118021XPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - psta->dot118021XPrivacy = _WEP104_; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - psta->dot118021XPrivacy = _TKIP_; - - /* set mic key */ - memcpy(psta->dot11tkiptxmickey.skey, ¶m->u.crypt.key[16], 8); - memcpy(psta->dot11tkiprxmickey.skey, ¶m->u.crypt.key[24], 8); - - psecuritypriv->busetkipkey = true; - - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - psta->dot118021XPrivacy = _AES_; - } else { - psta->dot118021XPrivacy = _NO_PRIVACY_; - } - - rtw_ap_set_pairwise_key(padapter, psta); - - psta->ieee8021x_blocked = false; - - } else { /* group key??? */ - if (strcmp(param->u.crypt.alg, "WEP") == 0) { - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - psecuritypriv->dot118021XGrpPrivacy = _WEP40_; - if (param->u.crypt.key_len == 13) - psecuritypriv->dot118021XGrpPrivacy = _WEP104_; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _TKIP_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - - /* set mic key */ - memcpy(txkey, ¶m->u.crypt.key[16], 8); - memcpy(rxkey, ¶m->u.crypt.key[24], 8); - - psecuritypriv->busetkipkey = true; - - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { - psecuritypriv->dot118021XGrpPrivacy = _AES_; - - memcpy(grpkey, param->u.crypt.key, (param->u.crypt.key_len > 16 ? 16 : param->u.crypt.key_len)); - } else { - psecuritypriv->dot118021XGrpPrivacy = _NO_PRIVACY_; - } - - psecuritypriv->dot118021XGrpKeyid = param->u.crypt.idx; - - psecuritypriv->binstallGrpkey = true; - - psecuritypriv->dot11PrivacyAlgrthm = psecuritypriv->dot118021XGrpPrivacy;/* */ - - rtw_ap_set_group_key(padapter, param->u.crypt.key, psecuritypriv->dot118021XGrpPrivacy, param->u.crypt.idx); - - pbcmc_sta = rtw_get_bcmc_stainfo(padapter); - if (pbcmc_sta) { - pbcmc_sta->ieee8021x_blocked = false; - pbcmc_sta->dot118021XPrivacy = psecuritypriv->dot118021XGrpPrivacy;/* rx will use bmc_sta's dot118021XPrivacy */ - } - } - } - } - -exit: - kfree(pwep); - - return ret; -} - -static int rtw_set_beacon(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - unsigned char *pbuf = param->u.bcn_ie.buf; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - memcpy(&pstapriv->max_num_sta, param->u.bcn_ie.reserved, 2); - - if ((pstapriv->max_num_sta > NUM_STA) || (pstapriv->max_num_sta <= 0)) - pstapriv->max_num_sta = NUM_STA; - - if (rtw_check_beacon_data(padapter, pbuf, (len - 12 - 2)) == _SUCCESS)/* 12 = param header, 2:no packed */ - ret = 0; - else - ret = -EINVAL; - - return ret; -} - -static void rtw_hostapd_sta_flush(struct net_device *dev) -{ - /* _irqL irqL; */ - /* struct list_head *phead, *plist; */ - /* struct sta_info *psta = NULL; */ - struct adapter *padapter = rtw_netdev_priv(dev); - /* struct sta_priv *pstapriv = &padapter->stapriv; */ - - flush_all_cam_entry(padapter); /* clear CAM */ - - rtw_sta_flush(padapter); -} - -static int rtw_add_sta(struct net_device *dev, struct ieee_param *param) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - -/* - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) - { - rtw_free_stainfo(padapter, psta); - - psta = NULL; - } -*/ - /* psta = rtw_alloc_stainfo(pstapriv, param->sta_addr); */ - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) { - int flags = param->u.add_sta.flags; - - psta->aid = param->u.add_sta.aid;/* aid = 1~2007 */ - - memcpy(psta->bssrateset, param->u.add_sta.tx_supp_rates, 16); - - /* check wmm cap. */ - if (WLAN_STA_WME & flags) - psta->qos_option = 1; - else - psta->qos_option = 0; - - if (pmlmepriv->qospriv.qos_option == 0) - psta->qos_option = 0; - - /* chec 802.11n ht cap. */ - if (WLAN_STA_HT & flags) { - psta->htpriv.ht_option = true; - psta->qos_option = 1; - memcpy((void *)&psta->htpriv.ht_cap, (void *)¶m->u.add_sta.ht_cap, sizeof(struct ieee80211_ht_cap)); - } else { - psta->htpriv.ht_option = false; - } - - if (!pmlmepriv->htpriv.ht_option) - psta->htpriv.ht_option = false; - - update_sta_info_apmode(padapter, psta); - - } else { - ret = -ENOMEM; - } - - return ret; -} - -static int rtw_del_sta(struct net_device *dev, struct ieee_param *param) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) { - u8 updated = false; - - spin_lock_bh(&pstapriv->asoc_list_lock); - if (list_empty(&psta->asoc_list) == false) { - list_del_init(&psta->asoc_list); - pstapriv->asoc_list_cnt--; - updated = ap_free_sta(padapter, psta, true, WLAN_REASON_DEAUTH_LEAVING); - } - spin_unlock_bh(&pstapriv->asoc_list_lock); - - associated_clients_update(padapter, updated); - - psta = NULL; - } - - return ret; -} - -static int rtw_ioctl_get_sta_data(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - struct ieee_param_ex *param_ex = (struct ieee_param_ex *)param; - struct sta_data *psta_data = (struct sta_data *)param_ex->data; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param_ex->sta_addr[0] == 0xff && param_ex->sta_addr[1] == 0xff && - param_ex->sta_addr[2] == 0xff && param_ex->sta_addr[3] == 0xff && - param_ex->sta_addr[4] == 0xff && param_ex->sta_addr[5] == 0xff) { - return -EINVAL; - } - - psta = rtw_get_stainfo(pstapriv, param_ex->sta_addr); - if (psta) { - psta_data->aid = (u16)psta->aid; - psta_data->capability = psta->capability; - psta_data->flags = psta->flags; - -/* - nonerp_set : BIT(0) - no_short_slot_time_set : BIT(1) - no_short_preamble_set : BIT(2) - no_ht_gf_set : BIT(3) - no_ht_set : BIT(4) - ht_20mhz_set : BIT(5) -*/ - - psta_data->sta_set = ((psta->nonerp_set) | - (psta->no_short_slot_time_set << 1) | - (psta->no_short_preamble_set << 2) | - (psta->no_ht_gf_set << 3) | - (psta->no_ht_set << 4) | - (psta->ht_20mhz_set << 5)); - - psta_data->tx_supp_rates_len = psta->bssratelen; - memcpy(psta_data->tx_supp_rates, psta->bssrateset, psta->bssratelen); - memcpy(&psta_data->ht_cap, &psta->htpriv.ht_cap, sizeof(struct ieee80211_ht_cap)); - psta_data->rx_pkts = psta->sta_stats.rx_data_pkts; - psta_data->rx_bytes = psta->sta_stats.rx_bytes; - psta_data->rx_drops = psta->sta_stats.rx_drops; - - psta_data->tx_pkts = psta->sta_stats.tx_pkts; - psta_data->tx_bytes = psta->sta_stats.tx_bytes; - psta_data->tx_drops = psta->sta_stats.tx_drops; - - } else { - ret = -1; - } - - return ret; -} - -static int rtw_get_sta_wpaie(struct net_device *dev, struct ieee_param *param) -{ - int ret = 0; - struct sta_info *psta = NULL; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct sta_priv *pstapriv = &padapter->stapriv; - - if (check_fwstate(pmlmepriv, (_FW_LINKED | WIFI_AP_STATE)) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - psta = rtw_get_stainfo(pstapriv, param->sta_addr); - if (psta) { - if ((psta->wpa_ie[0] == WLAN_EID_RSN) || (psta->wpa_ie[0] == WLAN_EID_VENDOR_SPECIFIC)) { - int wpa_ie_len; - int copy_len; - - wpa_ie_len = psta->wpa_ie[1]; - - copy_len = ((wpa_ie_len + 2) > sizeof(psta->wpa_ie)) ? (sizeof(psta->wpa_ie)) : (wpa_ie_len + 2); - - param->u.wpa_ie.len = copy_len; - - memcpy(param->u.wpa_ie.reserved, psta->wpa_ie, copy_len); - } - } else { - ret = -1; - } - - return ret; -} - -static int rtw_set_wps_beacon(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - unsigned char wps_oui[4] = {0x0, 0x50, 0xf2, 0x04}; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv; - int ie_len; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - - kfree(pmlmepriv->wps_beacon_ie); - pmlmepriv->wps_beacon_ie = NULL; - - if (ie_len > 0) { - pmlmepriv->wps_beacon_ie = rtw_malloc(ie_len); - pmlmepriv->wps_beacon_ie_len = ie_len; - if (!pmlmepriv->wps_beacon_ie) - return -EINVAL; - - memcpy(pmlmepriv->wps_beacon_ie, param->u.bcn_ie.buf, ie_len); - - update_beacon(padapter, WLAN_EID_VENDOR_SPECIFIC, wps_oui, true); - - pmlmeext->bstart_bss = true; - } - - return ret; -} - -static int rtw_set_wps_probe_resp(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int ie_len; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - - kfree(pmlmepriv->wps_probe_resp_ie); - pmlmepriv->wps_probe_resp_ie = NULL; - - if (ie_len > 0) { - pmlmepriv->wps_probe_resp_ie = rtw_malloc(ie_len); - pmlmepriv->wps_probe_resp_ie_len = ie_len; - if (!pmlmepriv->wps_probe_resp_ie) - return -EINVAL; - - memcpy(pmlmepriv->wps_probe_resp_ie, param->u.bcn_ie.buf, ie_len); - } - - return ret; -} - -static int rtw_set_wps_assoc_resp(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - int ie_len; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - - kfree(pmlmepriv->wps_assoc_resp_ie); - pmlmepriv->wps_assoc_resp_ie = NULL; - - if (ie_len > 0) { - pmlmepriv->wps_assoc_resp_ie = rtw_malloc(ie_len); - pmlmepriv->wps_assoc_resp_ie_len = ie_len; - if (!pmlmepriv->wps_assoc_resp_ie) - return -EINVAL; - - memcpy(pmlmepriv->wps_assoc_resp_ie, param->u.bcn_ie.buf, ie_len); - } - - return ret; -} - -static int rtw_set_hidden_ssid(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *adapter = rtw_netdev_priv(dev); - struct mlme_priv *mlmepriv = &adapter->mlmepriv; - struct mlme_ext_priv *mlmeext = &adapter->mlmeextpriv; - struct mlme_ext_info *mlmeinfo = &mlmeext->mlmext_info; - int ie_len; - u8 *ssid_ie; - char ssid[NDIS_802_11_LENGTH_SSID + 1]; - signed int ssid_len; - u8 ignore_broadcast_ssid; - - if (check_fwstate(mlmepriv, WIFI_AP_STATE) != true) - return -EPERM; - - if (param->u.bcn_ie.reserved[0] != 0xea) - return -EINVAL; - - mlmeinfo->hidden_ssid_mode = ignore_broadcast_ssid = param->u.bcn_ie.reserved[1]; - - ie_len = len - 12 - 2;/* 12 = param header, 2:no packed */ - ssid_ie = rtw_get_ie(param->u.bcn_ie.buf, WLAN_EID_SSID, &ssid_len, ie_len); - - if (ssid_ie && ssid_len > 0 && ssid_len <= NDIS_802_11_LENGTH_SSID) { - struct wlan_bssid_ex *pbss_network = &mlmepriv->cur_network.network; - struct wlan_bssid_ex *pbss_network_ext = &mlmeinfo->network; - - memcpy(ssid, ssid_ie + 2, ssid_len); - ssid[ssid_len] = 0x0; - - memcpy(pbss_network->ssid.ssid, (void *)ssid, ssid_len); - pbss_network->ssid.ssid_length = ssid_len; - memcpy(pbss_network_ext->ssid.ssid, (void *)ssid, ssid_len); - pbss_network_ext->ssid.ssid_length = ssid_len; - } - - return ret; -} - -static int rtw_ioctl_acl_remove_sta(struct net_device *dev, struct ieee_param *param, int len) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - rtw_acl_remove_sta(padapter, param->sta_addr); - return 0; -} - -static int rtw_ioctl_acl_add_sta(struct net_device *dev, struct ieee_param *param, int len) -{ - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && - param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && - param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - return -EINVAL; - } - - return rtw_acl_add_sta(padapter, param->sta_addr); -} - -static int rtw_ioctl_set_macaddr_acl(struct net_device *dev, struct ieee_param *param, int len) -{ - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - struct mlme_priv *pmlmepriv = &padapter->mlmepriv; - - if (check_fwstate(pmlmepriv, WIFI_AP_STATE) != true) - return -EINVAL; - - rtw_set_macaddr_acl(padapter, param->u.mlme.command); - - return ret; -} - -static int rtw_hostapd_ioctl(struct net_device *dev, struct iw_point *p) -{ - struct ieee_param *param; - int ret = 0; - struct adapter *padapter = rtw_netdev_priv(dev); - - /* - * this function is expect to call in master mode, which allows no power saving - * so, we just check hw_init_completed - */ - - if (!padapter->hw_init_completed) - return -EPERM; - - if (!p->pointer || p->length != sizeof(*param)) - return -EINVAL; - - param = rtw_malloc(p->length); - if (!param) - return -ENOMEM; - - if (copy_from_user(param, p->pointer, p->length)) { - kfree(param); - return -EFAULT; - } - - switch (param->cmd) { - case RTL871X_HOSTAPD_FLUSH: - - rtw_hostapd_sta_flush(dev); - - break; - - case RTL871X_HOSTAPD_ADD_STA: - - ret = rtw_add_sta(dev, param); - - break; - - case RTL871X_HOSTAPD_REMOVE_STA: - - ret = rtw_del_sta(dev, param); - - break; - - case RTL871X_HOSTAPD_SET_BEACON: - - ret = rtw_set_beacon(dev, param, p->length); - - break; - - case RTL871X_SET_ENCRYPTION: - - ret = rtw_set_encryption(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_GET_WPAIE_STA: - - ret = rtw_get_sta_wpaie(dev, param); - - break; - - case RTL871X_HOSTAPD_SET_WPS_BEACON: - - ret = rtw_set_wps_beacon(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_WPS_PROBE_RESP: - - ret = rtw_set_wps_probe_resp(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_WPS_ASSOC_RESP: - - ret = rtw_set_wps_assoc_resp(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_HIDDEN_SSID: - - ret = rtw_set_hidden_ssid(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_GET_INFO_STA: - - ret = rtw_ioctl_get_sta_data(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_SET_MACADDR_ACL: - - ret = rtw_ioctl_set_macaddr_acl(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_ACL_ADD_STA: - - ret = rtw_ioctl_acl_add_sta(dev, param, p->length); - - break; - - case RTL871X_HOSTAPD_ACL_REMOVE_STA: - - ret = rtw_ioctl_acl_remove_sta(dev, param, p->length); - - break; - - default: - ret = -EOPNOTSUPP; - break; - } - - if (ret == 0 && copy_to_user(p->pointer, param, p->length)) - ret = -EFAULT; - - kfree(param); - return ret; -} - -/* copy from net/wireless/wext.c end */ - -int rtw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct iwreq *wrq = (struct iwreq *)rq; - int ret = 0; - - switch (cmd) { - case RTL_IOCTL_WPA_SUPPLICANT: - ret = wpa_supplicant_ioctl(dev, &wrq->u.data); - break; - case RTL_IOCTL_HOSTAPD: - ret = rtw_hostapd_ioctl(dev, &wrq->u.data); - break; - default: - ret = -EOPNOTSUPP; - break; - } - - return ret; -} diff --git a/drivers/staging/rtl8723bs/os_dep/os_intfs.c b/drivers/staging/rtl8723bs/os_dep/os_intfs.c index 4e1917c05402..738a601c55bb 100644 --- a/drivers/staging/rtl8723bs/os_dep/os_intfs.c +++ b/drivers/staging/rtl8723bs/os_dep/os_intfs.c @@ -407,7 +407,6 @@ static const struct net_device_ops rtw_netdev_ops = { .ndo_select_queue = rtw_select_queue, .ndo_set_mac_address = rtw_net_set_mac_address, .ndo_get_stats = rtw_net_get_stats, - .ndo_do_ioctl = rtw_ioctl, }; int rtw_init_netdev_name(struct net_device *pnetdev, const char *ifname) From 9125aa208a17cbbd3fdcc7953bb41d2d2fd35df0 Mon Sep 17 00:00:00 2001 From: Sandeep Salwan Date: Fri, 10 Jan 2025 18:38:34 -0500 Subject: [PATCH 27/38] staging: gpib: Remove commented-out debug code Code cleanup. This code has some debug code which is commented out. Delete it. Signed-off-by: Sandeep Salwan Reviewed-by: Dan Carpenter Link: https://lore.kernel.org/r/20250110233834.64147-1-salwansandeep5@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/agilent_82350b/agilent_82350b.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c index 6d13b8eb481e..fc5d29f6488b 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c @@ -30,11 +30,8 @@ int agilent_82350b_accel_read(gpib_board_t *board, uint8_t *buffer, size_t lengt unsigned short event_status; int i, num_fifo_bytes; //hardware doesn't support checking for end-of-string character when using fifo - if (tms_priv->eos_flags & REOS) { - //pr_info("ag-rd: using tms9914 read for REOS %x EOS %x\n",tms_priv->eos_flags, - // tms_priv->eos); + if (tms_priv->eos_flags & REOS) return tms9914_read(board, tms_priv, buffer, length, end, bytes_read); - } clear_bit(DEV_CLEAR_BN, &tms_priv->state); From 95cfc75234534b117fa5762696f0cd4a29243796 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Sat, 11 Jan 2025 17:05:14 +0100 Subject: [PATCH 28/38] staging: gpib: Modernize gpib_interface_t initialization and make static All interface drivers were using the old style initialization of this struct field : value; This generated the followng sparse warning, for example: agilent_82357a/agilent_82357a.c:1492:1: warning: obsolete struct initializer, use C99 syntax Change the initialization to use the C99 syntax .field = value; This also resolves the checkpatch constraint of no indentation These structs were also not declared as static, unnecessarily polluting the symbol namespace and generating the following sparse warnings, for example: agilent_82357a/agilent_82357a.c:1465:18: warning: symbol 'agilent_82357a_gpib_interface' was not declared. Should it be static? Declare them as static and remove any conflicting extern declarations in the corresponding include files. Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250111160514.26954-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../gpib/agilent_82350b/agilent_82350b.c | 100 ++-- .../gpib/agilent_82350b/agilent_82350b.h | 2 - .../gpib/agilent_82357a/agilent_82357a.c | 56 +- drivers/staging/gpib/cb7210/cb7210.c | 464 ++++++++-------- drivers/staging/gpib/cb7210/cb7210.h | 5 - drivers/staging/gpib/cec/cec.h | 4 - drivers/staging/gpib/cec/cec_gpib.c | 52 +- drivers/staging/gpib/eastwood/fluke_gpib.c | 150 ++--- drivers/staging/gpib/fmh_gpib/fmh_gpib.c | 208 +++---- drivers/staging/gpib/gpio/gpib_bitbang.c | 50 +- drivers/staging/gpib/hp_82335/hp82335.c | 52 +- drivers/staging/gpib/hp_82335/hp82335.h | 3 - drivers/staging/gpib/hp_82341/hp_82341.c | 102 ++-- drivers/staging/gpib/hp_82341/hp_82341.h | 2 - drivers/staging/gpib/ines/ines.h | 7 - drivers/staging/gpib/ines/ines_gpib.c | 364 ++++++------ .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 54 +- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 54 +- drivers/staging/gpib/pc2/pc2_gpib.c | 208 +++---- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 520 +++++++++--------- 20 files changed, 1217 insertions(+), 1240 deletions(-) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c index fc5d29f6488b..05490d1abc96 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c @@ -825,58 +825,58 @@ void agilent_82350b_detach(gpib_board_t *board) agilent_82350b_free_private(board); } -gpib_interface_t agilent_82350b_unaccel_interface = { -name: "agilent_82350b_unaccel", -attach : agilent_82350b_unaccel_attach, -detach : agilent_82350b_detach, -read : agilent_82350b_read, -write : agilent_82350b_write, -command : agilent_82350b_command, -request_system_control : agilent_82350b_request_system_control, -take_control : agilent_82350b_take_control, -go_to_standby : agilent_82350b_go_to_standby, -interface_clear : agilent_82350b_interface_clear, -remote_enable : agilent_82350b_remote_enable, -enable_eos : agilent_82350b_enable_eos, -disable_eos : agilent_82350b_disable_eos, -parallel_poll : agilent_82350b_parallel_poll, -parallel_poll_configure : agilent_82350b_parallel_poll_configure, -parallel_poll_response : agilent_82350b_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : agilent_82350b_line_status, -update_status : agilent_82350b_update_status, -primary_address : agilent_82350b_primary_address, -secondary_address : agilent_82350b_secondary_address, -serial_poll_response : agilent_82350b_serial_poll_response, -t1_delay : agilent_82350b_t1_delay, -return_to_local : agilent_82350b_return_to_local, +static gpib_interface_t agilent_82350b_unaccel_interface = { + .name = "agilent_82350b_unaccel", + .attach = agilent_82350b_unaccel_attach, + .detach = agilent_82350b_detach, + .read = agilent_82350b_read, + .write = agilent_82350b_write, + .command = agilent_82350b_command, + .request_system_control = agilent_82350b_request_system_control, + .take_control = agilent_82350b_take_control, + .go_to_standby = agilent_82350b_go_to_standby, + .interface_clear = agilent_82350b_interface_clear, + .remote_enable = agilent_82350b_remote_enable, + .enable_eos = agilent_82350b_enable_eos, + .disable_eos = agilent_82350b_disable_eos, + .parallel_poll = agilent_82350b_parallel_poll, + .parallel_poll_configure = agilent_82350b_parallel_poll_configure, + .parallel_poll_response = agilent_82350b_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = agilent_82350b_line_status, + .update_status = agilent_82350b_update_status, + .primary_address = agilent_82350b_primary_address, + .secondary_address = agilent_82350b_secondary_address, + .serial_poll_response = agilent_82350b_serial_poll_response, + .t1_delay = agilent_82350b_t1_delay, + .return_to_local = agilent_82350b_return_to_local, }; -gpib_interface_t agilent_82350b_interface = { -name: "agilent_82350b", -attach : agilent_82350b_accel_attach, -detach : agilent_82350b_detach, -read : agilent_82350b_accel_read, -write : agilent_82350b_accel_write, -command : agilent_82350b_command, -request_system_control : agilent_82350b_request_system_control, -take_control : agilent_82350b_take_control, -go_to_standby : agilent_82350b_go_to_standby, -interface_clear : agilent_82350b_interface_clear, -remote_enable : agilent_82350b_remote_enable, -enable_eos : agilent_82350b_enable_eos, -disable_eos : agilent_82350b_disable_eos, -parallel_poll : agilent_82350b_parallel_poll, -parallel_poll_configure : agilent_82350b_parallel_poll_configure, -parallel_poll_response : agilent_82350b_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : agilent_82350b_line_status, -update_status : agilent_82350b_update_status, -primary_address : agilent_82350b_primary_address, -secondary_address : agilent_82350b_secondary_address, -serial_poll_response : agilent_82350b_serial_poll_response, -t1_delay : agilent_82350b_t1_delay, -return_to_local : agilent_82350b_return_to_local, +static gpib_interface_t agilent_82350b_interface = { + .name = "agilent_82350b", + .attach = agilent_82350b_accel_attach, + .detach = agilent_82350b_detach, + .read = agilent_82350b_accel_read, + .write = agilent_82350b_accel_write, + .command = agilent_82350b_command, + .request_system_control = agilent_82350b_request_system_control, + .take_control = agilent_82350b_take_control, + .go_to_standby = agilent_82350b_go_to_standby, + .interface_clear = agilent_82350b_interface_clear, + .remote_enable = agilent_82350b_remote_enable, + .enable_eos = agilent_82350b_enable_eos, + .disable_eos = agilent_82350b_disable_eos, + .parallel_poll = agilent_82350b_parallel_poll, + .parallel_poll_configure = agilent_82350b_parallel_poll_configure, + .parallel_poll_response = agilent_82350b_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = agilent_82350b_line_status, + .update_status = agilent_82350b_update_status, + .primary_address = agilent_82350b_primary_address, + .secondary_address = agilent_82350b_secondary_address, + .serial_poll_response = agilent_82350b_serial_poll_response, + .t1_delay = agilent_82350b_t1_delay, + .return_to_local = agilent_82350b_return_to_local, }; static int agilent_82350b_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.h b/drivers/staging/gpib/agilent_82350b/agilent_82350b.h index 30683d67d170..6915c1b2c85b 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.h +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.h @@ -60,8 +60,6 @@ struct agilent_82350b_priv { // driver name extern const char *driver_name; -// interfaces -extern gpib_interface_t agilent_82350b_interface; // init functions int agilent_82350b_unaccel_attach(gpib_board_t *board, const gpib_board_config_t *config); diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c index 261fb6d2e991..b21eadabc466 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -1462,34 +1462,34 @@ static void agilent_82357a_detach(gpib_board_t *board) mutex_unlock(&agilent_82357a_hotplug_lock); } -gpib_interface_t agilent_82357a_gpib_interface = { -name: "agilent_82357a", -attach : agilent_82357a_attach, -detach : agilent_82357a_detach, -read : agilent_82357a_read, -write : agilent_82357a_write, -command : agilent_82357a_command, -take_control : agilent_82357a_take_control, -go_to_standby : agilent_82357a_go_to_standby, -request_system_control : agilent_82357a_request_system_control, -interface_clear : agilent_82357a_interface_clear, -remote_enable : agilent_82357a_remote_enable, -enable_eos : agilent_82357a_enable_eos, -disable_eos : agilent_82357a_disable_eos, -parallel_poll : agilent_82357a_parallel_poll, -parallel_poll_configure : agilent_82357a_parallel_poll_configure, -parallel_poll_response : agilent_82357a_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : agilent_82357a_line_status, -update_status : agilent_82357a_update_status, -primary_address : agilent_82357a_primary_address, -secondary_address : agilent_82357a_secondary_address, -serial_poll_response : agilent_82357a_serial_poll_response, -serial_poll_status : agilent_82357a_serial_poll_status, -t1_delay : agilent_82357a_t1_delay, -return_to_local : agilent_82357a_return_to_local, -no_7_bit_eos : 1, -skip_check_for_command_acceptors : 1 +static gpib_interface_t agilent_82357a_gpib_interface = { + .name = "agilent_82357a", + .attach = agilent_82357a_attach, + .detach = agilent_82357a_detach, + .read = agilent_82357a_read, + .write = agilent_82357a_write, + .command = agilent_82357a_command, + .take_control = agilent_82357a_take_control, + .go_to_standby = agilent_82357a_go_to_standby, + .request_system_control = agilent_82357a_request_system_control, + .interface_clear = agilent_82357a_interface_clear, + .remote_enable = agilent_82357a_remote_enable, + .enable_eos = agilent_82357a_enable_eos, + .disable_eos = agilent_82357a_disable_eos, + .parallel_poll = agilent_82357a_parallel_poll, + .parallel_poll_configure = agilent_82357a_parallel_poll_configure, + .parallel_poll_response = agilent_82357a_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = agilent_82357a_line_status, + .update_status = agilent_82357a_update_status, + .primary_address = agilent_82357a_primary_address, + .secondary_address = agilent_82357a_secondary_address, + .serial_poll_response = agilent_82357a_serial_poll_response, + .serial_poll_status = agilent_82357a_serial_poll_status, + .t1_delay = agilent_82357a_t1_delay, + .return_to_local = agilent_82357a_return_to_local, + .no_7_bit_eos = 1, + .skip_check_for_command_acceptors = 1 }; // Table with the USB-devices: just now only testing IDs diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c index f6d40ffd7124..e5436f55c630 100644 --- a/drivers/staging/gpib/cb7210/cb7210.c +++ b/drivers/staging/gpib/cb7210/cb7210.c @@ -683,170 +683,170 @@ void cb7210_return_to_local(gpib_board_t *board) write_byte(nec_priv, AUX_RTL, AUXMR); } -gpib_interface_t cb_pci_unaccel_interface = { -name: "cbi_pci_unaccel", -attach : cb_pci_attach, -detach : cb_pci_detach, -read : cb7210_read, -write : cb7210_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_pci_unaccel_interface = { + .name = "cbi_pci_unaccel", + .attach = cb_pci_attach, + .detach = cb_pci_detach, + .read = cb7210_read, + .write = cb7210_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_pci_accel_interface = { -name: "cbi_pci_accel", -attach : cb_pci_attach, -detach : cb_pci_detach, -read : cb7210_accel_read, -write : cb7210_accel_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_pci_accel_interface = { + .name = "cbi_pci_accel", + .attach = cb_pci_attach, + .detach = cb_pci_detach, + .read = cb7210_accel_read, + .write = cb7210_accel_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_pci_interface = { -name: "cbi_pci", -attach : cb_pci_attach, -detach : cb_pci_detach, -read : cb7210_accel_read, -write : cb7210_accel_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_pci_interface = { + .name = "cbi_pci", + .attach = cb_pci_attach, + .detach = cb_pci_detach, + .read = cb7210_accel_read, + .write = cb7210_accel_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_isa_unaccel_interface = { -name: "cbi_isa_unaccel", -attach : cb_isa_attach, -detach : cb_isa_detach, -read : cb7210_read, -write : cb7210_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_isa_unaccel_interface = { + .name = "cbi_isa_unaccel", + .attach = cb_isa_attach, + .detach = cb_isa_detach, + .read = cb7210_read, + .write = cb7210_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_isa_interface = { -name: "cbi_isa", -attach : cb_isa_attach, -detach : cb_isa_detach, -read : cb7210_accel_read, -write : cb7210_accel_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_isa_interface = { + .name = "cbi_isa", + .attach = cb_isa_attach, + .detach = cb_isa_detach, + .read = cb7210_accel_read, + .write = cb7210_accel_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_isa_accel_interface = { -name: "cbi_isa_accel", -attach : cb_isa_attach, -detach : cb_isa_detach, -read : cb7210_accel_read, -write : cb7210_accel_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_isa_accel_interface = { + .name = "cbi_isa_accel", + .attach = cb_isa_attach, + .detach = cb_isa_detach, + .read = cb7210_accel_read, + .write = cb7210_accel_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; static int cb7210_allocate_private(gpib_board_t *board) @@ -1357,88 +1357,88 @@ void cb_pcmcia_cleanup_module(void) pcmcia_unregister_driver(&cb_gpib_cs_driver); } -gpib_interface_t cb_pcmcia_unaccel_interface = { -name: "cbi_pcmcia_unaccel", -attach : cb_pcmcia_attach, -detach : cb_pcmcia_detach, -read : cb7210_read, -write : cb7210_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_pcmcia_unaccel_interface = { + .name = "cbi_pcmcia_unaccel", + .attach = cb_pcmcia_attach, + .detach = cb_pcmcia_detach, + .read = cb7210_read, + .write = cb7210_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_pcmcia_interface = { -name: "cbi_pcmcia", -attach : cb_pcmcia_attach, -detach : cb_pcmcia_detach, -read : cb7210_accel_read, -write : cb7210_accel_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_pcmcia_interface = { + .name = "cbi_pcmcia", + .attach = cb_pcmcia_attach, + .detach = cb_pcmcia_detach, + .read = cb7210_accel_read, + .write = cb7210_accel_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; -gpib_interface_t cb_pcmcia_accel_interface = { -name: "cbi_pcmcia_accel", -attach : cb_pcmcia_attach, -detach : cb_pcmcia_detach, -read : cb7210_accel_read, -write : cb7210_accel_write, -command : cb7210_command, -take_control : cb7210_take_control, -go_to_standby : cb7210_go_to_standby, -request_system_control : cb7210_request_system_control, -interface_clear : cb7210_interface_clear, -remote_enable : cb7210_remote_enable, -enable_eos : cb7210_enable_eos, -disable_eos : cb7210_disable_eos, -parallel_poll : cb7210_parallel_poll, -parallel_poll_configure : cb7210_parallel_poll_configure, -parallel_poll_response : cb7210_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : cb7210_line_status, -update_status : cb7210_update_status, -primary_address : cb7210_primary_address, -secondary_address : cb7210_secondary_address, -serial_poll_response : cb7210_serial_poll_response, -serial_poll_status : cb7210_serial_poll_status, -t1_delay : cb7210_t1_delay, -return_to_local : cb7210_return_to_local, +static gpib_interface_t cb_pcmcia_accel_interface = { + .name = "cbi_pcmcia_accel", + .attach = cb_pcmcia_attach, + .detach = cb_pcmcia_detach, + .read = cb7210_accel_read, + .write = cb7210_accel_write, + .command = cb7210_command, + .take_control = cb7210_take_control, + .go_to_standby = cb7210_go_to_standby, + .request_system_control = cb7210_request_system_control, + .interface_clear = cb7210_interface_clear, + .remote_enable = cb7210_remote_enable, + .enable_eos = cb7210_enable_eos, + .disable_eos = cb7210_disable_eos, + .parallel_poll = cb7210_parallel_poll, + .parallel_poll_configure = cb7210_parallel_poll_configure, + .parallel_poll_response = cb7210_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = cb7210_line_status, + .update_status = cb7210_update_status, + .primary_address = cb7210_primary_address, + .secondary_address = cb7210_secondary_address, + .serial_poll_response = cb7210_serial_poll_response, + .serial_poll_status = cb7210_serial_poll_status, + .t1_delay = cb7210_t1_delay, + .return_to_local = cb7210_return_to_local, }; int cb_pcmcia_attach(gpib_board_t *board, const gpib_board_config_t *config) diff --git a/drivers/staging/gpib/cb7210/cb7210.h b/drivers/staging/gpib/cb7210/cb7210.h index c17cb22585f7..d56cd905cc8c 100644 --- a/drivers/staging/gpib/cb7210/cb7210.h +++ b/drivers/staging/gpib/cb7210/cb7210.h @@ -36,11 +36,6 @@ struct cb7210_priv { unsigned in_fifo_half_full : 1; }; -// interfaces -extern gpib_interface_t cb_pcmcia_interface; -extern gpib_interface_t cb_pcmcia_accel_interface; -extern gpib_interface_t cb_pcmcia_unaccel_interface; - // interrupt service routines irqreturn_t cb_pci_interrupt(int irq, void *arg); irqreturn_t cb7210_interrupt(int irq, void *arg); diff --git a/drivers/staging/gpib/cec/cec.h b/drivers/staging/gpib/cec/cec.h index 352cf83d8328..040ca70ed708 100644 --- a/drivers/staging/gpib/cec/cec.h +++ b/drivers/staging/gpib/cec/cec.h @@ -16,10 +16,6 @@ struct cec_priv { unsigned int irq; }; -// interfaces -extern gpib_interface_t cec_pci_interface; -extern gpib_interface_t cec_pcmcia_interface; - // interface functions int cec_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); int cec_write(gpib_board_t *board, uint8_t *buffer, size_t length, int send_eoi, diff --git a/drivers/staging/gpib/cec/cec_gpib.c b/drivers/staging/gpib/cec/cec_gpib.c index 21837b3498de..d056cd1d6b3e 100644 --- a/drivers/staging/gpib/cec/cec_gpib.c +++ b/drivers/staging/gpib/cec/cec_gpib.c @@ -182,32 +182,32 @@ void cec_return_to_local(gpib_board_t *board) nec7210_return_to_local(board, &priv->nec7210_priv); } -gpib_interface_t cec_pci_interface = { -name: "cec_pci", -attach : cec_pci_attach, -detach : cec_pci_detach, -read : cec_read, -write : cec_write, -command : cec_command, -take_control : cec_take_control, -go_to_standby : cec_go_to_standby, -request_system_control : cec_request_system_control, -interface_clear : cec_interface_clear, -remote_enable : cec_remote_enable, -enable_eos : cec_enable_eos, -disable_eos : cec_disable_eos, -parallel_poll : cec_parallel_poll, -parallel_poll_configure : cec_parallel_poll_configure, -parallel_poll_response : cec_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, //XXX -update_status : cec_update_status, -primary_address : cec_primary_address, -secondary_address : cec_secondary_address, -serial_poll_response : cec_serial_poll_response, -serial_poll_status : cec_serial_poll_status, -t1_delay : cec_t1_delay, -return_to_local : cec_return_to_local, +static gpib_interface_t cec_pci_interface = { + .name = "cec_pci", + .attach = cec_pci_attach, + .detach = cec_pci_detach, + .read = cec_read, + .write = cec_write, + .command = cec_command, + .take_control = cec_take_control, + .go_to_standby = cec_go_to_standby, + .request_system_control = cec_request_system_control, + .interface_clear = cec_interface_clear, + .remote_enable = cec_remote_enable, + .enable_eos = cec_enable_eos, + .disable_eos = cec_disable_eos, + .parallel_poll = cec_parallel_poll, + .parallel_poll_configure = cec_parallel_poll_configure, + .parallel_poll_response = cec_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, //XXX + .update_status = cec_update_status, + .primary_address = cec_primary_address, + .secondary_address = cec_secondary_address, + .serial_poll_response = cec_serial_poll_response, + .serial_poll_status = cec_serial_poll_status, + .t1_delay = cec_t1_delay, + .return_to_local = cec_return_to_local, }; static int cec_allocate_private(gpib_board_t *board) diff --git a/drivers/staging/gpib/eastwood/fluke_gpib.c b/drivers/staging/gpib/eastwood/fluke_gpib.c index 446a5ef7ef92..0304c5de4ccd 100644 --- a/drivers/staging/gpib/eastwood/fluke_gpib.c +++ b/drivers/staging/gpib/eastwood/fluke_gpib.c @@ -720,31 +720,31 @@ static int fluke_accel_read(gpib_board_t *board, uint8_t *buffer, size_t length, return retval; } -gpib_interface_t fluke_unaccel_interface = { -name: "fluke_unaccel", -attach : fluke_attach_holdoff_all, -detach : fluke_detach, -read : fluke_read, -write : fluke_write, -command : fluke_command, -take_control : fluke_take_control, -go_to_standby : fluke_go_to_standby, -request_system_control : fluke_request_system_control, -interface_clear : fluke_interface_clear, -remote_enable : fluke_remote_enable, -enable_eos : fluke_enable_eos, -disable_eos : fluke_disable_eos, -parallel_poll : fluke_parallel_poll, -parallel_poll_configure : fluke_parallel_poll_configure, -parallel_poll_response : fluke_parallel_poll_response, -line_status : fluke_line_status, -update_status : fluke_update_status, -primary_address : fluke_primary_address, -secondary_address : fluke_secondary_address, -serial_poll_response : fluke_serial_poll_response, -serial_poll_status : fluke_serial_poll_status, -t1_delay : fluke_t1_delay, -return_to_local : fluke_return_to_local, +static gpib_interface_t fluke_unaccel_interface = { + .name = "fluke_unaccel", + .attach = fluke_attach_holdoff_all, + .detach = fluke_detach, + .read = fluke_read, + .write = fluke_write, + .command = fluke_command, + .take_control = fluke_take_control, + .go_to_standby = fluke_go_to_standby, + .request_system_control = fluke_request_system_control, + .interface_clear = fluke_interface_clear, + .remote_enable = fluke_remote_enable, + .enable_eos = fluke_enable_eos, + .disable_eos = fluke_disable_eos, + .parallel_poll = fluke_parallel_poll, + .parallel_poll_configure = fluke_parallel_poll_configure, + .parallel_poll_response = fluke_parallel_poll_response, + .line_status = fluke_line_status, + .update_status = fluke_update_status, + .primary_address = fluke_primary_address, + .secondary_address = fluke_secondary_address, + .serial_poll_response = fluke_serial_poll_response, + .serial_poll_status = fluke_serial_poll_status, + .t1_delay = fluke_t1_delay, + .return_to_local = fluke_return_to_local, }; /* fluke_hybrid uses dma for writes but not for reads. Added @@ -755,58 +755,58 @@ return_to_local : fluke_return_to_local, * register just as the dma controller is also doing a read. */ -gpib_interface_t fluke_hybrid_interface = { -name: "fluke_hybrid", -attach : fluke_attach_holdoff_all, -detach : fluke_detach, -read : fluke_read, -write : fluke_accel_write, -command : fluke_command, -take_control : fluke_take_control, -go_to_standby : fluke_go_to_standby, -request_system_control : fluke_request_system_control, -interface_clear : fluke_interface_clear, -remote_enable : fluke_remote_enable, -enable_eos : fluke_enable_eos, -disable_eos : fluke_disable_eos, -parallel_poll : fluke_parallel_poll, -parallel_poll_configure : fluke_parallel_poll_configure, -parallel_poll_response : fluke_parallel_poll_response, -line_status : fluke_line_status, -update_status : fluke_update_status, -primary_address : fluke_primary_address, -secondary_address : fluke_secondary_address, -serial_poll_response : fluke_serial_poll_response, -serial_poll_status : fluke_serial_poll_status, -t1_delay : fluke_t1_delay, -return_to_local : fluke_return_to_local, +static gpib_interface_t fluke_hybrid_interface = { + .name = "fluke_hybrid", + .attach = fluke_attach_holdoff_all, + .detach = fluke_detach, + .read = fluke_read, + .write = fluke_accel_write, + .command = fluke_command, + .take_control = fluke_take_control, + .go_to_standby = fluke_go_to_standby, + .request_system_control = fluke_request_system_control, + .interface_clear = fluke_interface_clear, + .remote_enable = fluke_remote_enable, + .enable_eos = fluke_enable_eos, + .disable_eos = fluke_disable_eos, + .parallel_poll = fluke_parallel_poll, + .parallel_poll_configure = fluke_parallel_poll_configure, + .parallel_poll_response = fluke_parallel_poll_response, + .line_status = fluke_line_status, + .update_status = fluke_update_status, + .primary_address = fluke_primary_address, + .secondary_address = fluke_secondary_address, + .serial_poll_response = fluke_serial_poll_response, + .serial_poll_status = fluke_serial_poll_status, + .t1_delay = fluke_t1_delay, + .return_to_local = fluke_return_to_local, }; -gpib_interface_t fluke_interface = { -name: "fluke", -attach : fluke_attach_holdoff_end, -detach : fluke_detach, -read : fluke_accel_read, -write : fluke_accel_write, -command : fluke_command, -take_control : fluke_take_control, -go_to_standby : fluke_go_to_standby, -request_system_control : fluke_request_system_control, -interface_clear : fluke_interface_clear, -remote_enable : fluke_remote_enable, -enable_eos : fluke_enable_eos, -disable_eos : fluke_disable_eos, -parallel_poll : fluke_parallel_poll, -parallel_poll_configure : fluke_parallel_poll_configure, -parallel_poll_response : fluke_parallel_poll_response, -line_status : fluke_line_status, -update_status : fluke_update_status, -primary_address : fluke_primary_address, -secondary_address : fluke_secondary_address, -serial_poll_response : fluke_serial_poll_response, -serial_poll_status : fluke_serial_poll_status, -t1_delay : fluke_t1_delay, -return_to_local : fluke_return_to_local, +static gpib_interface_t fluke_interface = { + .name = "fluke", + .attach = fluke_attach_holdoff_end, + .detach = fluke_detach, + .read = fluke_accel_read, + .write = fluke_accel_write, + .command = fluke_command, + .take_control = fluke_take_control, + .go_to_standby = fluke_go_to_standby, + .request_system_control = fluke_request_system_control, + .interface_clear = fluke_interface_clear, + .remote_enable = fluke_remote_enable, + .enable_eos = fluke_enable_eos, + .disable_eos = fluke_disable_eos, + .parallel_poll = fluke_parallel_poll, + .parallel_poll_configure = fluke_parallel_poll_configure, + .parallel_poll_response = fluke_parallel_poll_response, + .line_status = fluke_line_status, + .update_status = fluke_update_status, + .primary_address = fluke_primary_address, + .secondary_address = fluke_secondary_address, + .serial_poll_response = fluke_serial_poll_response, + .serial_poll_status = fluke_serial_poll_status, + .t1_delay = fluke_t1_delay, + .return_to_local = fluke_return_to_local, }; irqreturn_t fluke_gpib_internal_interrupt(gpib_board_t *board) diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c index 41f42d28bff0..f950e7cdd8f8 100644 --- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.c +++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.c @@ -1040,116 +1040,116 @@ static int fmh_gpib_fifo_read(gpib_board_t *board, uint8_t *buffer, size_t lengt return retval; } -gpib_interface_t fmh_gpib_unaccel_interface = { -name: "fmh_gpib_unaccel", -attach : fmh_gpib_attach_holdoff_all, -detach : fmh_gpib_detach, -read : fmh_gpib_read, -write : fmh_gpib_write, -command : fmh_gpib_command, -take_control : fmh_gpib_take_control, -go_to_standby : fmh_gpib_go_to_standby, -request_system_control : fmh_gpib_request_system_control, -interface_clear : fmh_gpib_interface_clear, -remote_enable : fmh_gpib_remote_enable, -enable_eos : fmh_gpib_enable_eos, -disable_eos : fmh_gpib_disable_eos, -parallel_poll : fmh_gpib_parallel_poll, -parallel_poll_configure : fmh_gpib_parallel_poll_configure, -parallel_poll_response : fmh_gpib_parallel_poll_response, -local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, -line_status : fmh_gpib_line_status, -update_status : fmh_gpib_update_status, -primary_address : fmh_gpib_primary_address, -secondary_address : fmh_gpib_secondary_address, -serial_poll_response2 : fmh_gpib_serial_poll_response2, -serial_poll_status : fmh_gpib_serial_poll_status, -t1_delay : fmh_gpib_t1_delay, -return_to_local : fmh_gpib_return_to_local, +static gpib_interface_t fmh_gpib_unaccel_interface = { + .name = "fmh_gpib_unaccel", + .attach = fmh_gpib_attach_holdoff_all, + .detach = fmh_gpib_detach, + .read = fmh_gpib_read, + .write = fmh_gpib_write, + .command = fmh_gpib_command, + .take_control = fmh_gpib_take_control, + .go_to_standby = fmh_gpib_go_to_standby, + .request_system_control = fmh_gpib_request_system_control, + .interface_clear = fmh_gpib_interface_clear, + .remote_enable = fmh_gpib_remote_enable, + .enable_eos = fmh_gpib_enable_eos, + .disable_eos = fmh_gpib_disable_eos, + .parallel_poll = fmh_gpib_parallel_poll, + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, + .parallel_poll_response = fmh_gpib_parallel_poll_response, + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, + .line_status = fmh_gpib_line_status, + .update_status = fmh_gpib_update_status, + .primary_address = fmh_gpib_primary_address, + .secondary_address = fmh_gpib_secondary_address, + .serial_poll_response2 = fmh_gpib_serial_poll_response2, + .serial_poll_status = fmh_gpib_serial_poll_status, + .t1_delay = fmh_gpib_t1_delay, + .return_to_local = fmh_gpib_return_to_local, }; -gpib_interface_t fmh_gpib_interface = { -name: "fmh_gpib", -attach : fmh_gpib_attach_holdoff_end, -detach : fmh_gpib_detach, -read : fmh_gpib_accel_read, -write : fmh_gpib_accel_write, -command : fmh_gpib_command, -take_control : fmh_gpib_take_control, -go_to_standby : fmh_gpib_go_to_standby, -request_system_control : fmh_gpib_request_system_control, -interface_clear : fmh_gpib_interface_clear, -remote_enable : fmh_gpib_remote_enable, -enable_eos : fmh_gpib_enable_eos, -disable_eos : fmh_gpib_disable_eos, -parallel_poll : fmh_gpib_parallel_poll, -parallel_poll_configure : fmh_gpib_parallel_poll_configure, -parallel_poll_response : fmh_gpib_parallel_poll_response, -local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, -line_status : fmh_gpib_line_status, -update_status : fmh_gpib_update_status, -primary_address : fmh_gpib_primary_address, -secondary_address : fmh_gpib_secondary_address, -serial_poll_response2 : fmh_gpib_serial_poll_response2, -serial_poll_status : fmh_gpib_serial_poll_status, -t1_delay : fmh_gpib_t1_delay, -return_to_local : fmh_gpib_return_to_local, +static gpib_interface_t fmh_gpib_interface = { + .name = "fmh_gpib", + .attach = fmh_gpib_attach_holdoff_end, + .detach = fmh_gpib_detach, + .read = fmh_gpib_accel_read, + .write = fmh_gpib_accel_write, + .command = fmh_gpib_command, + .take_control = fmh_gpib_take_control, + .go_to_standby = fmh_gpib_go_to_standby, + .request_system_control = fmh_gpib_request_system_control, + .interface_clear = fmh_gpib_interface_clear, + .remote_enable = fmh_gpib_remote_enable, + .enable_eos = fmh_gpib_enable_eos, + .disable_eos = fmh_gpib_disable_eos, + .parallel_poll = fmh_gpib_parallel_poll, + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, + .parallel_poll_response = fmh_gpib_parallel_poll_response, + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, + .line_status = fmh_gpib_line_status, + .update_status = fmh_gpib_update_status, + .primary_address = fmh_gpib_primary_address, + .secondary_address = fmh_gpib_secondary_address, + .serial_poll_response2 = fmh_gpib_serial_poll_response2, + .serial_poll_status = fmh_gpib_serial_poll_status, + .t1_delay = fmh_gpib_t1_delay, + .return_to_local = fmh_gpib_return_to_local, }; -gpib_interface_t fmh_gpib_pci_interface = { -name: "fmh_gpib_pci", -attach : fmh_gpib_pci_attach_holdoff_end, -detach : fmh_gpib_pci_detach, -read : fmh_gpib_fifo_read, -write : fmh_gpib_fifo_write, -command : fmh_gpib_command, -take_control : fmh_gpib_take_control, -go_to_standby : fmh_gpib_go_to_standby, -request_system_control : fmh_gpib_request_system_control, -interface_clear : fmh_gpib_interface_clear, -remote_enable : fmh_gpib_remote_enable, -enable_eos : fmh_gpib_enable_eos, -disable_eos : fmh_gpib_disable_eos, -parallel_poll : fmh_gpib_parallel_poll, -parallel_poll_configure : fmh_gpib_parallel_poll_configure, -parallel_poll_response : fmh_gpib_parallel_poll_response, -local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, -line_status : fmh_gpib_line_status, -update_status : fmh_gpib_update_status, -primary_address : fmh_gpib_primary_address, -secondary_address : fmh_gpib_secondary_address, -serial_poll_response2 : fmh_gpib_serial_poll_response2, -serial_poll_status : fmh_gpib_serial_poll_status, -t1_delay : fmh_gpib_t1_delay, -return_to_local : fmh_gpib_return_to_local, +static gpib_interface_t fmh_gpib_pci_interface = { + .name = "fmh_gpib_pci", + .attach = fmh_gpib_pci_attach_holdoff_end, + .detach = fmh_gpib_pci_detach, + .read = fmh_gpib_fifo_read, + .write = fmh_gpib_fifo_write, + .command = fmh_gpib_command, + .take_control = fmh_gpib_take_control, + .go_to_standby = fmh_gpib_go_to_standby, + .request_system_control = fmh_gpib_request_system_control, + .interface_clear = fmh_gpib_interface_clear, + .remote_enable = fmh_gpib_remote_enable, + .enable_eos = fmh_gpib_enable_eos, + .disable_eos = fmh_gpib_disable_eos, + .parallel_poll = fmh_gpib_parallel_poll, + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, + .parallel_poll_response = fmh_gpib_parallel_poll_response, + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, + .line_status = fmh_gpib_line_status, + .update_status = fmh_gpib_update_status, + .primary_address = fmh_gpib_primary_address, + .secondary_address = fmh_gpib_secondary_address, + .serial_poll_response2 = fmh_gpib_serial_poll_response2, + .serial_poll_status = fmh_gpib_serial_poll_status, + .t1_delay = fmh_gpib_t1_delay, + .return_to_local = fmh_gpib_return_to_local, }; -gpib_interface_t fmh_gpib_pci_unaccel_interface = { -name: "fmh_gpib_pci_unaccel", -attach : fmh_gpib_pci_attach_holdoff_all, -detach : fmh_gpib_pci_detach, -read : fmh_gpib_read, -write : fmh_gpib_write, -command : fmh_gpib_command, -take_control : fmh_gpib_take_control, -go_to_standby : fmh_gpib_go_to_standby, -request_system_control : fmh_gpib_request_system_control, -interface_clear : fmh_gpib_interface_clear, -remote_enable : fmh_gpib_remote_enable, -enable_eos : fmh_gpib_enable_eos, -disable_eos : fmh_gpib_disable_eos, -parallel_poll : fmh_gpib_parallel_poll, -parallel_poll_configure : fmh_gpib_parallel_poll_configure, -parallel_poll_response : fmh_gpib_parallel_poll_response, -local_parallel_poll_mode : fmh_gpib_local_parallel_poll_mode, -line_status : fmh_gpib_line_status, -update_status : fmh_gpib_update_status, -primary_address : fmh_gpib_primary_address, -secondary_address : fmh_gpib_secondary_address, -serial_poll_response2 : fmh_gpib_serial_poll_response2, -serial_poll_status : fmh_gpib_serial_poll_status, -t1_delay : fmh_gpib_t1_delay, -return_to_local : fmh_gpib_return_to_local, +static gpib_interface_t fmh_gpib_pci_unaccel_interface = { + .name = "fmh_gpib_pci_unaccel", + .attach = fmh_gpib_pci_attach_holdoff_all, + .detach = fmh_gpib_pci_detach, + .read = fmh_gpib_read, + .write = fmh_gpib_write, + .command = fmh_gpib_command, + .take_control = fmh_gpib_take_control, + .go_to_standby = fmh_gpib_go_to_standby, + .request_system_control = fmh_gpib_request_system_control, + .interface_clear = fmh_gpib_interface_clear, + .remote_enable = fmh_gpib_remote_enable, + .enable_eos = fmh_gpib_enable_eos, + .disable_eos = fmh_gpib_disable_eos, + .parallel_poll = fmh_gpib_parallel_poll, + .parallel_poll_configure = fmh_gpib_parallel_poll_configure, + .parallel_poll_response = fmh_gpib_parallel_poll_response, + .local_parallel_poll_mode = fmh_gpib_local_parallel_poll_mode, + .line_status = fmh_gpib_line_status, + .update_status = fmh_gpib_update_status, + .primary_address = fmh_gpib_primary_address, + .secondary_address = fmh_gpib_secondary_address, + .serial_poll_response2 = fmh_gpib_serial_poll_response2, + .serial_poll_status = fmh_gpib_serial_poll_status, + .t1_delay = fmh_gpib_t1_delay, + .return_to_local = fmh_gpib_return_to_local, }; irqreturn_t fmh_gpib_internal_interrupt(gpib_board_t *board) diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c index 403738b5eb0b..ad49a5644ab8 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -1312,31 +1312,31 @@ static int bb_attach(gpib_board_t *board, const gpib_board_config_t *config) return retval; } -gpib_interface_t bb_interface = { -name: NAME, -attach : bb_attach, -detach : bb_detach, -read : bb_read, -write : bb_write, -command : bb_command, -take_control : bb_take_control, -go_to_standby : bb_go_to_standby, -request_system_control : bb_request_system_control, -interface_clear : bb_interface_clear, -remote_enable : bb_remote_enable, -enable_eos : bb_enable_eos, -disable_eos : bb_disable_eos, -parallel_poll : bb_parallel_poll, -parallel_poll_configure : bb_parallel_poll_configure, -parallel_poll_response : bb_parallel_poll_response, -line_status : bb_line_status, -update_status : bb_update_status, -primary_address : bb_primary_address, -secondary_address : bb_secondary_address, -serial_poll_response : bb_serial_poll_response, -serial_poll_status : bb_serial_poll_status, -t1_delay : bb_t1_delay, -return_to_local : bb_return_to_local, +static gpib_interface_t bb_interface = { + .name = NAME, + .attach = bb_attach, + .detach = bb_detach, + .read = bb_read, + .write = bb_write, + .command = bb_command, + .take_control = bb_take_control, + .go_to_standby = bb_go_to_standby, + .request_system_control = bb_request_system_control, + .interface_clear = bb_interface_clear, + .remote_enable = bb_remote_enable, + .enable_eos = bb_enable_eos, + .disable_eos = bb_disable_eos, + .parallel_poll = bb_parallel_poll, + .parallel_poll_configure = bb_parallel_poll_configure, + .parallel_poll_response = bb_parallel_poll_response, + .line_status = bb_line_status, + .update_status = bb_update_status, + .primary_address = bb_primary_address, + .secondary_address = bb_secondary_address, + .serial_poll_response = bb_serial_poll_response, + .serial_poll_status = bb_serial_poll_status, + .t1_delay = bb_t1_delay, + .return_to_local = bb_return_to_local, }; static int __init bb_init_module(void) diff --git a/drivers/staging/gpib/hp_82335/hp82335.c b/drivers/staging/gpib/hp_82335/hp82335.c index ceccc520e83f..700d1ba029d2 100644 --- a/drivers/staging/gpib/hp_82335/hp82335.c +++ b/drivers/staging/gpib/hp_82335/hp82335.c @@ -173,32 +173,32 @@ void hp82335_return_to_local(gpib_board_t *board) tms9914_return_to_local(board, &priv->tms9914_priv); } -gpib_interface_t hp82335_interface = { -name: "hp82335", -attach : hp82335_attach, -detach : hp82335_detach, -read : hp82335_read, -write : hp82335_write, -command : hp82335_command, -request_system_control : hp82335_request_system_control, -take_control : hp82335_take_control, -go_to_standby : hp82335_go_to_standby, -interface_clear : hp82335_interface_clear, -remote_enable : hp82335_remote_enable, -enable_eos : hp82335_enable_eos, -disable_eos : hp82335_disable_eos, -parallel_poll : hp82335_parallel_poll, -parallel_poll_configure : hp82335_parallel_poll_configure, -parallel_poll_response : hp82335_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : hp82335_line_status, -update_status : hp82335_update_status, -primary_address : hp82335_primary_address, -secondary_address : hp82335_secondary_address, -serial_poll_response : hp82335_serial_poll_response, -serial_poll_status : hp82335_serial_poll_status, -t1_delay : hp82335_t1_delay, -return_to_local : hp82335_return_to_local, +static gpib_interface_t hp82335_interface = { + .name = "hp82335", + .attach = hp82335_attach, + .detach = hp82335_detach, + .read = hp82335_read, + .write = hp82335_write, + .command = hp82335_command, + .request_system_control = hp82335_request_system_control, + .take_control = hp82335_take_control, + .go_to_standby = hp82335_go_to_standby, + .interface_clear = hp82335_interface_clear, + .remote_enable = hp82335_remote_enable, + .enable_eos = hp82335_enable_eos, + .disable_eos = hp82335_disable_eos, + .parallel_poll = hp82335_parallel_poll, + .parallel_poll_configure = hp82335_parallel_poll_configure, + .parallel_poll_response = hp82335_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = hp82335_line_status, + .update_status = hp82335_update_status, + .primary_address = hp82335_primary_address, + .secondary_address = hp82335_secondary_address, + .serial_poll_response = hp82335_serial_poll_response, + .serial_poll_status = hp82335_serial_poll_status, + .t1_delay = hp82335_t1_delay, + .return_to_local = hp82335_return_to_local, }; int hp82335_allocate_private(gpib_board_t *board) diff --git a/drivers/staging/gpib/hp_82335/hp82335.h b/drivers/staging/gpib/hp_82335/hp82335.h index 5e5297af731a..4b185d7c5188 100644 --- a/drivers/staging/gpib/hp_82335/hp82335.h +++ b/drivers/staging/gpib/hp_82335/hp82335.h @@ -17,9 +17,6 @@ struct hp82335_priv { unsigned long raw_iobase; }; -// interfaces -extern gpib_interface_t hp82335_interface; - // interface functions int hp82335_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); int hp82335_write(gpib_board_t *board, uint8_t *buffer, size_t length, diff --git a/drivers/staging/gpib/hp_82341/hp_82341.c b/drivers/staging/gpib/hp_82341/hp_82341.c index a4bf47d0c438..0ddae295912f 100644 --- a/drivers/staging/gpib/hp_82341/hp_82341.c +++ b/drivers/staging/gpib/hp_82341/hp_82341.c @@ -402,59 +402,59 @@ void hp_82341_return_to_local(gpib_board_t *board) tms9914_return_to_local(board, &priv->tms9914_priv); } -gpib_interface_t hp_82341_unaccel_interface = { -name: "hp_82341_unaccel", -attach : hp_82341_attach, -detach : hp_82341_detach, -read : hp_82341_read, -write : hp_82341_write, -command : hp_82341_command, -request_system_control : hp_82341_request_system_control, -take_control : hp_82341_take_control, -go_to_standby : hp_82341_go_to_standby, -interface_clear : hp_82341_interface_clear, -remote_enable : hp_82341_remote_enable, -enable_eos : hp_82341_enable_eos, -disable_eos : hp_82341_disable_eos, -parallel_poll : hp_82341_parallel_poll, -parallel_poll_configure : hp_82341_parallel_poll_configure, -parallel_poll_response : hp_82341_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : hp_82341_line_status, -update_status : hp_82341_update_status, -primary_address : hp_82341_primary_address, -secondary_address : hp_82341_secondary_address, -serial_poll_response : hp_82341_serial_poll_response, -serial_poll_status : hp_82341_serial_poll_status, -t1_delay : hp_82341_t1_delay, -return_to_local : hp_82341_return_to_local, +static gpib_interface_t hp_82341_unaccel_interface = { + .name = "hp_82341_unaccel", + .attach = hp_82341_attach, + .detach = hp_82341_detach, + .read = hp_82341_read, + .write = hp_82341_write, + .command = hp_82341_command, + .request_system_control = hp_82341_request_system_control, + .take_control = hp_82341_take_control, + .go_to_standby = hp_82341_go_to_standby, + .interface_clear = hp_82341_interface_clear, + .remote_enable = hp_82341_remote_enable, + .enable_eos = hp_82341_enable_eos, + .disable_eos = hp_82341_disable_eos, + .parallel_poll = hp_82341_parallel_poll, + .parallel_poll_configure = hp_82341_parallel_poll_configure, + .parallel_poll_response = hp_82341_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = hp_82341_line_status, + .update_status = hp_82341_update_status, + .primary_address = hp_82341_primary_address, + .secondary_address = hp_82341_secondary_address, + .serial_poll_response = hp_82341_serial_poll_response, + .serial_poll_status = hp_82341_serial_poll_status, + .t1_delay = hp_82341_t1_delay, + .return_to_local = hp_82341_return_to_local, }; -gpib_interface_t hp_82341_interface = { -name: "hp_82341", -attach : hp_82341_attach, -detach : hp_82341_detach, -read : hp_82341_accel_read, -write : hp_82341_accel_write, -command : hp_82341_command, -request_system_control : hp_82341_request_system_control, -take_control : hp_82341_take_control, -go_to_standby : hp_82341_go_to_standby, -interface_clear : hp_82341_interface_clear, -remote_enable : hp_82341_remote_enable, -enable_eos : hp_82341_enable_eos, -disable_eos : hp_82341_disable_eos, -parallel_poll : hp_82341_parallel_poll, -parallel_poll_configure : hp_82341_parallel_poll_configure, -parallel_poll_response : hp_82341_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : hp_82341_line_status, -update_status : hp_82341_update_status, -primary_address : hp_82341_primary_address, -secondary_address : hp_82341_secondary_address, -serial_poll_response : hp_82341_serial_poll_response, -t1_delay : hp_82341_t1_delay, -return_to_local : hp_82341_return_to_local, +static gpib_interface_t hp_82341_interface = { + .name = "hp_82341", + .attach = hp_82341_attach, + .detach = hp_82341_detach, + .read = hp_82341_accel_read, + .write = hp_82341_accel_write, + .command = hp_82341_command, + .request_system_control = hp_82341_request_system_control, + .take_control = hp_82341_take_control, + .go_to_standby = hp_82341_go_to_standby, + .interface_clear = hp_82341_interface_clear, + .remote_enable = hp_82341_remote_enable, + .enable_eos = hp_82341_enable_eos, + .disable_eos = hp_82341_disable_eos, + .parallel_poll = hp_82341_parallel_poll, + .parallel_poll_configure = hp_82341_parallel_poll_configure, + .parallel_poll_response = hp_82341_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = hp_82341_line_status, + .update_status = hp_82341_update_status, + .primary_address = hp_82341_primary_address, + .secondary_address = hp_82341_secondary_address, + .serial_poll_response = hp_82341_serial_poll_response, + .t1_delay = hp_82341_t1_delay, + .return_to_local = hp_82341_return_to_local, }; int hp_82341_allocate_private(gpib_board_t *board) diff --git a/drivers/staging/gpib/hp_82341/hp_82341.h b/drivers/staging/gpib/hp_82341/hp_82341.h index 7c391860b399..0065ebd9747c 100644 --- a/drivers/staging/gpib/hp_82341/hp_82341.h +++ b/drivers/staging/gpib/hp_82341/hp_82341.h @@ -26,8 +26,6 @@ struct hp_82341_priv { enum hp_82341_hardware_version hw_version; }; -// interfaces -extern gpib_interface_t hp_82341_interface; // interface functions int hp_82341_accel_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, diff --git a/drivers/staging/gpib/ines/ines.h b/drivers/staging/gpib/ines/ines.h index eed038fd3f28..3918737fa21a 100644 --- a/drivers/staging/gpib/ines/ines.h +++ b/drivers/staging/gpib/ines/ines.h @@ -35,13 +35,6 @@ struct ines_priv { u8 extend_mode_bits; }; -// interfaces -extern gpib_interface_t ines_pci_interface; -extern gpib_interface_t ines_pci_accel_interface; -extern gpib_interface_t ines_pcmcia_interface; -extern gpib_interface_t ines_pcmcia_accel_interface; -extern gpib_interface_t ines_pcmcia_unaccel_interface; - // interface functions int ines_read(gpib_board_t *board, uint8_t *buffer, size_t length, int *end, size_t *bytes_read); int ines_write(gpib_board_t *board, uint8_t *buffer, size_t length, diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c index 8dd4baf76633..0dbd3dc30721 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -540,116 +540,116 @@ void ines_return_to_local(gpib_board_t *board) nec7210_return_to_local(board, &priv->nec7210_priv); } -gpib_interface_t ines_pci_unaccel_interface = { -name: "ines_pci_unaccel", -attach : ines_pci_attach, -detach : ines_pci_detach, -read : ines_read, -write : ines_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_pci_unaccel_interface = { + .name = "ines_pci_unaccel", + .attach = ines_pci_attach, + .detach = ines_pci_detach, + .read = ines_read, + .write = ines_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; -gpib_interface_t ines_pci_interface = { -name: "ines_pci", -attach : ines_pci_accel_attach, -detach : ines_pci_detach, -read : ines_accel_read, -write : ines_accel_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_pci_interface = { + .name = "ines_pci", + .attach = ines_pci_accel_attach, + .detach = ines_pci_detach, + .read = ines_accel_read, + .write = ines_accel_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; -gpib_interface_t ines_pci_accel_interface = { -name: "ines_pci_accel", -attach : ines_pci_accel_attach, -detach : ines_pci_detach, -read : ines_accel_read, -write : ines_accel_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_pci_accel_interface = { + .name = "ines_pci_accel", + .attach = ines_pci_accel_attach, + .detach = ines_pci_detach, + .read = ines_accel_read, + .write = ines_accel_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; -gpib_interface_t ines_isa_interface = { -name: "ines_isa", -attach : ines_isa_attach, -detach : ines_isa_detach, -read : ines_accel_read, -write : ines_accel_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_isa_interface = { + .name = "ines_isa", + .attach = ines_isa_attach, + .detach = ines_isa_detach, + .read = ines_accel_read, + .write = ines_accel_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; static int ines_allocate_private(gpib_board_t *board) @@ -1233,88 +1233,88 @@ void ines_pcmcia_cleanup_module(void) pcmcia_unregister_driver(&ines_gpib_cs_driver); } -gpib_interface_t ines_pcmcia_unaccel_interface = { -name: "ines_pcmcia_unaccel", -attach : ines_pcmcia_attach, -detach : ines_pcmcia_detach, -read : ines_read, -write : ines_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_pcmcia_unaccel_interface = { + .name = "ines_pcmcia_unaccel", + .attach = ines_pcmcia_attach, + .detach = ines_pcmcia_detach, + .read = ines_read, + .write = ines_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; -gpib_interface_t ines_pcmcia_accel_interface = { -name: "ines_pcmcia_accel", -attach : ines_pcmcia_accel_attach, -detach : ines_pcmcia_detach, -read : ines_accel_read, -write : ines_accel_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_pcmcia_accel_interface = { + .name = "ines_pcmcia_accel", + .attach = ines_pcmcia_accel_attach, + .detach = ines_pcmcia_detach, + .read = ines_accel_read, + .write = ines_accel_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; -gpib_interface_t ines_pcmcia_interface = { -name: "ines_pcmcia", -attach : ines_pcmcia_accel_attach, -detach : ines_pcmcia_detach, -read : ines_accel_read, -write : ines_accel_write, -command : ines_command, -take_control : ines_take_control, -go_to_standby : ines_go_to_standby, -request_system_control : ines_request_system_control, -interface_clear : ines_interface_clear, -remote_enable : ines_remote_enable, -enable_eos : ines_enable_eos, -disable_eos : ines_disable_eos, -parallel_poll : ines_parallel_poll, -parallel_poll_configure : ines_parallel_poll_configure, -parallel_poll_response : ines_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ines_line_status, -update_status : ines_update_status, -primary_address : ines_primary_address, -secondary_address : ines_secondary_address, -serial_poll_response : ines_serial_poll_response, -serial_poll_status : ines_serial_poll_status, -t1_delay : ines_t1_delay, -return_to_local : ines_return_to_local, +static gpib_interface_t ines_pcmcia_interface = { + .name = "ines_pcmcia", + .attach = ines_pcmcia_accel_attach, + .detach = ines_pcmcia_detach, + .read = ines_accel_read, + .write = ines_accel_write, + .command = ines_command, + .take_control = ines_take_control, + .go_to_standby = ines_go_to_standby, + .request_system_control = ines_request_system_control, + .interface_clear = ines_interface_clear, + .remote_enable = ines_remote_enable, + .enable_eos = ines_enable_eos, + .disable_eos = ines_disable_eos, + .parallel_poll = ines_parallel_poll, + .parallel_poll_configure = ines_parallel_poll_configure, + .parallel_poll_response = ines_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ines_line_status, + .update_status = ines_update_status, + .primary_address = ines_primary_address, + .secondary_address = ines_secondary_address, + .serial_poll_response = ines_serial_poll_response, + .serial_poll_status = ines_serial_poll_status, + .t1_delay = ines_t1_delay, + .return_to_local = ines_return_to_local, }; irqreturn_t ines_pcmcia_interrupt(int irq, void *arg) diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index 9719cb704b65..b0bde6c3458c 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -1131,33 +1131,33 @@ static unsigned int usb_gpib_t1_delay(gpib_board_t *board, unsigned int nano_sec * *** module dispatch table and init/exit functions *** */ -gpib_interface_t usb_gpib_interface = { -name: NAME, -attach : usb_gpib_attach, -detach : usb_gpib_detach, -read : usb_gpib_read, -write : usb_gpib_write, -command : usb_gpib_command, -take_control : usb_gpib_take_control, -go_to_standby : usb_gpib_go_to_standby, -request_system_control : usb_gpib_request_system_control, -interface_clear : usb_gpib_interface_clear, -remote_enable : usb_gpib_remote_enable, -enable_eos : usb_gpib_enable_eos, -disable_eos : usb_gpib_disable_eos, -parallel_poll : usb_gpib_parallel_poll, -parallel_poll_configure : usb_gpib_parallel_poll_configure, -parallel_poll_response : usb_gpib_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : usb_gpib_line_status, -update_status : usb_gpib_update_status, -primary_address : usb_gpib_primary_address, -secondary_address : usb_gpib_secondary_address, -serial_poll_response : usb_gpib_serial_poll_response, -serial_poll_status : usb_gpib_serial_poll_status, -t1_delay : usb_gpib_t1_delay, -return_to_local : usb_gpib_return_to_local, -skip_check_for_command_acceptors : 1 +static gpib_interface_t usb_gpib_interface = { + .name = NAME, + .attach = usb_gpib_attach, + .detach = usb_gpib_detach, + .read = usb_gpib_read, + .write = usb_gpib_write, + .command = usb_gpib_command, + .take_control = usb_gpib_take_control, + .go_to_standby = usb_gpib_go_to_standby, + .request_system_control = usb_gpib_request_system_control, + .interface_clear = usb_gpib_interface_clear, + .remote_enable = usb_gpib_remote_enable, + .enable_eos = usb_gpib_enable_eos, + .disable_eos = usb_gpib_disable_eos, + .parallel_poll = usb_gpib_parallel_poll, + .parallel_poll_configure = usb_gpib_parallel_poll_configure, + .parallel_poll_response = usb_gpib_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = usb_gpib_line_status, + .update_status = usb_gpib_update_status, + .primary_address = usb_gpib_primary_address, + .secondary_address = usb_gpib_secondary_address, + .serial_poll_response = usb_gpib_serial_poll_response, + .serial_poll_status = usb_gpib_serial_poll_status, + .t1_delay = usb_gpib_t1_delay, + .return_to_local = usb_gpib_return_to_local, + .skip_check_for_command_acceptors = 1 }; /* diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c index 3c4132fd6de9..2c0a0d7e36c6 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -2351,33 +2351,33 @@ static void ni_usb_detach(gpib_board_t *board) mutex_unlock(&ni_usb_hotplug_lock); } -gpib_interface_t ni_usb_gpib_interface = { -name: "ni_usb_b", -attach : ni_usb_attach, -detach : ni_usb_detach, -read : ni_usb_read, -write : ni_usb_write, -command : ni_usb_command, -take_control : ni_usb_take_control, -go_to_standby : ni_usb_go_to_standby, -request_system_control : ni_usb_request_system_control, -interface_clear : ni_usb_interface_clear, -remote_enable : ni_usb_remote_enable, -enable_eos : ni_usb_enable_eos, -disable_eos : ni_usb_disable_eos, -parallel_poll : ni_usb_parallel_poll, -parallel_poll_configure : ni_usb_parallel_poll_configure, -parallel_poll_response : ni_usb_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : ni_usb_line_status, -update_status : ni_usb_update_status, -primary_address : ni_usb_primary_address, -secondary_address : ni_usb_secondary_address, -serial_poll_response : ni_usb_serial_poll_response, -serial_poll_status : ni_usb_serial_poll_status, -t1_delay : ni_usb_t1_delay, -return_to_local : ni_usb_return_to_local, -skip_check_for_command_acceptors : 1 +static gpib_interface_t ni_usb_gpib_interface = { + .name = "ni_usb_b", + .attach = ni_usb_attach, + .detach = ni_usb_detach, + .read = ni_usb_read, + .write = ni_usb_write, + .command = ni_usb_command, + .take_control = ni_usb_take_control, + .go_to_standby = ni_usb_go_to_standby, + .request_system_control = ni_usb_request_system_control, + .interface_clear = ni_usb_interface_clear, + .remote_enable = ni_usb_remote_enable, + .enable_eos = ni_usb_enable_eos, + .disable_eos = ni_usb_disable_eos, + .parallel_poll = ni_usb_parallel_poll, + .parallel_poll_configure = ni_usb_parallel_poll_configure, + .parallel_poll_response = ni_usb_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = ni_usb_line_status, + .update_status = ni_usb_update_status, + .primary_address = ni_usb_primary_address, + .secondary_address = ni_usb_secondary_address, + .serial_poll_response = ni_usb_serial_poll_response, + .serial_poll_status = ni_usb_serial_poll_status, + .t1_delay = ni_usb_t1_delay, + .return_to_local = ni_usb_return_to_local, + .skip_check_for_command_acceptors = 1 }; // Table with the USB-devices: just now only testing IDs diff --git a/drivers/staging/gpib/pc2/pc2_gpib.c b/drivers/staging/gpib/pc2/pc2_gpib.c index ae7271f5f7fd..2fb2b51fbb0f 100644 --- a/drivers/staging/gpib/pc2/pc2_gpib.c +++ b/drivers/staging/gpib/pc2/pc2_gpib.c @@ -238,116 +238,116 @@ static void pc2_return_to_local(gpib_board_t *board) nec7210_return_to_local(board, &priv->nec7210_priv); } -gpib_interface_t pc2_interface = { -name: "pcII", -attach : pc2_attach, -detach : pc2_detach, -read : pc2_read, -write : pc2_write, -command : pc2_command, -take_control : pc2_take_control, -go_to_standby : pc2_go_to_standby, -request_system_control : pc2_request_system_control, -interface_clear : pc2_interface_clear, -remote_enable : pc2_remote_enable, -enable_eos : pc2_enable_eos, -disable_eos : pc2_disable_eos, -parallel_poll : pc2_parallel_poll, -parallel_poll_configure : pc2_parallel_poll_configure, -parallel_poll_response : pc2_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, -update_status : pc2_update_status, -primary_address : pc2_primary_address, -secondary_address : pc2_secondary_address, -serial_poll_response : pc2_serial_poll_response, -serial_poll_status : pc2_serial_poll_status, -t1_delay : pc2_t1_delay, -return_to_local : pc2_return_to_local, +static gpib_interface_t pc2_interface = { + .name = "pcII", + .attach = pc2_attach, + .detach = pc2_detach, + .read = pc2_read, + .write = pc2_write, + .command = pc2_command, + .take_control = pc2_take_control, + .go_to_standby = pc2_go_to_standby, + .request_system_control = pc2_request_system_control, + .interface_clear = pc2_interface_clear, + .remote_enable = pc2_remote_enable, + .enable_eos = pc2_enable_eos, + .disable_eos = pc2_disable_eos, + .parallel_poll = pc2_parallel_poll, + .parallel_poll_configure = pc2_parallel_poll_configure, + .parallel_poll_response = pc2_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, + .update_status = pc2_update_status, + .primary_address = pc2_primary_address, + .secondary_address = pc2_secondary_address, + .serial_poll_response = pc2_serial_poll_response, + .serial_poll_status = pc2_serial_poll_status, + .t1_delay = pc2_t1_delay, + .return_to_local = pc2_return_to_local, }; -gpib_interface_t pc2a_interface = { -name: "pcIIa", -attach : pc2a_attach, -detach : pc2a_detach, -read : pc2_read, -write : pc2_write, -command : pc2_command, -take_control : pc2_take_control, -go_to_standby : pc2_go_to_standby, -request_system_control : pc2_request_system_control, -interface_clear : pc2_interface_clear, -remote_enable : pc2_remote_enable, -enable_eos : pc2_enable_eos, -disable_eos : pc2_disable_eos, -parallel_poll : pc2_parallel_poll, -parallel_poll_configure : pc2_parallel_poll_configure, -parallel_poll_response : pc2_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, -update_status : pc2_update_status, -primary_address : pc2_primary_address, -secondary_address : pc2_secondary_address, -serial_poll_response : pc2_serial_poll_response, -serial_poll_status : pc2_serial_poll_status, -t1_delay : pc2_t1_delay, -return_to_local : pc2_return_to_local, +static gpib_interface_t pc2a_interface = { + .name = "pcIIa", + .attach = pc2a_attach, + .detach = pc2a_detach, + .read = pc2_read, + .write = pc2_write, + .command = pc2_command, + .take_control = pc2_take_control, + .go_to_standby = pc2_go_to_standby, + .request_system_control = pc2_request_system_control, + .interface_clear = pc2_interface_clear, + .remote_enable = pc2_remote_enable, + .enable_eos = pc2_enable_eos, + .disable_eos = pc2_disable_eos, + .parallel_poll = pc2_parallel_poll, + .parallel_poll_configure = pc2_parallel_poll_configure, + .parallel_poll_response = pc2_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, + .update_status = pc2_update_status, + .primary_address = pc2_primary_address, + .secondary_address = pc2_secondary_address, + .serial_poll_response = pc2_serial_poll_response, + .serial_poll_status = pc2_serial_poll_status, + .t1_delay = pc2_t1_delay, + .return_to_local = pc2_return_to_local, }; -gpib_interface_t pc2a_cb7210_interface = { -name: "pcIIa_cb7210", -attach : pc2a_cb7210_attach, -detach : pc2a_detach, -read : pc2_read, -write : pc2_write, -command : pc2_command, -take_control : pc2_take_control, -go_to_standby : pc2_go_to_standby, -request_system_control : pc2_request_system_control, -interface_clear : pc2_interface_clear, -remote_enable : pc2_remote_enable, -enable_eos : pc2_enable_eos, -disable_eos : pc2_disable_eos, -parallel_poll : pc2_parallel_poll, -parallel_poll_configure : pc2_parallel_poll_configure, -parallel_poll_response : pc2_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, //XXX -update_status : pc2_update_status, -primary_address : pc2_primary_address, -secondary_address : pc2_secondary_address, -serial_poll_response : pc2_serial_poll_response, -serial_poll_status : pc2_serial_poll_status, -t1_delay : pc2_t1_delay, -return_to_local : pc2_return_to_local, +static gpib_interface_t pc2a_cb7210_interface = { + .name = "pcIIa_cb7210", + .attach = pc2a_cb7210_attach, + .detach = pc2a_detach, + .read = pc2_read, + .write = pc2_write, + .command = pc2_command, + .take_control = pc2_take_control, + .go_to_standby = pc2_go_to_standby, + .request_system_control = pc2_request_system_control, + .interface_clear = pc2_interface_clear, + .remote_enable = pc2_remote_enable, + .enable_eos = pc2_enable_eos, + .disable_eos = pc2_disable_eos, + .parallel_poll = pc2_parallel_poll, + .parallel_poll_configure = pc2_parallel_poll_configure, + .parallel_poll_response = pc2_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, //XXX + .update_status = pc2_update_status, + .primary_address = pc2_primary_address, + .secondary_address = pc2_secondary_address, + .serial_poll_response = pc2_serial_poll_response, + .serial_poll_status = pc2_serial_poll_status, + .t1_delay = pc2_t1_delay, + .return_to_local = pc2_return_to_local, }; -gpib_interface_t pc2_2a_interface = { -name: "pcII_IIa", -attach : pc2_2a_attach, -detach : pc2_2a_detach, -read : pc2_read, -write : pc2_write, -command : pc2_command, -take_control : pc2_take_control, -go_to_standby : pc2_go_to_standby, -request_system_control : pc2_request_system_control, -interface_clear : pc2_interface_clear, -remote_enable : pc2_remote_enable, -enable_eos : pc2_enable_eos, -disable_eos : pc2_disable_eos, -parallel_poll : pc2_parallel_poll, -parallel_poll_configure : pc2_parallel_poll_configure, -parallel_poll_response : pc2_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, -update_status : pc2_update_status, -primary_address : pc2_primary_address, -secondary_address : pc2_secondary_address, -serial_poll_response : pc2_serial_poll_response, -serial_poll_status : pc2_serial_poll_status, -t1_delay : pc2_t1_delay, -return_to_local : pc2_return_to_local, +static gpib_interface_t pc2_2a_interface = { + .name = "pcII_IIa", + .attach = pc2_2a_attach, + .detach = pc2_2a_detach, + .read = pc2_read, + .write = pc2_write, + .command = pc2_command, + .take_control = pc2_take_control, + .go_to_standby = pc2_go_to_standby, + .request_system_control = pc2_request_system_control, + .interface_clear = pc2_interface_clear, + .remote_enable = pc2_remote_enable, + .enable_eos = pc2_enable_eos, + .disable_eos = pc2_disable_eos, + .parallel_poll = pc2_parallel_poll, + .parallel_poll_configure = pc2_parallel_poll_configure, + .parallel_poll_response = pc2_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, + .update_status = pc2_update_status, + .primary_address = pc2_primary_address, + .secondary_address = pc2_secondary_address, + .serial_poll_response = pc2_serial_poll_response, + .serial_poll_status = pc2_serial_poll_status, + .t1_delay = pc2_t1_delay, + .return_to_local = pc2_return_to_local, }; static int allocate_private(gpib_board_t *board) diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c index 0a80d2d9fe20..60369a5dfb72 100644 --- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c +++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c @@ -890,285 +890,285 @@ void tnt4882_return_to_local(gpib_board_t *board) nec7210_return_to_local(board, &priv->nec7210_priv); } -gpib_interface_t ni_pci_interface = { -name: "ni_pci", -attach : ni_pci_attach, -detach : ni_pci_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response2 : tnt4882_serial_poll_response2, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_pci_interface = { + .name = "ni_pci", + .attach = ni_pci_attach, + .detach = ni_pci_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response2 = tnt4882_serial_poll_response2, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_pci_accel_interface = { -name: "ni_pci_accel", -attach : ni_pci_attach, -detach : ni_pci_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response2 : tnt4882_serial_poll_response2, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_pci_accel_interface = { + .name = "ni_pci_accel", + .attach = ni_pci_attach, + .detach = ni_pci_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response2 = tnt4882_serial_poll_response2, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_isa_interface = { -name: "ni_isa", -attach : ni_tnt_isa_attach, -detach : ni_isa_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response2 : tnt4882_serial_poll_response2, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_isa_interface = { + .name = "ni_isa", + .attach = ni_tnt_isa_attach, + .detach = ni_isa_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response2 = tnt4882_serial_poll_response2, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_nat4882_isa_interface = { -name: "ni_nat4882_isa", -attach : ni_nat4882_isa_attach, -detach : ni_isa_detach, -read : tnt4882_read, -write : tnt4882_write, -command : tnt4882_command_unaccel, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response2 : tnt4882_serial_poll_response2, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_nat4882_isa_interface = { + .name = "ni_nat4882_isa", + .attach = ni_nat4882_isa_attach, + .detach = ni_isa_detach, + .read = tnt4882_read, + .write = tnt4882_write, + .command = tnt4882_command_unaccel, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response2 = tnt4882_serial_poll_response2, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_nec_isa_interface = { -name: "ni_nec_isa", -attach : ni_nec_isa_attach, -detach : ni_isa_detach, -read : tnt4882_read, -write : tnt4882_write, -command : tnt4882_command_unaccel, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response : tnt4882_serial_poll_response, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_nec_isa_interface = { + .name = "ni_nec_isa", + .attach = ni_nec_isa_attach, + .detach = ni_isa_detach, + .read = tnt4882_read, + .write = tnt4882_write, + .command = tnt4882_command_unaccel, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response = tnt4882_serial_poll_response, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_isa_accel_interface = { -name: "ni_isa_accel", -attach : ni_tnt_isa_attach, -detach : ni_isa_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response2 : tnt4882_serial_poll_response2, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_isa_accel_interface = { + .name = "ni_isa_accel", + .attach = ni_tnt_isa_attach, + .detach = ni_isa_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response2 = tnt4882_serial_poll_response2, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_nat4882_isa_accel_interface = { -name: "ni_nat4882_isa_accel", -attach : ni_nat4882_isa_attach, -detach : ni_isa_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command_unaccel, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response2 : tnt4882_serial_poll_response2, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_nat4882_isa_accel_interface = { + .name = "ni_nat4882_isa_accel", + .attach = ni_nat4882_isa_attach, + .detach = ni_isa_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command_unaccel, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response2 = tnt4882_serial_poll_response2, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_nec_isa_accel_interface = { -name: "ni_nec_isa_accel", -attach : ni_nec_isa_attach, -detach : ni_isa_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command_unaccel, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : NULL, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response : tnt4882_serial_poll_response, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_nec_isa_accel_interface = { + .name = "ni_nec_isa_accel", + .attach = ni_nec_isa_attach, + .detach = ni_isa_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command_unaccel, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = NULL, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response = tnt4882_serial_poll_response, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; #ifdef GPIB_PCMCIA -gpib_interface_t ni_pcmcia_interface = { -name: "ni_pcmcia", -attach : ni_pcmcia_attach, -detach : ni_pcmcia_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response : tnt4882_serial_poll_response, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_pcmcia_interface = { + .name = "ni_pcmcia", + .attach = ni_pcmcia_attach, + .detach = ni_pcmcia_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response = tnt4882_serial_poll_response, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; -gpib_interface_t ni_pcmcia_accel_interface = { -name: "ni_pcmcia_accel", -attach : ni_pcmcia_attach, -detach : ni_pcmcia_detach, -read : tnt4882_accel_read, -write : tnt4882_accel_write, -command : tnt4882_command, -take_control : tnt4882_take_control, -go_to_standby : tnt4882_go_to_standby, -request_system_control : tnt4882_request_system_control, -interface_clear : tnt4882_interface_clear, -remote_enable : tnt4882_remote_enable, -enable_eos : tnt4882_enable_eos, -disable_eos : tnt4882_disable_eos, -parallel_poll : tnt4882_parallel_poll, -parallel_poll_configure : tnt4882_parallel_poll_configure, -parallel_poll_response : tnt4882_parallel_poll_response, -local_parallel_poll_mode : NULL, // XXX -line_status : tnt4882_line_status, -update_status : tnt4882_update_status, -primary_address : tnt4882_primary_address, -secondary_address : tnt4882_secondary_address, -serial_poll_response : tnt4882_serial_poll_response, -serial_poll_status : tnt4882_serial_poll_status, -t1_delay : tnt4882_t1_delay, -return_to_local : tnt4882_return_to_local, +static gpib_interface_t ni_pcmcia_accel_interface = { + .name = "ni_pcmcia_accel", + .attach = ni_pcmcia_attach, + .detach = ni_pcmcia_detach, + .read = tnt4882_accel_read, + .write = tnt4882_accel_write, + .command = tnt4882_command, + .take_control = tnt4882_take_control, + .go_to_standby = tnt4882_go_to_standby, + .request_system_control = tnt4882_request_system_control, + .interface_clear = tnt4882_interface_clear, + .remote_enable = tnt4882_remote_enable, + .enable_eos = tnt4882_enable_eos, + .disable_eos = tnt4882_disable_eos, + .parallel_poll = tnt4882_parallel_poll, + .parallel_poll_configure = tnt4882_parallel_poll_configure, + .parallel_poll_response = tnt4882_parallel_poll_response, + .local_parallel_poll_mode = NULL, // XXX + .line_status = tnt4882_line_status, + .update_status = tnt4882_update_status, + .primary_address = tnt4882_primary_address, + .secondary_address = tnt4882_secondary_address, + .serial_poll_response = tnt4882_serial_poll_response, + .serial_poll_status = tnt4882_serial_poll_status, + .t1_delay = tnt4882_t1_delay, + .return_to_local = tnt4882_return_to_local, }; #endif From 55eb3c3a6388420afda1374b353717de32ae9573 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Sat, 11 Jan 2025 17:14:57 +0100 Subject: [PATCH 29/38] staging: gpib: Add missing mutex unlock in agilent usb driver When no matching product id was found in the attach function the driver returned without unlocking the agilent_82357a_hotplug_lock mutex. Add the unlock call. This was detected by smatch: smatch warnings: drivers/staging/gpib/agilent_82357a/agilent_82357a.c:1381 agilent_82357a_attach() warn: inconsistent returns 'global &agilent_82357a_hotplug_lock'. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202412210143.WJhYzXfD-lkp@intel.com/ Fixes: 4c41fe886a56 ("staging: gpib: Add Agilent/Keysight 82357x USB GPIB driver") Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250111161457.27556-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c index b21eadabc466..c22c6bb30776 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -1365,6 +1365,7 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t break; default: dev_err(&usb_dev->dev, "bug, unhandled product_id in switch?\n"); + mutex_unlock(&agilent_82357a_hotplug_lock); return -EIO; } #ifdef RESET_USB_CONFIG From d43f18d94795aa9aacb110a60bc4df76e112f77f Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Sat, 11 Jan 2025 17:15:48 +0100 Subject: [PATCH 30/38] staging: gpib: Add missing mutex unlock in ni usb driver When the buffer allocation for return data in ni_usb_write() fails we were returning without unlocking the addressed_transfer_lock. Add the unlock call. This was detected by smatch: New smatch warnings: drivers/staging/gpib/ni_usb/ni_usb_gpib.c:837 ni_usb_write() warn: inconsistent returns '&ni_priv->addressed_transfer_lock'. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202412201550.9NCO57Ye-lkp@intel.com/ Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250111161548.27601-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/ni_usb/ni_usb_gpib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c index 2c0a0d7e36c6..d0656dc520f5 100644 --- a/drivers/staging/gpib/ni_usb/ni_usb_gpib.c +++ b/drivers/staging/gpib/ni_usb/ni_usb_gpib.c @@ -783,8 +783,10 @@ static int ni_usb_write(gpib_board_t *board, uint8_t *buffer, size_t length, } in_data = kmalloc(in_data_length, GFP_KERNEL); - if (!in_data) + if (!in_data) { + mutex_unlock(&ni_priv->addressed_transfer_lock); return -ENOMEM; + } retval = ni_usb_receive_bulk_msg(ni_priv, in_data, in_data_length, &usb_bytes_read, ni_usb_timeout_msecs(board->usec_timeout), 1); From 77b41a9342f610b90675a15aea87c8462b900404 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Tue, 14 Jan 2025 17:54:00 +0100 Subject: [PATCH 31/38] staging: gpib: Use __iomem attribute for io addresses In a number of drivers the PCI memory pointers were declared simply as void *. This caused sparse to emit the following warning, for example: agilent_82350b/agilent_82350b.c:44:58: warning: incorrect type in argument 2 (different address spaces) agilent_82350b/agilent_82350b.c:44:58: expected void volatile [noderef] __iomem *addr Declare the PCI memory pointers as void __iomem *addr. Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250114165403.16410-2-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/agilent_82350b/agilent_82350b.c | 10 +++++----- drivers/staging/gpib/agilent_82350b/agilent_82350b.h | 10 +++++----- drivers/staging/gpib/eastwood/fluke_gpib.h | 2 +- drivers/staging/gpib/fmh_gpib/fmh_gpib.h | 2 +- drivers/staging/gpib/ines/ines_gpib.c | 4 ++-- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c index 05490d1abc96..3f4f95b7fe34 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.c +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.c @@ -808,15 +808,15 @@ void agilent_82350b_detach(gpib_board_t *board) if (a_priv->gpib_base) { tms9914_board_reset(tms_priv); if (a_priv->misc_base) - iounmap((void *)a_priv->misc_base); + iounmap(a_priv->misc_base); if (a_priv->borg_base) - iounmap((void *)a_priv->borg_base); + iounmap(a_priv->borg_base); if (a_priv->sram_base) - iounmap((void *)a_priv->sram_base); + iounmap(a_priv->sram_base); if (a_priv->gpib_base) - iounmap((void *)a_priv->gpib_base); + iounmap(a_priv->gpib_base); if (a_priv->plx_base) - iounmap((void *)a_priv->plx_base); + iounmap(a_priv->plx_base); pci_release_regions(a_priv->pci_device); } if (a_priv->pci_device) diff --git a/drivers/staging/gpib/agilent_82350b/agilent_82350b.h b/drivers/staging/gpib/agilent_82350b/agilent_82350b.h index 6915c1b2c85b..32b322113c10 100644 --- a/drivers/staging/gpib/agilent_82350b/agilent_82350b.h +++ b/drivers/staging/gpib/agilent_82350b/agilent_82350b.h @@ -45,11 +45,11 @@ enum board_model { struct agilent_82350b_priv { struct tms9914_priv tms9914_priv; struct pci_dev *pci_device; - void *plx_base; //82350a only - void *gpib_base; - void *sram_base; - void *misc_base; - void *borg_base; + void __iomem *plx_base; //82350a only + void __iomem *gpib_base; + void __iomem *sram_base; + void __iomem *misc_base; + void __iomem *borg_base; int irq; unsigned short card_mode_bits; unsigned short event_status_bits; diff --git a/drivers/staging/gpib/eastwood/fluke_gpib.h b/drivers/staging/gpib/eastwood/fluke_gpib.h index 4e2144d45270..3e4348196b42 100644 --- a/drivers/staging/gpib/eastwood/fluke_gpib.h +++ b/drivers/staging/gpib/eastwood/fluke_gpib.h @@ -21,7 +21,7 @@ struct fluke_priv { struct dma_chan *dma_channel; u8 *dma_buffer; int dma_buffer_size; - void *write_transfer_counter; + void __iomem *write_transfer_counter; }; // cb7210 specific registers and bits diff --git a/drivers/staging/gpib/fmh_gpib/fmh_gpib.h b/drivers/staging/gpib/fmh_gpib/fmh_gpib.h index 60b1bd6d3c15..de6fd2164414 100644 --- a/drivers/staging/gpib/fmh_gpib/fmh_gpib.h +++ b/drivers/staging/gpib/fmh_gpib/fmh_gpib.h @@ -33,7 +33,7 @@ struct fmh_priv { u8 *dma_buffer; int dma_buffer_size; int dma_burst_length; - void *fifo_base; + void __iomem *fifo_base; unsigned supports_fifo_interrupts : 1; }; diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c index 0dbd3dc30721..2c970bab6545 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -1122,7 +1122,7 @@ static int ines_gpib_config(struct pcmcia_device *link) { struct local_info *dev; int retval; - void *virt; + void __iomem *virt; dev = link->priv; DEBUG(0, "%s(0x%p)\n", __func__, link); @@ -1156,7 +1156,7 @@ static int ines_gpib_config(struct pcmcia_device *link) } virt = ioremap(link->resource[2]->start, resource_size(link->resource[2])); writeb((link->resource[2]->start >> 2) & 0xff, virt + 0xf0); // IOWindow base - iounmap((void *)virt); + iounmap(virt); /* * This actually configures the PCMCIA socket -- setting up diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c index 60369a5dfb72..2fd1a29f0c8b 100644 --- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c +++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c @@ -116,7 +116,7 @@ static inline void tnt_paged_writeb(struct tnt4882_priv *priv, unsigned int valu /* readb/writeb wrappers */ static inline unsigned short tnt_readb(struct tnt4882_priv *priv, unsigned long offset) { - void *address = priv->nec7210_priv.mmiobase + offset; + void __iomem *address = priv->nec7210_priv.mmiobase + offset; unsigned long flags; unsigned short retval; spinlock_t *register_lock = &priv->nec7210_priv.register_page_lock; @@ -154,7 +154,7 @@ static inline unsigned short tnt_readb(struct tnt4882_priv *priv, unsigned long static inline void tnt_writeb(struct tnt4882_priv *priv, unsigned short value, unsigned long offset) { - void *address = priv->nec7210_priv.mmiobase + offset; + void __iomem *address = priv->nec7210_priv.mmiobase + offset; unsigned long flags; spinlock_t *register_lock = &priv->nec7210_priv.register_page_lock; From 8e7ff4e7a2358fbbe3a5bbdb733e5cf5868cf1ff Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Tue, 14 Jan 2025 17:54:01 +0100 Subject: [PATCH 32/38] staging: gpib: Use __user for user space pointers The user buffers in copy_from_user, copy_to_user and some file ops did not use the __user address space attribute. This led to the following sparse warning, for example: common/gpib_os.c:838:40: warning: incorrect type in argument 2 (different address spaces) common/gpib_os.c:838:40: expected void const [noderef] __user *from common/gpib_os.c:838:40: got void * Add the __user address space attribute where needed. Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250114165403.16410-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/common/gpib_os.c | 103 +++++++++--------- .../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 4 +- 2 files changed, 54 insertions(+), 53 deletions(-) diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c index 982a2fe68cf2..69fe39aa0daf 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -835,7 +835,7 @@ static int board_type_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, return -EBUSY; } - retval = copy_from_user(&cmd, (void *)arg, sizeof(board_type_ioctl_t)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(board_type_ioctl_t)); if (retval) return retval; @@ -879,7 +879,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, unsigned long arg) { read_write_ioctl_t read_cmd; - u8 *userbuf; + u8 __user *userbuf; unsigned long remain; int end_flag = 0; int retval; @@ -887,7 +887,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, gpib_descriptor_t *desc; size_t nbytes; - retval = copy_from_user(&read_cmd, (void *)arg, sizeof(read_cmd)); + retval = copy_from_user(&read_cmd, (void __user *)arg, sizeof(read_cmd)); if (retval) return -EFAULT; @@ -901,7 +901,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, if (WARN_ON_ONCE(sizeof(userbuf) > sizeof(read_cmd.buffer_ptr))) return -EFAULT; - userbuf = (u8 *)(unsigned long)read_cmd.buffer_ptr; + userbuf = (u8 __user *)(unsigned long)read_cmd.buffer_ptr; userbuf += read_cmd.completed_transfer_count; remain = read_cmd.requested_transfer_count - read_cmd.completed_transfer_count; @@ -939,7 +939,7 @@ static int read_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, if (remain == 0 || end_flag) read_ret = 0; if (retval == 0) - retval = copy_to_user((void *)arg, &read_cmd, sizeof(read_cmd)); + retval = copy_to_user((void __user *)arg, &read_cmd, sizeof(read_cmd)); atomic_set(&desc->io_in_progress, 0); @@ -954,7 +954,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, unsigned long arg) { read_write_ioctl_t cmd; - u8 *userbuf; + u8 __user *userbuf; unsigned long remain; int retval; int fault = 0; @@ -962,7 +962,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, size_t bytes_written; int no_clear_io_in_prog; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -973,7 +973,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, if (!desc) return -EINVAL; - userbuf = (u8 *)(unsigned long)cmd.buffer_ptr; + userbuf = (u8 __user *)(unsigned long)cmd.buffer_ptr; userbuf += cmd.completed_transfer_count; no_clear_io_in_prog = cmd.end; @@ -1016,7 +1016,7 @@ static int command_ioctl(gpib_file_private_t *file_priv, cmd.completed_transfer_count = cmd.requested_transfer_count - remain; if (fault == 0) - fault = copy_to_user((void *)arg, &cmd, sizeof(cmd)); + fault = copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); /* * no_clear_io_in_prog (cmd.end) is true when io_in_progress should @@ -1038,13 +1038,13 @@ static int write_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, unsigned long arg) { read_write_ioctl_t write_cmd; - u8 *userbuf; + u8 __user *userbuf; unsigned long remain; int retval = 0; int fault; gpib_descriptor_t *desc; - fault = copy_from_user(&write_cmd, (void *)arg, sizeof(write_cmd)); + fault = copy_from_user(&write_cmd, (void __user *)arg, sizeof(write_cmd)); if (fault) return -EFAULT; @@ -1055,7 +1055,7 @@ static int write_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, if (!desc) return -EINVAL; - userbuf = (u8 *)(unsigned long)write_cmd.buffer_ptr; + userbuf = (u8 __user *)(unsigned long)write_cmd.buffer_ptr; userbuf += write_cmd.completed_transfer_count; remain = write_cmd.requested_transfer_count - write_cmd.completed_transfer_count; @@ -1094,7 +1094,7 @@ static int write_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, if (remain == 0) retval = 0; if (fault == 0) - fault = copy_to_user((void *)arg, &write_cmd, sizeof(write_cmd)); + fault = copy_to_user((void __user *)arg, &write_cmd, sizeof(write_cmd)); atomic_set(&desc->io_in_progress, 0); @@ -1111,7 +1111,7 @@ static int status_bytes_ioctl(gpib_board_t *board, unsigned long arg) spoll_bytes_ioctl_t cmd; int retval; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -1121,7 +1121,7 @@ static int status_bytes_ioctl(gpib_board_t *board, unsigned long arg) else cmd.num_bytes = num_status_bytes(device); - retval = copy_to_user((void *)arg, &cmd, sizeof(cmd)); + retval = copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); if (retval) return -EFAULT; @@ -1231,7 +1231,7 @@ static int open_dev_ioctl(struct file *filep, gpib_board_t *board, unsigned long gpib_file_private_t *file_priv = filep->private_data; int i; - retval = copy_from_user(&open_dev_cmd, (void *)arg, sizeof(open_dev_cmd)); + retval = copy_from_user(&open_dev_cmd, (void __user *)arg, sizeof(open_dev_cmd)); if (retval) return -EFAULT; @@ -1267,7 +1267,7 @@ static int open_dev_ioctl(struct file *filep, gpib_board_t *board, unsigned long atomic_set(&board->stuck_srq, 0); open_dev_cmd.handle = i; - retval = copy_to_user((void *)arg, &open_dev_cmd, sizeof(open_dev_cmd)); + retval = copy_to_user((void __user *)arg, &open_dev_cmd, sizeof(open_dev_cmd)); if (retval) return -EFAULT; @@ -1280,7 +1280,7 @@ static int close_dev_ioctl(struct file *filep, gpib_board_t *board, unsigned lon gpib_file_private_t *file_priv = filep->private_data; int retval; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -1308,7 +1308,7 @@ static int serial_poll_ioctl(gpib_board_t *board, unsigned long arg) dev_dbg(board->gpib_dev, "pid %i, entering %s()\n", current->pid, __func__); - retval = copy_from_user(&serial_cmd, (void *)arg, sizeof(serial_cmd)); + retval = copy_from_user(&serial_cmd, (void __user *)arg, sizeof(serial_cmd)); if (retval) return -EFAULT; @@ -1317,7 +1317,7 @@ static int serial_poll_ioctl(gpib_board_t *board, unsigned long arg) if (retval < 0) return retval; - retval = copy_to_user((void *)arg, &serial_cmd, sizeof(serial_cmd)); + retval = copy_to_user((void __user *)arg, &serial_cmd, sizeof(serial_cmd)); if (retval) return -EFAULT; @@ -1331,7 +1331,7 @@ static int wait_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, int retval; gpib_descriptor_t *desc; - retval = copy_from_user(&wait_cmd, (void *)arg, sizeof(wait_cmd)); + retval = copy_from_user(&wait_cmd, (void __user *)arg, sizeof(wait_cmd)); if (retval) return -EFAULT; @@ -1344,7 +1344,7 @@ static int wait_ioctl(gpib_file_private_t *file_priv, gpib_board_t *board, if (retval < 0) return retval; - retval = copy_to_user((void *)arg, &wait_cmd, sizeof(wait_cmd)); + retval = copy_to_user((void __user *)arg, &wait_cmd, sizeof(wait_cmd)); if (retval) return -EFAULT; @@ -1360,7 +1360,7 @@ static int parallel_poll_ioctl(gpib_board_t *board, unsigned long arg) if (retval < 0) return retval; - retval = copy_to_user((void *)arg, &poll_byte, sizeof(poll_byte)); + retval = copy_to_user((void __user *)arg, &poll_byte, sizeof(poll_byte)); if (retval) return -EFAULT; @@ -1371,14 +1371,14 @@ static int online_ioctl(gpib_board_t *board, unsigned long arg) { online_ioctl_t online_cmd; int retval; - void *init_data = NULL; + void __user *init_data = NULL; board->config.init_data = NULL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - retval = copy_from_user(&online_cmd, (void *)arg, sizeof(online_cmd)); + retval = copy_from_user(&online_cmd, (void __user *)arg, sizeof(online_cmd)); if (retval) return -EFAULT; if (online_cmd.init_data_length > 0) { @@ -1387,7 +1387,7 @@ static int online_ioctl(gpib_board_t *board, unsigned long arg) return -ENOMEM; if (WARN_ON_ONCE(sizeof(init_data) > sizeof(online_cmd.init_data_ptr))) return -EFAULT; - init_data = (void *)(unsigned long)(online_cmd.init_data_ptr); + init_data = (void __user *)(unsigned long)(online_cmd.init_data_ptr); retval = copy_from_user(board->config.init_data, init_data, online_cmd.init_data_length); if (retval) { @@ -1416,7 +1416,7 @@ static int remote_enable_ioctl(gpib_board_t *board, unsigned long arg) int enable; int retval; - retval = copy_from_user(&enable, (void *)arg, sizeof(enable)); + retval = copy_from_user(&enable, (void __user *)arg, sizeof(enable)); if (retval) return -EFAULT; @@ -1428,7 +1428,7 @@ static int take_control_ioctl(gpib_board_t *board, unsigned long arg) int synchronous; int retval; - retval = copy_from_user(&synchronous, (void *)arg, sizeof(synchronous)); + retval = copy_from_user(&synchronous, (void __user *)arg, sizeof(synchronous)); if (retval) return -EFAULT; @@ -1444,7 +1444,7 @@ static int line_status_ioctl(gpib_board_t *board, unsigned long arg) if (retval < 0) return retval; - retval = copy_to_user((void *)arg, &lines, sizeof(lines)); + retval = copy_to_user((void __user *)arg, &lines, sizeof(lines)); if (retval) return -EFAULT; @@ -1458,7 +1458,7 @@ static int pad_ioctl(gpib_board_t *board, gpib_file_private_t *file_priv, int retval; gpib_descriptor_t *desc; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -1494,7 +1494,7 @@ static int sad_ioctl(gpib_board_t *board, gpib_file_private_t *file_priv, int retval; gpib_descriptor_t *desc; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -1527,7 +1527,7 @@ static int eos_ioctl(gpib_board_t *board, unsigned long arg) eos_ioctl_t eos_cmd; int retval; - retval = copy_from_user(&eos_cmd, (void *)arg, sizeof(eos_cmd)); + retval = copy_from_user(&eos_cmd, (void __user *)arg, sizeof(eos_cmd)); if (retval) return -EFAULT; @@ -1539,7 +1539,7 @@ static int request_service_ioctl(gpib_board_t *board, unsigned long arg) u8 status_byte; int retval; - retval = copy_from_user(&status_byte, (void *)arg, sizeof(status_byte)); + retval = copy_from_user(&status_byte, (void __user *)arg, sizeof(status_byte)); if (retval) return -EFAULT; @@ -1551,7 +1551,8 @@ static int request_service2_ioctl(gpib_board_t *board, unsigned long arg) request_service2_t request_service2_cmd; int retval; - retval = copy_from_user(&request_service2_cmd, (void *)arg, sizeof(request_service2_t)); + retval = copy_from_user(&request_service2_cmd, (void __user *)arg, + sizeof(request_service2_t)); if (retval) return -EFAULT; @@ -1567,7 +1568,7 @@ static int iobase_ioctl(gpib_board_config_t *config, unsigned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - retval = copy_from_user(&base_addr, (void *)arg, sizeof(base_addr)); + retval = copy_from_user(&base_addr, (void __user *)arg, sizeof(base_addr)); if (retval) return -EFAULT; @@ -1586,7 +1587,7 @@ static int irq_ioctl(gpib_board_config_t *config, unsigned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - retval = copy_from_user(&irq, (void *)arg, sizeof(irq)); + retval = copy_from_user(&irq, (void __user *)arg, sizeof(irq)); if (retval) return -EFAULT; @@ -1603,7 +1604,7 @@ static int dma_ioctl(gpib_board_config_t *config, unsigned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - retval = copy_from_user(&dma_channel, (void *)arg, sizeof(dma_channel)); + retval = copy_from_user(&dma_channel, (void __user *)arg, sizeof(dma_channel)); if (retval) return -EFAULT; @@ -1619,7 +1620,7 @@ static int autospoll_ioctl(gpib_board_t *board, gpib_file_private_t *file_priv, int retval; gpib_descriptor_t *desc; - retval = copy_from_user(&enable, (void *)arg, sizeof(enable)); + retval = copy_from_user(&enable, (void __user *)arg, sizeof(enable)); if (retval) return -EFAULT; @@ -1654,7 +1655,7 @@ static int mutex_ioctl(gpib_board_t *board, gpib_file_private_t *file_priv, { int retval, lock_mutex; - retval = copy_from_user(&lock_mutex, (void *)arg, sizeof(lock_mutex)); + retval = copy_from_user(&lock_mutex, (void __user *)arg, sizeof(lock_mutex)); if (retval) return -EFAULT; @@ -1698,7 +1699,7 @@ static int timeout_ioctl(gpib_board_t *board, unsigned long arg) unsigned int timeout; int retval; - retval = copy_from_user(&timeout, (void *)arg, sizeof(timeout)); + retval = copy_from_user(&timeout, (void __user *)arg, sizeof(timeout)); if (retval) return -EFAULT; @@ -1713,7 +1714,7 @@ static int ppc_ioctl(gpib_board_t *board, unsigned long arg) ppoll_config_ioctl_t cmd; int retval; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -1739,7 +1740,7 @@ static int set_local_ppoll_mode_ioctl(gpib_board_t *board, unsigned long arg) local_ppoll_mode_ioctl_t cmd; int retval; - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; @@ -1759,7 +1760,7 @@ static int get_local_ppoll_mode_ioctl(gpib_board_t *board, unsigned long arg) int retval; cmd = board->local_ppoll_mode; - retval = copy_to_user((void *)arg, &cmd, sizeof(cmd)); + retval = copy_to_user((void __user *)arg, &cmd, sizeof(cmd)); if (retval) return -EFAULT; @@ -1773,7 +1774,7 @@ static int query_board_rsv_ioctl(gpib_board_t *board, unsigned long arg) status = board->interface->serial_poll_status(board); - retval = copy_to_user((void *)arg, &status, sizeof(status)); + retval = copy_to_user((void __user *)arg, &status, sizeof(status)); if (retval) return -EFAULT; @@ -1796,7 +1797,7 @@ static int board_info_ioctl(const gpib_board_t *board, unsigned long arg) info.t1_delay = board->t1_nano_sec; info.ist = board->ist; info.no_7_bit_eos = board->interface->no_7_bit_eos; - retval = copy_to_user((void *)arg, &info, sizeof(info)); + retval = copy_to_user((void __user *)arg, &info, sizeof(info)); if (retval) return -EFAULT; @@ -1808,7 +1809,7 @@ static int interface_clear_ioctl(gpib_board_t *board, unsigned long arg) unsigned int usec_duration; int retval; - retval = copy_from_user(&usec_duration, (void *)arg, sizeof(usec_duration)); + retval = copy_from_user(&usec_duration, (void __user *)arg, sizeof(usec_duration)); if (retval) return -EFAULT; @@ -1823,7 +1824,7 @@ static int select_pci_ioctl(gpib_board_config_t *config, unsigned long arg) if (!capable(CAP_SYS_ADMIN)) return -EPERM; - retval = copy_from_user(&selection, (void *)arg, sizeof(selection)); + retval = copy_from_user(&selection, (void __user *)arg, sizeof(selection)); if (retval) return -EFAULT; @@ -1845,7 +1846,7 @@ static int select_device_path_ioctl(gpib_board_config_t *config, unsigned long a if (!selection) return -ENOMEM; - retval = copy_from_user(selection, (void *)arg, sizeof(select_device_path_ioctl_t)); + retval = copy_from_user(selection, (void __user *)arg, sizeof(select_device_path_ioctl_t)); if (retval) { vfree(selection); return -EFAULT; @@ -1979,7 +1980,7 @@ static int event_ioctl(gpib_board_t *board, unsigned long arg) user_event = event; - retval = copy_to_user((void *)arg, &user_event, sizeof(user_event)); + retval = copy_to_user((void __user *)arg, &user_event, sizeof(user_event)); if (retval) return -EFAULT; @@ -1991,7 +1992,7 @@ static int request_system_control_ioctl(gpib_board_t *board, unsigned long arg) rsc_ioctl_t request_control; int retval; - retval = copy_from_user(&request_control, (void *)arg, sizeof(request_control)); + retval = copy_from_user(&request_control, (void __user *)arg, sizeof(request_control)); if (retval) return -EFAULT; @@ -2011,7 +2012,7 @@ static int t1_delay_ioctl(gpib_board_t *board, unsigned long arg) return -EIO; } - retval = copy_from_user(&cmd, (void *)arg, sizeof(cmd)); + retval = copy_from_user(&cmd, (void __user *)arg, sizeof(cmd)); if (retval) return -EFAULT; diff --git a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c index b0bde6c3458c..85322af62c23 100644 --- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c +++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c @@ -1880,7 +1880,7 @@ static int skel_release(struct inode *inode, struct file *file) * user space access to read function */ -static ssize_t skel_read(struct file *file, char *buffer, size_t count, +static ssize_t skel_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos) { struct usb_skel *dev; @@ -1911,7 +1911,7 @@ static ssize_t skel_read(struct file *file, char *buffer, size_t count, * user space access to write function */ -static ssize_t skel_write(struct file *file, const char *user_buffer, +static ssize_t skel_write(struct file *file, const char __user *user_buffer, size_t count, loff_t *ppos) { struct usb_skel *dev; From b3beeeee2724b0664a2fc8682e1440d3fc31c6fe Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Tue, 14 Jan 2025 17:54:02 +0100 Subject: [PATCH 33/38] staging: gpib: Avoid plain integers as NULL pointers A number of drivers were comparing request_region() with 0, others were passing 0 instead of NULL as a pointer argument. This led to the following sparse warning, for example: cb7210/cb7210.c:1043:72: warning: Using plain integer as NULL pointer Use !request_region() to test for NULL return and use NULL instead of 0 as pointer parameter. Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250114165403.16410-4-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/cb7210/cb7210.c | 6 +++--- drivers/staging/gpib/common/gpib_os.c | 2 +- drivers/staging/gpib/common/iblib.c | 2 +- drivers/staging/gpib/gpio/gpib_bitbang.c | 4 ++-- drivers/staging/gpib/ines/ines_gpib.c | 4 ++-- drivers/staging/gpib/pc2/pc2_gpib.c | 2 +- drivers/staging/gpib/tnt4882/tnt4882_gpib.c | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c index e5436f55c630..ae373005389b 100644 --- a/drivers/staging/gpib/cb7210/cb7210.c +++ b/drivers/staging/gpib/cb7210/cb7210.c @@ -1040,7 +1040,7 @@ int cb_isa_attach(gpib_board_t *board, const gpib_board_config_t *config) return retval; cb_priv = board->private_data; nec_priv = &cb_priv->nec7210_priv; - if (request_region(config->ibbase, cb7210_iosize, "cb7210") == 0) { + if (!request_region(config->ibbase, cb7210_iosize, "cb7210")) { pr_err("gpib: ioports starting at 0x%u are already in use\n", config->ibbase); return -EIO; } @@ -1459,8 +1459,8 @@ int cb_pcmcia_attach(gpib_board_t *board, const gpib_board_config_t *config) cb_priv = board->private_data; nec_priv = &cb_priv->nec7210_priv; - if (request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), - "cb7210") == 0) { + if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), + "cb7210")) { pr_err("gpib: ioports starting at 0x%lx are already in use\n", (unsigned long)curr_dev->resource[0]->start); return -EIO; diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c index 69fe39aa0daf..3234d4348957 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -2197,7 +2197,7 @@ static int __init gpib_common_init_module(void) return PTR_ERR(gpib_class); } for (i = 0; i < GPIB_MAX_NUM_BOARDS; ++i) - board_array[i].gpib_dev = device_create(gpib_class, 0, + board_array[i].gpib_dev = device_create(gpib_class, NULL, MKDEV(GPIB_CODE, i), NULL, "gpib%i", i); return 0; diff --git a/drivers/staging/gpib/common/iblib.c b/drivers/staging/gpib/common/iblib.c index db1911cc1b26..5f6fa135f505 100644 --- a/drivers/staging/gpib/common/iblib.c +++ b/drivers/staging/gpib/common/iblib.c @@ -695,7 +695,7 @@ int ibwait(gpib_board_t *board, int wait_mask, int clear_mask, int set_mask, /* make sure we only clear status bits that we are reporting */ if (*status & clear_mask || set_mask) - general_ibstatus(board, status_queue, *status & clear_mask, set_mask, 0); + general_ibstatus(board, status_queue, *status & clear_mask, set_mask, NULL); return 0; } diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c index ad49a5644ab8..16e2d0c5642e 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -265,7 +265,7 @@ static struct gpiod_lookup_table gpib_gpio_table_0 = { static struct gpiod_lookup_table *lookup_tables[] = { &gpib_gpio_table_0, &gpib_gpio_table_1, - 0 + NULL }; /* struct which defines private_data for gpio driver */ @@ -1119,7 +1119,7 @@ static void release_gpios(void) for (j = 0 ; j < NUM_PINS ; j++) { if (all_descriptors[j]) { gpiod_put(all_descriptors[j]); - all_descriptors[j] = 0; + all_descriptors[j] = NULL; } } } diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c index 2c970bab6545..846dafc85c11 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -1342,8 +1342,8 @@ int ines_common_pcmcia_attach(gpib_board_t *board) ines_priv = board->private_data; nec_priv = &ines_priv->nec7210_priv; - if (request_region(curr_dev->resource[0]->start, - resource_size(curr_dev->resource[0]), "ines_gpib") == 0) { + if (!request_region(curr_dev->resource[0]->start, + resource_size(curr_dev->resource[0]), "ines_gpib")) { pr_err("ines_gpib: ioports at 0x%lx already in use\n", (unsigned long)(curr_dev->resource[0]->start)); return -1; diff --git a/drivers/staging/gpib/pc2/pc2_gpib.c b/drivers/staging/gpib/pc2/pc2_gpib.c index 2fb2b51fbb0f..c0b07cb63d9a 100644 --- a/drivers/staging/gpib/pc2/pc2_gpib.c +++ b/drivers/staging/gpib/pc2/pc2_gpib.c @@ -426,7 +426,7 @@ int pc2_attach(gpib_board_t *board, const gpib_board_config_t *config) nec_priv = &pc2_priv->nec7210_priv; nec_priv->offset = pc2_reg_offset; - if (request_region(config->ibbase, pc2_iosize, "pc2") == 0) { + if (!request_region(config->ibbase, pc2_iosize, "pc2")) { pr_err("gpib: ioports are already in use\n"); return -1; } diff --git a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c index 2fd1a29f0c8b..b39ab2abe495 100644 --- a/drivers/staging/gpib/tnt4882/tnt4882_gpib.c +++ b/drivers/staging/gpib/tnt4882/tnt4882_gpib.c @@ -1896,8 +1896,8 @@ int ni_pcmcia_attach(gpib_board_t *board, const gpib_board_config_t *config) nec_priv->offset = atgpib_reg_offset; DEBUG(0, "ioport1 window attributes: 0x%lx\n", curr_dev->resource[0]->flags); - if (request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), - "tnt4882") == 0) { + if (!request_region(curr_dev->resource[0]->start, resource_size(curr_dev->resource[0]), + "tnt4882")) { pr_err("gpib: ioports starting at 0x%lx are already in use\n", (unsigned long)curr_dev->resource[0]->start); return -EIO; From 3e2bcc16804b584bb2a2a8538a40fd3307305816 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Tue, 14 Jan 2025 17:54:03 +0100 Subject: [PATCH 34/38] staging: gpib: Use C99 syntax and make static Some drivers were still using the old syntax for initializing structs: field : value; This caused sparse to emit the following warning, for example: common/gpib_os.c:2026:1: warning: obsolete struct initializer, use C99 syntax Use C99 syntax: .field = value; Some local structs and arrays were not declared static causing sparse to emit the following warning, for example: warning: symbol 'ib_fops' was not declared. Should it be static? Declare the local structs and arrays as static. Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250114165403.16410-5-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../gpib/agilent_82357a/agilent_82357a.c | 2 +- drivers/staging/gpib/common/gpib_os.c | 14 ++--- drivers/staging/gpib/gpio/gpib_bitbang.c | 4 +- drivers/staging/gpib/ines/ines_gpib.c | 58 +++++++++---------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c index c22c6bb30776..34d85a1bdb37 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -19,7 +19,7 @@ MODULE_DESCRIPTION("GPIB driver for Agilent 82357A/B usb adapters"); #define MAX_NUM_82357A_INTERFACES 128 static struct usb_interface *agilent_82357a_driver_interfaces[MAX_NUM_82357A_INTERFACES]; -DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal +static DEFINE_MUTEX(agilent_82357a_hotplug_lock); // protect board insertion and removal static unsigned int agilent_82357a_update_status(gpib_board_t *board, unsigned int clear_mask); diff --git a/drivers/staging/gpib/common/gpib_os.c b/drivers/staging/gpib/common/gpib_os.c index 3234d4348957..4901e660242e 100644 --- a/drivers/staging/gpib/common/gpib_os.c +++ b/drivers/staging/gpib/common/gpib_os.c @@ -2023,13 +2023,13 @@ static int t1_delay_ioctl(gpib_board_t *board, unsigned long arg) return 0; } -const struct file_operations ib_fops = { -owner: THIS_MODULE, -llseek : NULL, -unlocked_ioctl : &ibioctl, -compat_ioctl : &ibioctl, -open : &ibopen, -release : &ibclose, +static const struct file_operations ib_fops = { + .owner = THIS_MODULE, + .llseek = NULL, + .unlocked_ioctl = &ibioctl, + .compat_ioctl = &ibioctl, + .open = &ibopen, + .release = &ibclose, }; gpib_board_t board_array[GPIB_MAX_NUM_BOARDS]; diff --git a/drivers/staging/gpib/gpio/gpib_bitbang.c b/drivers/staging/gpib/gpio/gpib_bitbang.c index 16e2d0c5642e..828c99ea613f 100644 --- a/drivers/staging/gpib/gpio/gpib_bitbang.c +++ b/drivers/staging/gpib/gpio/gpib_bitbang.c @@ -147,7 +147,7 @@ DEFINE_LED_TRIGGER(ledtrig_gpib); led_trigger_event(ledtrig_gpib, LED_OFF); } \ while (0) -struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS]; +static struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS]; #define D01 all_descriptors[0] #define D02 all_descriptors[1] @@ -175,7 +175,7 @@ struct gpio_desc *all_descriptors[GPIB_PINS + SN7516X_PINS]; /* YOGA dapter uses a global enable for the buffer chips, re-using the TE pin */ #define YOGA_ENABLE TE -int gpios_vector[] = { +static int gpios_vector[] = { D01_pin_nr, D02_pin_nr, D03_pin_nr, diff --git a/drivers/staging/gpib/ines/ines_gpib.c b/drivers/staging/gpib/ines/ines_gpib.c index 846dafc85c11..22a05a287bce 100644 --- a/drivers/staging/gpib/ines/ines_gpib.c +++ b/drivers/staging/gpib/ines/ines_gpib.c @@ -357,38 +357,38 @@ struct ines_pci_id { enum ines_pci_chip pci_chip_type; }; -struct ines_pci_id pci_ids[] = { - {vendor_id: PCI_VENDOR_ID_PLX, - device_id : PCI_DEVICE_ID_PLX_9050, - subsystem_vendor_id : PCI_VENDOR_ID_PLX, - subsystem_device_id : PCI_SUBDEVICE_ID_INES_GPIB, - gpib_region : 2, - io_offset : 1, - pci_chip_type : PCI_CHIP_PLX9050, +static struct ines_pci_id pci_ids[] = { + {.vendor_id = PCI_VENDOR_ID_PLX, + .device_id = PCI_DEVICE_ID_PLX_9050, + .subsystem_vendor_id = PCI_VENDOR_ID_PLX, + .subsystem_device_id = PCI_SUBDEVICE_ID_INES_GPIB, + .gpib_region = 2, + .io_offset = 1, + .pci_chip_type = PCI_CHIP_PLX9050, }, - {vendor_id: PCI_VENDOR_ID_AMCC, - device_id : PCI_DEVICE_ID_INES_GPIB_AMCC, - subsystem_vendor_id : PCI_VENDOR_ID_AMCC, - subsystem_device_id : PCI_SUBDEVICE_ID_INES_GPIB, - gpib_region : 1, - io_offset : 1, - pci_chip_type : PCI_CHIP_AMCC5920, + {.vendor_id = PCI_VENDOR_ID_AMCC, + .device_id = PCI_DEVICE_ID_INES_GPIB_AMCC, + .subsystem_vendor_id = PCI_VENDOR_ID_AMCC, + .subsystem_device_id = PCI_SUBDEVICE_ID_INES_GPIB, + .gpib_region = 1, + .io_offset = 1, + .pci_chip_type = PCI_CHIP_AMCC5920, }, - {vendor_id: PCI_VENDOR_ID_INES_QUICKLOGIC, - device_id : PCI_DEVICE_ID_INES_GPIB_QL5030, - subsystem_vendor_id : PCI_VENDOR_ID_INES_QUICKLOGIC, - subsystem_device_id : PCI_DEVICE_ID_INES_GPIB_QL5030, - gpib_region : 1, - io_offset : 1, - pci_chip_type : PCI_CHIP_QUICKLOGIC5030, + {.vendor_id = PCI_VENDOR_ID_INES_QUICKLOGIC, + .device_id = PCI_DEVICE_ID_INES_GPIB_QL5030, + .subsystem_vendor_id = PCI_VENDOR_ID_INES_QUICKLOGIC, + .subsystem_device_id = PCI_DEVICE_ID_INES_GPIB_QL5030, + .gpib_region = 1, + .io_offset = 1, + .pci_chip_type = PCI_CHIP_QUICKLOGIC5030, }, - {vendor_id: PCI_VENDOR_ID_QUANCOM, - device_id : PCI_DEVICE_ID_QUANCOM_GPIB, - subsystem_vendor_id : -1, - subsystem_device_id : -1, - gpib_region : 0, - io_offset : 4, - pci_chip_type : PCI_CHIP_QUANCOM, + {.vendor_id = PCI_VENDOR_ID_QUANCOM, + .device_id = PCI_DEVICE_ID_QUANCOM_GPIB, + .subsystem_vendor_id = -1, + .subsystem_device_id = -1, + .gpib_region = 0, + .io_offset = 4, + .pci_chip_type = PCI_CHIP_QUANCOM, }, }; From d3fbbfa925c25d4d4453236173fb459ae2990265 Mon Sep 17 00:00:00 2001 From: Ajith P V Date: Tue, 14 Jan 2025 17:46:56 +0530 Subject: [PATCH 35/38] staging: gpib: fix prefixing 0x with decimal output * pr_err() of request_region() in cb7210 uses 0x%u which is defective. * The config->ibbase is of u32 and correct prefix is 0x%x. * This error reported by checkpatch with below message: ERROR: Prefixing 0x with decimal output is defective Signed-off-by: Ajith P V Link: https://lore.kernel.org/r/20250114121656.30577-1-ajithpv.linux@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/cb7210/cb7210.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gpib/cb7210/cb7210.c b/drivers/staging/gpib/cb7210/cb7210.c index ae373005389b..4d22f647a453 100644 --- a/drivers/staging/gpib/cb7210/cb7210.c +++ b/drivers/staging/gpib/cb7210/cb7210.c @@ -1041,7 +1041,7 @@ int cb_isa_attach(gpib_board_t *board, const gpib_board_config_t *config) cb_priv = board->private_data; nec_priv = &cb_priv->nec7210_priv; if (!request_region(config->ibbase, cb7210_iosize, "cb7210")) { - pr_err("gpib: ioports starting at 0x%u are already in use\n", config->ibbase); + pr_err("gpib: ioports starting at 0x%x are already in use\n", config->ibbase); return -EIO; } nec_priv->iobase = config->ibbase; From 9ed145e64f0af9a22e95f79940c540affbd939e2 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Thu, 16 Jan 2025 12:00:14 +0100 Subject: [PATCH 36/38] staging: gpib: Fix inadvertent negative shift During the initial checkpatch cleanup, when removing blanks after open parentheses, a minus sign in the argument of a shift operation was deleted by mistake. This transformed a pre-decrement operation into a negation. The result of a negative shift is undefined and a warning was signalled by sparse. Restore the pre-decrement operation. Fixes: 6c52d5e3cde2 ("staging: gpib: Add common include files for GPIB drivers") Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250116110014.15577-1-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/include/amcc5920.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/gpib/include/amcc5920.h b/drivers/staging/gpib/include/amcc5920.h index 766b3799223f..7a88bd282feb 100644 --- a/drivers/staging/gpib/include/amcc5920.h +++ b/drivers/staging/gpib/include/amcc5920.h @@ -22,7 +22,7 @@ static const int bits_per_region = 8; static inline uint32_t amcc_wait_state_bits(unsigned int region, unsigned int num_wait_states) { - return (num_wait_states & 0x7) << (-region * bits_per_region); + return (num_wait_states & 0x7) << (--region * bits_per_region); }; enum amcc_prefetch_bits { From 6a6c153537f093c3bc79ea9633f3954d3450d0ba Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Sat, 18 Jan 2025 15:50:45 +0100 Subject: [PATCH 37/38] staging: gpib: Fix NULL pointer dereference in detach When the detach function is called after a failed attach the usb_dev initialization can cause a NULL pointer dereference. This happens when the usb device is not found in the attach procedure. Remove the usb_dev variable and initialization and change the dev in the dev_info message from the usb_dev to the gpib_dev. Fixes: fbae7090f30c ("staging: gpib: Update messaging and usb_device refs in agilent_usb") Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250118145046.12181-2-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gpib/agilent_82357a/agilent_82357a.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c index 34d85a1bdb37..2aaccebc3c7b 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -1442,12 +1442,10 @@ static int agilent_82357a_go_idle(gpib_board_t *board) static void agilent_82357a_detach(gpib_board_t *board) { struct agilent_82357a_priv *a_priv; - struct usb_device *usb_dev; mutex_lock(&agilent_82357a_hotplug_lock); a_priv = board->private_data; - usb_dev = interface_to_usbdev(a_priv->bus_interface); if (a_priv) { if (a_priv->bus_interface) { agilent_82357a_go_idle(board); @@ -1459,7 +1457,7 @@ static void agilent_82357a_detach(gpib_board_t *board) agilent_82357a_cleanup_urbs(a_priv); agilent_82357a_free_private(a_priv); } - dev_info(&usb_dev->dev, "%s: detached\n", __func__); + dev_info(board->gpib_dev, "%s: detached\n", __func__); mutex_unlock(&agilent_82357a_hotplug_lock); } From 579b6f18c5ca162af040f44684cc55f7da182236 Mon Sep 17 00:00:00 2001 From: Dave Penkler Date: Sat, 18 Jan 2025 15:50:46 +0100 Subject: [PATCH 38/38] staging: gpib: Agilent usb code cleanup Remove useless #ifdef RESET_USB_CONFIG code. Change kalloc / memset to kzalloc The attach function was not freeing the private data on error returns. Separate the releasing of urbs and private data and add a common error exit for attach failure. Set the board private data pointer to NULL after freeing the private data. Reduce console spam by emitting only one attach message. Change last pr_err in attach to dev_err Signed-off-by: Dave Penkler Link: https://lore.kernel.org/r/20250118145046.12181-3-dpenkler@gmail.com Signed-off-by: Greg Kroah-Hartman --- .../gpib/agilent_82357a/agilent_82357a.c | 84 ++++++++----------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c index 2aaccebc3c7b..69f0e490d401 100644 --- a/drivers/staging/gpib/agilent_82357a/agilent_82357a.c +++ b/drivers/staging/gpib/agilent_82357a/agilent_82357a.c @@ -1146,25 +1146,6 @@ static int agilent_82357a_setup_urbs(gpib_board_t *board) return retval; } -#ifdef RESET_USB_CONFIG -static int agilent_82357a_reset_usb_configuration(gpib_board_t *board) -{ - struct agilent_82357a_priv *a_priv = board->private_data; - struct usb_device *usb_dev = interface_to_usbdev(a_priv->bus_interface); - struct usb_device *usb_dev; - int retval; - - if (!a_priv->bus_interface) - return -ENODEV; - usb_dev = interface_to_usbdev(a_priv->bus_interface); - retval = usb_reset_configuration(usb_dev); - if (retval) - dev_err(&usb_dev->dev, "%s: usb_reset_configuration() returned %i\n", - __func__, retval); - return retval; -} -#endif - static void agilent_82357a_cleanup_urbs(struct agilent_82357a_priv *a_priv) { if (a_priv && a_priv->bus_interface) { @@ -1175,15 +1156,23 @@ static void agilent_82357a_cleanup_urbs(struct agilent_82357a_priv *a_priv) } }; +static void agilent_82357a_release_urbs(struct agilent_82357a_priv *a_priv) +{ + if (a_priv) { + usb_free_urb(a_priv->interrupt_urb); + a_priv->interrupt_urb = NULL; + kfree(a_priv->interrupt_buffer); + } +} + static int agilent_82357a_allocate_private(gpib_board_t *board) { struct agilent_82357a_priv *a_priv; - board->private_data = kmalloc(sizeof(struct agilent_82357a_priv), GFP_KERNEL); + board->private_data = kzalloc(sizeof(struct agilent_82357a_priv), GFP_KERNEL); if (!board->private_data) return -ENOMEM; a_priv = board->private_data; - memset(a_priv, 0, sizeof(struct agilent_82357a_priv)); mutex_init(&a_priv->bulk_transfer_lock); mutex_init(&a_priv->bulk_alloc_lock); mutex_init(&a_priv->control_alloc_lock); @@ -1191,11 +1180,11 @@ static int agilent_82357a_allocate_private(gpib_board_t *board) return 0; } -static void agilent_82357a_free_private(struct agilent_82357a_priv *a_priv) +static void agilent_82357a_free_private(gpib_board_t *board) { - usb_free_urb(a_priv->interrupt_urb); - kfree(a_priv->interrupt_buffer); - kfree(a_priv); + kfree(board->private_data); + board->private_data = NULL; + } static int agilent_82357a_init(gpib_board_t *board) @@ -1342,16 +1331,14 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t a_priv->bus_interface = agilent_82357a_driver_interfaces[i]; usb_set_intfdata(agilent_82357a_driver_interfaces[i], board); usb_dev = interface_to_usbdev(a_priv->bus_interface); - dev_info(&usb_dev->dev, - "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n", - usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); break; } } if (i == MAX_NUM_82357A_INTERFACES) { - mutex_unlock(&agilent_82357a_hotplug_lock); - pr_err("No Agilent 82357 gpib adapters found, have you loaded its firmware?\n"); - return -ENODEV; + dev_err(board->gpib_dev, + "No Agilent 82357 gpib adapters found, have you loaded its firmware?\n"); + retval = -ENODEV; + goto attach_fail; } product_id = le16_to_cpu(interface_to_usbdev(a_priv->bus_interface)->descriptor.idProduct); switch (product_id) { @@ -1365,21 +1352,13 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t break; default: dev_err(&usb_dev->dev, "bug, unhandled product_id in switch?\n"); - mutex_unlock(&agilent_82357a_hotplug_lock); - return -EIO; + retval = -EIO; + goto attach_fail; } -#ifdef RESET_USB_CONFIG - retval = agilent_82357a_reset_usb_configuration(board); - if (retval < 0) { - mutex_unlock(&agilent_82357a_hotplug_lock); - return retval; - } -#endif + retval = agilent_82357a_setup_urbs(board); - if (retval < 0) { - mutex_unlock(&agilent_82357a_hotplug_lock); - return retval; - } + if (retval < 0) + goto attach_fail; timer_setup(&a_priv->bulk_timer, agilent_82357a_timeout_handler, 0); @@ -1388,11 +1367,19 @@ static int agilent_82357a_attach(gpib_board_t *board, const gpib_board_config_t retval = agilent_82357a_init(board); if (retval < 0) { - mutex_unlock(&agilent_82357a_hotplug_lock); - return retval; + agilent_82357a_cleanup_urbs(a_priv); + agilent_82357a_release_urbs(a_priv); + goto attach_fail; } - dev_info(&usb_dev->dev, "%s: attached\n", __func__); + dev_info(&usb_dev->dev, + "bus %d dev num %d attached to gpib minor %d, agilent usb interface %i\n", + usb_dev->bus->busnum, usb_dev->devnum, board->minor, i); + mutex_unlock(&agilent_82357a_hotplug_lock); + return retval; + +attach_fail: + agilent_82357a_free_private(board); mutex_unlock(&agilent_82357a_hotplug_lock); return retval; } @@ -1455,7 +1442,8 @@ static void agilent_82357a_detach(gpib_board_t *board) mutex_lock(&a_priv->bulk_alloc_lock); mutex_lock(&a_priv->interrupt_alloc_lock); agilent_82357a_cleanup_urbs(a_priv); - agilent_82357a_free_private(a_priv); + agilent_82357a_release_urbs(a_priv); + agilent_82357a_free_private(board); } dev_info(board->gpib_dev, "%s: detached\n", __func__); mutex_unlock(&agilent_82357a_hotplug_lock);