[PATCH 5/9] Remove GPIB_DEBUG reference and update messaging

Dave Penkler
2024-11-01T17:47:48Z

Change pr_alert to dev_alert

Signed-off-by: Dave Penkler <dpenkler@gmail.com>
---
.../gpib/lpvo_usb_gpib/lpvo_usb_gpib.c | 69 +++++++++----------
1 file changed, 34 insertions(+), 35 deletions(-)

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 4c580137043f..796c3a5be545 100644
--- a/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
+++ b/drivers/staging/gpib/lpvo_usb_gpib/lpvo_usb_gpib.c
@@ -68,11 +68,8 @@ MODULE_DEVICE_TABLE(usb, skel_table);
* At module loading: modprobe lpvo_usb_gpib debug={0,1,2}
* On the fly: echo {0,1,2} > /sys/modules/lpvo_usb_gpib/parameters/debug
*/
-#ifdef GPIB_DEBUG
-static int debug = 1;
-#else
+
static int debug;
-#endif
module_param(debug, int, 0644);

#define DIA_LOG(level, format, ...) \
@@ -366,10 +363,10 @@ static int one_char(gpib_board_t *board, struct char_buf *b)
DIA_LOG(2, "--> %x\n", b->inbuf[b->last - b->nchar]);
return b->inbuf[b->last - b->nchar--];
} else if (b->nchar == 0) {
- pr_alert("%s:%s - read returned EOF\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - read returned EOF\n", NAME, __func__);
return -EIO;
}
- pr_alert("%s:%s - read error %d\n", NAME, __func__, b->nchar);
+ dev_alert(board->gpib_dev, "%s:%s - read error %d\n", NAME, __func__, b->nchar);
TTY_LOG("\n *** %s *** Read Error - %s\n", NAME,
"Reset the adapter with 'gpib_config'\n");
return -EIO;
@@ -412,8 +409,8 @@ static void set_timeout(gpib_board_t *board)
}

