Skip to content

Commit 1c7e15b

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
char/mwave: drop printk wrapper
PRINTK_ERROR() + KERN_ERR_MWAVE are just wrappers around printk() with a prefix. Instead, pr_fmt() can be used. Drop the former and use the latter. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20251119091949.825958-6-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 53688a9 commit 1c7e15b

5 files changed

Lines changed: 74 additions & 85 deletions

File tree

drivers/char/mwave/3780i.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* First release to the public
4747
*/
4848

49+
#define pr_fmt(fmt) "3780i: " fmt
50+
4951
#include <linux/kernel.h>
5052
#include <linux/unistd.h>
5153
#include <linux/delay.h>
@@ -138,7 +140,7 @@ int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
138140
unsigned short tval;
139141

140142
if (!pSettings->bDSPEnabled) {
141-
PRINTK_ERROR( KERN_ERR "3780i::dsp3780I_EnableDSP: Error: DSP not enabled. Aborting.\n" );
143+
pr_err("%s: Error: DSP not enabled. Aborting.\n", __func__);
142144
return -EIO;
143145
}
144146

drivers/char/mwave/mwavedd.c

Lines changed: 17 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* First release to the public
4747
*/
4848

49+
#define pr_fmt(fmt) "mwavedd: " fmt
50+
4951
#include <linux/module.h>
5052
#include <linux/kernel.h>
5153
#include <linux/fs.h>
@@ -200,11 +202,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
200202
unsigned int ipcnum = (unsigned int) ioarg;
201203

202204
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
203-
PRINTK_ERROR(KERN_ERR_MWAVE
204-
"mwavedd::mwave_ioctl:"
205-
" IOCTL_MW_REGISTER_IPC:"
206-
" Error: Invalid ipcnum %x\n",
207-
ipcnum);
205+
pr_err("%s: IOCTL_MW_REGISTER_IPC: Error: Invalid ipcnum %x\n",
206+
__func__, ipcnum);
208207
return -EINVAL;
209208
}
210209
ipcnum = array_index_nospec(ipcnum,
@@ -221,10 +220,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
221220
unsigned int ipcnum = (unsigned int) ioarg;
222221

223222
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
224-
PRINTK_ERROR(KERN_ERR_MWAVE
225-
"mwavedd::mwave_ioctl:"
226-
" IOCTL_MW_GET_IPC: Error:"
227-
" Invalid ipcnum %x\n", ipcnum);
223+
pr_err("%s: IOCTL_MW_GET_IPC: Error: Invalid ipcnum %x\n", __func__,
224+
ipcnum);
228225
return -EINVAL;
229226
}
230227
ipcnum = array_index_nospec(ipcnum,
@@ -259,11 +256,8 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
259256
unsigned int ipcnum = (unsigned int) ioarg;
260257

261258
if (ipcnum >= ARRAY_SIZE(pDrvData->IPCs)) {
262-
PRINTK_ERROR(KERN_ERR_MWAVE
263-
"mwavedd::mwave_ioctl:"
264-
" IOCTL_MW_UNREGISTER_IPC:"
265-
" Error: Invalid ipcnum %x\n",
266-
ipcnum);
259+
pr_err("%s: IOCTL_MW_UNREGISTER_IPC: Error: Invalid ipcnum %x\n",
260+
__func__, ipcnum);
267261
return -EINVAL;
268262
}
269263
ipcnum = array_index_nospec(ipcnum,
@@ -298,9 +292,7 @@ static int register_serial_portandirq(unsigned int port, int irq)
298292
/* OK */
299293
break;
300294
default:
301-
PRINTK_ERROR(KERN_ERR_MWAVE
302-
"mwavedd::register_serial_portandirq:"
303-
" Error: Illegal port %x\n", port );
295+
pr_err("%s: Error: Illegal port %x\n", __func__, port);
304296
return -1;
305297
} /* switch */
306298
/* port is okay */
@@ -313,9 +305,7 @@ static int register_serial_portandirq(unsigned int port, int irq)
313305
/* OK */
314306
break;
315307
default:
316-
PRINTK_ERROR(KERN_ERR_MWAVE
317-
"mwavedd::register_serial_portandirq:"
318-
" Error: Illegal irq %x\n", irq );
308+
pr_err("%s: Error: Illegal irq %x\n", __func__, irq);
319309
return -1;
320310
} /* switch */
321311
/* irq is okay */
@@ -391,43 +381,33 @@ static int __init mwave_init(void)
391381

