Skip to content

Commit 00a925e

Browse files
Jiri Slaby (SUSE)gregkh
authored andcommitted
char/mwave: drop typedefs
typedefs are unnecessary here. They rather obfuscate the code than help. So drop them and use the types directly. Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/20251119091949.825958-7-jirislaby@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1c7e15b commit 00a925e

9 files changed

Lines changed: 89 additions & 93 deletions

File tree

drivers/char/mwave/3780i.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static void dsp3780I_WriteGenCfg(unsigned short usDspBaseIO, unsigned uIndex,
115115
OutByteDsp(DSP_IsaSlaveControl, MKBYTE(rSlaveControl_Save));
116116
}
117117

118-
int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
118+
int dsp3780I_EnableDSP(struct dsp_3780i_config_settings *pSettings,
119119
unsigned short *pIrqMap,
120120
unsigned short *pDmaMap)
121121
{
@@ -260,7 +260,7 @@ int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
260260
return 0;
261261
}
262262

263-
int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings)
263+
int dsp3780I_DisableDSP(struct dsp_3780i_config_settings *pSettings)
264264
{
265265
unsigned long flags;
266266
unsigned short usDspBaseIO = pSettings->usDspBaseIO;
@@ -284,7 +284,7 @@ int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings)
284284
return 0;
285285
}
286286

287-
int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings)
287+
int dsp3780I_Reset(struct dsp_3780i_config_settings *pSettings)
288288
{
289289
unsigned long flags;
290290
unsigned short usDspBaseIO = pSettings->usDspBaseIO;
@@ -317,7 +317,7 @@ int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings)
317317
}
318318

319319