if (val != ACK) {
- pr_alert("%s:%s - error in timeout set: <%s>\n",
- NAME, __func__, command);
+ dev_alert(board->gpib_dev, "%s:%s - error in timeout set: <%s>\n",
+ NAME, __func__, command);
} else {
data->timeout = board->usec_timeout;
}
@@ -456,8 +453,8 @@ static int usb_gpib_attach(gpib_board_t *board, const gpib_board_config_t *confi

if (config->device_path) {
/* if config->device_path given, try that first */
- pr_alert("%s:%s - Looking for device_path: %s\n",
- NAME, __func__, config->device_path);
+ dev_alert(board->gpib_dev, "%s:%s - Looking for device_path: %s\n",
+ NAME, __func__, config->device_path);
for (j = 0 ; j < MAX_DEV ; j++) {
if ((assigned_usb_minors & 1 << j) == 0)
continue;
@@ -492,7 +489,8 @@ static int usb_gpib_attach(gpib_board_t *board, const gpib_board_config_t *confi
mutex_unlock(&minors_lock);

if (j == MAX_DEV) {
- pr_alert("%s:%s - Requested device is not registered.\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - Requested device is not registered.\n",
+ NAME, __func__);
return -EIO;
}

@@ -737,7 +735,8 @@ static int usb_gpib_line_status(const gpib_board_t *board)
buffer = send_command((gpib_board_t *)board, USB_GPIB_STATUS, 0);

if (buffer < 0) {
- pr_alert("%s:%s - line status read failed with %d\n", NAME, __func__, buffer);
+ dev_alert(board->gpib_dev, "%s:%s - line status read failed with %d\n",
+ NAME, __func__, buffer);
return -1;
}

@@ -777,7 +776,7 @@ static int usb_gpib_parallel_poll(gpib_board_t *board, uint8_t *result)

retval = set_control_line(board, IB_BUS_EOI, 1);
if (retval != ACK) {
- pr_alert("%s:%s - assert EOI failed\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - assert EOI failed\n", NAME, __func__);
return -EIO;
}

@@ -787,7 +786,7 @@ static int usb_gpib_parallel_poll(gpib_board_t *board, uint8_t *result)

retval = set_control_line(board, IB_BUS_EOI, 0);
if (retval != 0x06) {
- pr_alert("%s:%s - unassert EOI failed\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - unassert EOI failed\n", NAME, __func__);
return -EIO;
}

@@ -869,8 +868,8 @@ static int usb_gpib_read(gpib_board_t *board,
goto read_return;

if (one_char(board, &b) != DLE || one_char(board, &b) != STX) {
- pr_alert("%s:%s - wrong <DLE><STX> sequence\n",
- NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - wrong <DLE><STX> sequence\n",
+ NAME, __func__);
retval = -EIO;
goto read_return;
}
@@ -910,15 +909,15 @@ static int usb_gpib_read(gpib_board_t *board,
retval = 0;
goto read_return;
} else {
- pr_alert("%s:%s - %s %x\n",
- NAME, __func__,
- "Wrong end of message", c);
+ dev_alert(board->gpib_dev, "%s:%s - %s %x\n",
+ NAME, __func__,
+ "Wrong end of message", c);
retval = -ETIME;
goto read_return;
}
} else {
- pr_alert("%s:%s - %s\n", NAME, __func__,
- "lone <DLE> in stream");
+ dev_alert(board->gpib_dev, "%s:%s - %s\n", NAME, __func__,
+ "lone <DLE> in stream");
retval = -EIO;
goto read_return;
}
@@ -937,8 +936,8 @@ static int usb_gpib_read(gpib_board_t *board,
c = one_char(board, &b);
if (c == ACK) {
if (MAX_READ_EXCESS - read_count > 1)
- pr_alert("%s:%s - %s\n", NAME, __func__,
- "small buffer - maybe some data lost");
+ dev_alert(board->gpib_dev, "%s:%s - %s\n", NAME, __func__,
+ "small buffer - maybe some data lost");
retval = 0;
goto read_return;
}
@@ -946,8 +945,8 @@ static int usb_gpib_read(gpib_board_t *board,
}
}

- pr_alert("%s:%s - no input end - GPIB board in odd state\n",
- NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - no input end - GPIB board in odd state\n",
+ NAME, __func__);
retval = -EIO;

read_return:
@@ -973,8 +972,8 @@ static void usb_gpib_remote_enable(gpib_board_t *board, int enable)

retval = set_control_line(board, IB_BUS_REN, enable ? 1 : 0);
if (retval != ACK)
- pr_alert("%s:%s - could not set REN line: %x\n",
- NAME, __func__, retval);
+ dev_alert(board->gpib_dev, "%s:%s - could not set REN line: %x\n",
+ NAME, __func__, retval);

DIA_LOG(1, "done with %x\n", retval);
}
@@ -1072,21 +1071,21 @@ static int usb_gpib_write(gpib_board_t *board,
static void usb_gpib_parallel_poll_configure(gpib_board_t *board,
uint8_t configuration)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}

/* parallel_poll_response */

static void usb_gpib_parallel_poll_response(gpib_board_t *board, int ist)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}

/* primary_address */

static int usb_gpib_primary_address(gpib_board_t *board, unsigned int address)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}

@@ -1094,7 +1093,7 @@ static int usb_gpib_primary_address(gpib_board_t *board, unsigned int address)

static void usb_gpib_return_to_local(gpib_board_t *board)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}

/* secondary_address */
@@ -1103,7 +1102,7 @@ static int usb_gpib_secondary_address(gpib_board_t *board,
unsigned int address,
int enable)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}

@@ -1111,14 +1110,14 @@ static int usb_gpib_secondary_address(gpib_board_t *board,

static void usb_gpib_serial_poll_response(gpib_board_t *board, uint8_t status)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
}

/* serial_poll_status */

static uint8_t usb_gpib_serial_poll_status(gpib_board_t *board)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}

@@ -1126,7 +1125,7 @@ static uint8_t usb_gpib_serial_poll_status(gpib_board_t *board)

static unsigned int usb_gpib_t1_delay(gpib_board_t *board, unsigned int nano_sec)
{
- pr_alert("%s:%s - currently a NOP\n", NAME, __func__);
+ dev_alert(board->gpib_dev, "%s:%s - currently a NOP\n", NAME, __func__);
return 0;
}

--
2.46.2