392382
retval = tp3780I_InitializeBoardData(&pDrvData->rBDData);
393383
if (retval) {
394-
PRINTK_ERROR(KERN_ERR_MWAVE
395-
"mwavedd::mwave_init: Error:"
396-
" Failed to initialize board data\n");
384+
pr_err("%s: Error: Failed to initialize board data\n", __func__);
397385
goto cleanup_error;
398386
}
399387
pDrvData->bBDInitialized = true;
400388

401389
retval = tp3780I_CalcResources(&pDrvData->rBDData);
402390
if (retval) {
403-
PRINTK_ERROR(KERN_ERR_MWAVE
404-
"mwavedd:mwave_init: Error:"
405-
" Failed to calculate resources\n");
391+
pr_err("%s: Error: Failed to calculate resources\n", __func__);
406392
goto cleanup_error;
407393
}
408394

409395
retval = tp3780I_ClaimResources(&pDrvData->rBDData);
410396
if (retval) {
411-
PRINTK_ERROR(KERN_ERR_MWAVE
412-
"mwavedd:mwave_init: Error:"
413-
" Failed to claim resources\n");
397+
pr_err("%s: Error: Failed to claim resources\n", __func__);
414398
goto cleanup_error;
415399
}
416400
pDrvData->bResourcesClaimed = true;
417401

418402
retval = tp3780I_EnableDSP(&pDrvData->rBDData);
419403
if (retval) {
420-
PRINTK_ERROR(KERN_ERR_MWAVE
421-
"mwavedd:mwave_init: Error:"
422-
" Failed to enable DSP\n");
404+
pr_err("%s: Error: Failed to enable DSP\n", __func__);
423405
goto cleanup_error;
424406
}
425407
pDrvData->bDSPEnabled = true;
426408

427409
if (misc_register(&mwave_misc_dev) < 0) {
428-
PRINTK_ERROR(KERN_ERR_MWAVE
429-
"mwavedd:mwave_init: Error:"
430-
" Failed to register misc device\n");
410+
pr_err("%s: Error: Failed to register misc device\n", __func__);
431411
goto cleanup_error;
432412
}
433413
pDrvData->bMwaveDevRegistered = true;
@@ -437,9 +417,7 @@ static int __init mwave_init(void)
437417
pDrvData->rBDData.rDspSettings.usUartIrq
438418
);
439419
if (pDrvData->sLine < 0) {
440-
PRINTK_ERROR(KERN_ERR_MWAVE
441-
"mwavedd:mwave_init: Error:"
442-
" Failed to register serial driver\n");
420+
pr_err("%s: Error: Failed to register serial driver\n", __func__);
443421
goto cleanup_error;
444422
}
445423
/* uart is registered */
@@ -448,9 +426,7 @@ static int __init mwave_init(void)
448426
return 0;
449427

450428
cleanup_error:
451-
PRINTK_ERROR(KERN_ERR_MWAVE
452-
"mwavedd::mwave_init: Error:"
453-
" Failed to initialize\n");
429+
pr_err("%s: Error: Failed to initialize\n", __func__);
454430
mwave_exit(); /* clean up */
455431

456432
return -EIO;

drivers/char/mwave/mwavedd.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ extern int mwave_3780i_io;
6161
extern int mwave_uart_irq;
6262
extern int mwave_uart_io;
6363