320-
int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings)
320+
int dsp3780I_Run(struct dsp_3780i_config_settings *pSettings)
321321
{
322322
unsigned long flags;
323323
unsigned short usDspBaseIO = pSettings->usDspBaseIO;

drivers/char/mwave/3780i.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ typedef struct {
261261
* the only values maintained by the 3780i support layer are the saved UART
262262
* registers.
263263
*/
264-
typedef struct _DSP_3780I_CONFIG_SETTINGS {
264+
struct dsp_3780i_config_settings {
265265

266266
/* Location of base configuration register */
267267
unsigned short usBaseConfigIO;
@@ -313,16 +313,16 @@ typedef struct _DSP_3780I_CONFIG_SETTINGS {
313313
unsigned char ucSCR; /* Scratch register */
314314
unsigned char ucDLL; /* Divisor latch, low byte */
315315
unsigned char ucDLM; /* Divisor latch, high byte */
316-
} DSP_3780I_CONFIG_SETTINGS;
316+
};
317317

318318

319319
/* 3780i support functions */
320-
int dsp3780I_EnableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings,
320+
int dsp3780I_EnableDSP(struct dsp_3780i_config_settings *pSettings,
321321
unsigned short *pIrqMap,
322322
unsigned short *pDmaMap);
323-
int dsp3780I_DisableDSP(DSP_3780I_CONFIG_SETTINGS * pSettings);
324-
int dsp3780I_Reset(DSP_3780I_CONFIG_SETTINGS * pSettings);
325-
int dsp3780I_Run(DSP_3780I_CONFIG_SETTINGS * pSettings);
323+
int dsp3780I_DisableDSP(struct dsp_3780i_config_settings *pSettings);
324+
int dsp3780I_Reset(struct dsp_3780i_config_settings *pSettings);
325+
int dsp3780I_Run(struct dsp_3780i_config_settings *pSettings);
326326
int dsp3780I_ReadDStore(unsigned short usDspBaseIO, void __user *pvBuffer,
327327
unsigned uCount, unsigned long ulDSPAddr);
328328
int dsp3780I_ReadAndClearDStore(unsigned short usDspBaseIO,

drivers/char/mwave/mwavedd.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ module_param_hw(mwave_3780i_io, int, ioport, 0);
8686
module_param_hw(mwave_uart_irq, int, irq, 0);
8787
module_param_hw(mwave_uart_io, int, ioport, 0);
8888

89-
MWAVE_DEVICE_DATA mwave_s_mdd;
89+
struct mwave_device_data mwave_s_mdd;
9090

9191
static long mwave_ioctl(struct file *file, unsigned int iocmd,
9292
unsigned long ioarg)
9393
{
9494
unsigned int retval = 0;
95-
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
95+
struct mwave_device_data *pDrvData = &mwave_s_mdd;
9696
void __user *arg = (void __user *)ioarg;
9797

9898
switch (iocmd) {
@@ -110,27 +110,26 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
110110
break;
111111

112112
case IOCTL_MW_DSP_ABILITIES: {
113-
MW_ABILITIES rAbilities;
113+
struct mw_abilities rAbilities;
114114

115115
mutex_lock(&mwave_mutex);
116116
retval = tp3780I_QueryAbilities(&pDrvData->rBDData,
117117
&rAbilities);
118118
mutex_unlock(&mwave_mutex);
119119
if (retval == 0) {
120-
if( copy_to_user(arg, &rAbilities,
121-
sizeof(MW_ABILITIES)) )
120+
if (copy_to_user(arg, &rAbilities, sizeof(rAbilities)))
122121
return -EFAULT;
123122
}
124123
}
125124
break;
126125

127126
case IOCTL_MW_READ_DATA:
128127
case IOCTL_MW_READCLEAR_DATA: {
129-
MW_READWRITE rReadData;
128+
struct mw_readwrite rReadData;
130129
unsigned short __user *pusBuffer = NULL;
131130

132131
if( copy_from_user(&rReadData, arg,
133-
sizeof(MW_READWRITE)) )
132+
sizeof(struct mw_readwrite)) )
134133
return -EFAULT;
135134
pusBuffer = (unsigned short __user *) (rReadData.pBuf);
136135

@@ -145,11 +144,10 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
145144
break;
146145

147146
case IOCTL_MW_READ_INST: {
148-
MW_READWRITE rReadData;
147+
struct mw_readwrite rReadData;
149148
unsigned short __user *pusBuffer = NULL;
150149

151-
if( copy_from_user(&rReadData, arg,
152-
sizeof(MW_READWRITE)) )
150+
if (copy_from_user(&rReadData, arg, sizeof(rReadData)))
153151
return -EFAULT;
154152
pusBuffer = (unsigned short __user *) (rReadData.pBuf);
155153

@@ -163,11 +161,10 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
163161
break;
164162

165163
case IOCTL_MW_WRITE_DATA: {
166-
MW_READWRITE rWriteData;
164+
struct mw_readwrite rWriteData;
167165
unsigned short __user *pusBuffer = NULL;
168166

169-
if( copy_from_user(&rWriteData, arg,
170-
sizeof(MW_READWRITE)) )
167+
if (copy_from_user(&rWriteData, arg, sizeof(rWriteData)))
171168
return -EFAULT;
172169
pusBuffer = (unsigned short __user *) (rWriteData.pBuf);
173170

@@ -181,11 +178,10 @@ static long mwave_ioctl(struct file *file, unsigned int iocmd,
181178
break;
182179

183180
case IOCTL_MW_WRITE_INST: {
184-
MW_READWRITE rWriteData;
181+
struct mw_readwrite rWriteData;
185182
unsigned short __user *pusBuffer = NULL;
186183

187-
if( copy_from_user(&rWriteData, arg,
188-
sizeof(MW_READWRITE)) )
184+
if (copy_from_user(&rWriteData, arg, sizeof(rWriteData)))
189185
return -EFAULT;
190186
pusBuffer = (unsigned short __user *)(rWriteData.pBuf);
191187

@@ -336,7 +332,7 @@ static struct miscdevice mwave_misc_dev = { MWAVE_MINOR, "mwave", &mwave_fops };
336332
*/
337333
static void mwave_exit(void)
338334
{
339-
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
335+
struct mwave_device_data *pDrvData = &mwave_s_mdd;
340336

341337
if ( pDrvData->sLine >= 0 ) {
342338
serial8250_unregister_port(pDrvData->sLine);
@@ -361,9 +357,9 @@ static int __init mwave_init(void)
361357
{
362358
int i;
363359
int retval = 0;
364-
pMWAVE_DEVICE_DATA pDrvData = &mwave_s_mdd;
360+
struct mwave_device_data *pDrvData = &mwave_s_mdd;
365361

366-
memset(&mwave_s_mdd, 0, sizeof(MWAVE_DEVICE_DATA));
362+
memset(&mwave_s_mdd, 0, sizeof(mwave_s_mdd));
367363

368364
pDrvData->bBDInitialized = false;
369365
pDrvData->bResourcesClaimed = false;

drivers/char/mwave/mwavedd.h

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

64-
typedef struct _MWAVE_IPC {
64+
struct mwave_ipc {
6565
unsigned short usIntCount; /* 0=none, 1=first, 2=greater than 1st */
6666
bool bIsEnabled;
6767
bool bIsHere;
6868
/* entry spin lock */
6969
wait_queue_head_t ipc_wait_queue;
70-
} MWAVE_IPC;
70+
};
7171

72-
typedef struct _MWAVE_DEVICE_DATA {
73-
THINKPAD_BD_DATA rBDData; /* board driver's data area */
72+
struct mwave_device_data {
73+
struct thinkpad_bd_data rBDData; /* board driver's data area */
7474
unsigned long ulIPCSource_ISR; /* IPC source bits for recently processed intr, set during ISR processing */
7575
unsigned long ulIPCSource_DPC; /* IPC source bits for recently processed intr, set during DPC processing */
7676
bool bBDInitialized;
7777
bool bResourcesClaimed;
7878
bool bDSPEnabled;
7979
bool bDSPReset;
80-
MWAVE_IPC IPCs[16];
80+
struct mwave_ipc IPCs[16];
8181
bool bMwaveDevRegistered;
8282
short sLine;
8383
int nr_registered_attrs;
8484
int device_registered;
8585

86-
} MWAVE_DEVICE_DATA, *pMWAVE_DEVICE_DATA;
86+
};
8787

88-
extern MWAVE_DEVICE_DATA mwave_s_mdd;
88+
extern struct mwave_device_data mwave_s_mdd;
8989

9090
#endif

drivers/char/mwave/mwavepub.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#include <linux/miscdevice.h>
5454

5555

56-
typedef struct _MW_ABILITIES {
56+
struct mw_abilities {
5757
unsigned long instr_per_sec;
5858
unsigned long data_size;
5959
unsigned long inst_size;
@@ -63,27 +63,27 @@ typedef struct _MW_ABILITIES {
6363
unsigned long component_list[7];
6464
char mwave_os_name[16];
6565
char bios_task_name[16];
66-
} MW_ABILITIES, *pMW_ABILITIES;
66+
};
6767

6868

69-
typedef struct _MW_READWRITE {
69+
struct mw_readwrite {
7070
unsigned short usDspAddress; /* The dsp address */
7171
unsigned long ulDataLength; /* The size in bytes of the data or user buffer */
7272
void __user *pBuf; /* Input:variable sized buffer */
73-
} MW_READWRITE, *pMW_READWRITE;
73+
};
7474

7575
#define IOCTL_MW_RESET _IO(MWAVE_MINOR,1)
7676
#define IOCTL_MW_RUN _IO(MWAVE_MINOR,2)
77-
#define IOCTL_MW_DSP_ABILITIES _IOR(MWAVE_MINOR,3,MW_ABILITIES)
78-
#define IOCTL_MW_READ_DATA _IOR(MWAVE_MINOR,4,MW_READWRITE)
79-
#define IOCTL_MW_READCLEAR_DATA _IOR(MWAVE_MINOR,5,MW_READWRITE)
80-
#define IOCTL_MW_READ_INST _IOR(MWAVE_MINOR,6,MW_READWRITE)
81-
#define IOCTL_MW_WRITE_DATA _IOW(MWAVE_MINOR,7,MW_READWRITE)
82-
#define IOCTL_MW_WRITE_INST _IOW(MWAVE_MINOR,8,MW_READWRITE)
77+
#define IOCTL_MW_DSP_ABILITIES _IOR(MWAVE_MINOR,3,struct mw_abilities)
78+
#define IOCTL_MW_READ_DATA _IOR(MWAVE_MINOR,4,struct mw_readwrite)
79+
#define IOCTL_MW_READCLEAR_DATA _IOR(MWAVE_MINOR,5,struct mw_readwrite)
80+
#define IOCTL_MW_READ_INST _IOR(MWAVE_MINOR,6,struct mw_readwrite)
81+
#define IOCTL_MW_WRITE_DATA _IOW(MWAVE_MINOR,7,struct mw_readwrite)
82+
#define IOCTL_MW_WRITE_INST _IOW(MWAVE_MINOR,8,struct mw_readwrite)
8383
#define IOCTL_MW_REGISTER_IPC _IOW(MWAVE_MINOR,9,int)
8484
#define IOCTL_MW_UNREGISTER_IPC _IOW(MWAVE_MINOR,10,int)
8585
#define IOCTL_MW_GET_IPC _IOW(MWAVE_MINOR,11,int)
86-
#define IOCTL_MW_TRACE _IOR(MWAVE_MINOR,12,MW_READWRITE)
86+
#define IOCTL_MW_TRACE _IOR(MWAVE_MINOR,12,struct mw_readwrite)
8787

8888

8989
#endif

drivers/char/mwave/smapi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int smapi_request(unsigned short inBX, unsigned short inCX,
116116
}
117117

118118

119-
int smapi_query_DSP_cfg(SMAPI_DSP_SETTINGS * pSettings)
119+
int smapi_query_DSP_cfg(struct smapi_dsp_settings *pSettings)
120120
{
121121
int bRC;
122122
unsigned short usAX, usBX, usCX, usDX, usDI, usSI;

drivers/char/mwave/smapi.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
#ifndef _LINUX_SMAPI_H
5050
#define _LINUX_SMAPI_H
5151

52-
typedef struct {
52+
struct smapi_dsp_settings {
5353
int bDSPPresent;
5454
int bDSPEnabled;
5555
int bModemEnabled;
@@ -65,10 +65,10 @@ typedef struct {
6565
unsigned short usSndblstIRQ;
6666
unsigned short usSndblstDMA;
6767
unsigned short usSndblstBaseIO;
68-
} SMAPI_DSP_SETTINGS;
68+
};
6969

7070
int smapi_init(void);
71-
int smapi_query_DSP_cfg(SMAPI_DSP_SETTINGS * pSettings);
71+
int smapi_query_DSP_cfg(struct smapi_dsp_settings *pSettings);
7272
int smapi_set_DSP_cfg(void);
7373
int smapi_set_DSP_power_state(bool bOn);
7474

0 commit comments

Comments
 (0)