64-
#define PRINTK_ERROR printk
65-
#define KERN_ERR_MWAVE KERN_ERR "mwave: "
66-
6764
typedef struct _MWAVE_IPC {
6865
unsigned short usIntCount; /* 0=none, 1=first, 2=greater than 1st */
6966
bool bIsEnabled;

drivers/char/mwave/smapi.c

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
* First release to the public
4747
*/
4848

49+
#define pr_fmt(fmt) "smapi: " fmt
50+
4951
#include <linux/kernel.h>
5052
#include <linux/mc146818rtc.h> /* CMOS defines */
5153
#include "smapi.h"
@@ -127,7 +129,7 @@ int smapi_query_DSP_cfg(SMAPI_DSP_SETTINGS * pSettings)
127129
bRC = smapi_request(0x1802, 0x0000, 0, 0,
128130
&usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
129131
if (bRC) {
130-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Error: Could not get DSP Settings. Aborting.\n");
132+
pr_err("%s: Error: Could not get DSP Settings. Aborting.\n", __func__);
131133
return bRC;
132134
}
133135

@@ -143,14 +145,14 @@ int smapi_query_DSP_cfg(SMAPI_DSP_SETTINGS * pSettings)
143145

144146
/* check for illegal values */
145147
if ( pSettings->usDspBaseIO == 0 )
146-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: DSP base I/O address is 0\n");
148+
pr_err("%s: Worry: DSP base I/O address is 0\n", __func__);
147149
if ( pSettings->usDspIRQ == 0 )
148-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: DSP IRQ line is 0\n");
150+
pr_err("%s: Worry: DSP IRQ line is 0\n", __func__);
149151

150152
bRC = smapi_request(0x1804, 0x0000, 0, 0,
151153
&usAX, &usBX, &usCX, &usDX, &usDI, &usSI);
152154
if (bRC) {
153-
PRINTK_ERROR("smapi::smapi_query_DSP_cfg: Error: Could not get DSP modem settings. Aborting.\n");
155+
pr_err("%s: Error: Could not get DSP modem settings. Aborting.\n", __func__);
154156
return bRC;
155157
}
156158

@@ -164,9 +166,9 @@ int smapi_query_DSP_cfg(SMAPI_DSP_SETTINGS * pSettings)
164166

165167
/* check for illegal values */
166168
if ( pSettings->usUartBaseIO == 0 )
167-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: UART base I/O address is 0\n");
169+
pr_err("%s: Worry: UART base I/O address is 0\n", __func__);
168170
if ( pSettings->usUartIRQ == 0 )
169-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_query_DSP_cfg: Worry: UART IRQ line is 0\n");
171+
pr_err("%s: Worry: UART IRQ line is 0\n", __func__);
170172

171173
return bRC;
172174
}
@@ -195,7 +197,8 @@ int smapi_set_DSP_cfg(void)
195197
break;
196198
}
197199
if (i == ARRAY_SIZE(ausDspBases)) {
198-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_3780i_io address %x. Aborting.\n", mwave_3780i_io);
200+
pr_err("%s: Error: Invalid mwave_3780i_io address %x. Aborting.\n",
201+
__func__, mwave_3780i_io);
199202
return bRC;
200203
}
201204
dspio_index = i;
@@ -207,7 +210,8 @@ int smapi_set_DSP_cfg(void)
207210
break;
208211
}
209212
if (i == ARRAY_SIZE(ausDspIrqs)) {
210-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_3780i_irq %x. Aborting.\n", mwave_3780i_irq);
213+
pr_err("%s: Error: Invalid mwave_3780i_irq %x. Aborting.\n", __func__,
214+
mwave_3780i_irq);
211215
return bRC;
212216
}
213217
}
@@ -218,7 +222,8 @@ int smapi_set_DSP_cfg(void)
218222
break;
219223
}
220224
if (i == ARRAY_SIZE(ausUartBases)) {
221-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_uart_io address %x. Aborting.\n", mwave_uart_io);
225+
pr_err("%s: Error: Invalid mwave_uart_io address %x. Aborting.\n", __func__,
226+
mwave_uart_io);
222227
return bRC;
223228
}
224229
uartio_index = i;
@@ -231,7 +236,8 @@ int smapi_set_DSP_cfg(void)
231236
break;
232237
}
233238
if (i == ARRAY_SIZE(ausUartIrqs)) {
234-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg: Error: Invalid mwave_uart_irq %x. Aborting.\n", mwave_uart_irq);
239+
pr_err("%s: Error: Invalid mwave_uart_irq %x. Aborting.\n", __func__,
240+
mwave_uart_irq);
235241
return bRC;
236242
}
237243
}
@@ -246,13 +252,14 @@ int smapi_set_DSP_cfg(void)
246252
if (usBX & 0x0100) { /* serial port A is present */
247253
if (usCX & 1) { /* serial port is enabled */
248254
if ((usSI & 0xFF) == mwave_uart_irq) {
249-
PRINTK_ERROR(KERN_ERR_MWAVE
250-
"smapi::smapi_set_DSP_cfg: Serial port A irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
255+
pr_err("%s: Serial port A irq %x conflicts with mwave_uart_irq %x\n",
256+
__func__, usSI & 0xFF, mwave_uart_irq);
251257
goto exit_conflict;
252258
} else {
253259
if ((usSI >> 8) == uartio_index) {
254-
PRINTK_ERROR(KERN_ERR_MWAVE
255-
"smapi::smapi_set_DSP_cfg: Serial port A base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
260+
pr_err("%s: Serial port A base I/O address %x conflicts with mwave uart I/O %x\n",
261+
__func__, ausUartBases[usSI >> 8],
262+
ausUartBases[uartio_index]);
256263
goto exit_conflict;
257264
}
258265
}
@@ -267,13 +274,14 @@ int smapi_set_DSP_cfg(void)
267274
if (usBX & 0x0100) { /* serial port B is present */
268275
if (usCX & 1) { /* serial port is enabled */
269276
if ((usSI & 0xFF) == mwave_uart_irq) {
270-
PRINTK_ERROR(KERN_ERR_MWAVE
271-
"smapi::smapi_set_DSP_cfg: Serial port B irq %x conflicts with mwave_uart_irq %x\n", usSI & 0xFF, mwave_uart_irq);
277+
pr_err("%s: Serial port B irq %x conflicts with mwave_uart_irq %x\n",
278+
__func__, usSI & 0xFF, mwave_uart_irq);
272279
goto exit_conflict;
273280
} else {
274281
if ((usSI >> 8) == uartio_index) {
275-
PRINTK_ERROR(KERN_ERR_MWAVE
276-
"smapi::smapi_set_DSP_cfg: Serial port B base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI >> 8], ausUartBases[uartio_index]);
282+
pr_err("%s: Serial port B base I/O address %x conflicts with mwave uart I/O %x\n",
283+
__func__, ausUartBases[usSI >> 8],
284+
ausUartBases[uartio_index]);
277285
goto exit_conflict;
278286
}
279287
}
@@ -290,13 +298,14 @@ int smapi_set_DSP_cfg(void)
290298
/* bRC == 0 */
291299
if ((usCX & 0xff) != 0xff) { /* IR port not disabled */
292300
if ((usCX & 0xff) == mwave_uart_irq) {
293-
PRINTK_ERROR(KERN_ERR_MWAVE
294-
"smapi::smapi_set_DSP_cfg: IR port irq %x conflicts with mwave_uart_irq %x\n", usCX & 0xff, mwave_uart_irq);
301+
pr_err("%s: IR port irq %x conflicts with mwave_uart_irq %x\n",
302+
__func__, usCX & 0xff, mwave_uart_irq);
295303
goto exit_conflict;
296304
} else {
297305
if ((usSI & 0xff) == uartio_index) {
298-
PRINTK_ERROR(KERN_ERR_MWAVE
299-
"smapi::smapi_set_DSP_cfg: IR port base I/O address %x conflicts with mwave uart I/O %x\n", ausUartBases[usSI & 0xff], ausUartBases[uartio_index]);
306+
pr_err("%s: IR port base I/O address %x conflicts with mwave uart I/O %x\n",
307+
__func__, ausUartBases[usSI & 0xff],
308+
ausUartBases[uartio_index]);
300309
goto exit_conflict;
301310
}
302311
}
@@ -348,7 +357,7 @@ int smapi_set_DSP_cfg(void)
348357
return -EIO;
349358

350359
exit_smapi_request_error:
351-
PRINTK_ERROR(KERN_ERR_MWAVE "smapi::smapi_set_DSP_cfg exit on smapi_request error bRC %x\n", bRC);
360+
pr_err("%s: exit on smapi_request error bRC %x\n", __func__, bRC);
352361
return bRC;
353362
}
354363

@@ -381,13 +390,13 @@ int smapi_init(void)
381390
g_usSmapiPort |= (CMOS_READ(0x7F) << 8);
382391
spin_unlock_irqrestore(&rtc_lock, flags);
383392
if (g_usSmapiPort == 0) {
384-
PRINTK_ERROR("smapi::smapi_init, ERROR unable to read from SMAPI port\n");
393+
pr_err("%s: ERROR unable to read from SMAPI port\n", __func__);
385394
} else {
386395
retval = 0;
387396
//SmapiQuerySystemID();
388397
}
389398
} else {
390-
PRINTK_ERROR("smapi::smapi_init, ERROR invalid usSmapiID\n");
399+
pr_err("%s: ERROR invalid usSmapiID\n", __func__);
391400
retval = -ENXIO;
392401
}
393402

0 commit comments

Comments
 (0)