Skip to content

Commit c93022a

Browse files
committed
media: ca.h: split typedefs from structs
Using typedefs inside the Kernel is against CodingStyle, and there's no good usage here. Just like we did at frontend.h, at commit 0df289a ("[media] dvb: Get rid of typedev usage for enums"), let's keep those typedefs only to provide userspace backward compatibility. No functional changes. Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent fce4b37 commit c93022a

3 files changed

Lines changed: 39 additions & 26 deletions

File tree

‎drivers/media/pci/ttpci/av7110.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ struct av7110 {
177177

178178
/* CA */
179179

180-
ca_slot_info_t ci_slot[2];
180+
struct ca_slot_info ci_slot[2];
181181

182182
enum av7110_video_mode vidmode;
183183
struct dmxdev dmxdev;

‎drivers/media/pci/ttpci/av7110_ca.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void ci_ll_release(struct dvb_ringbuffer *cirbuf, struct dvb_ringbuffer *
119119
}
120120

121121
static int ci_ll_reset(struct dvb_ringbuffer *cibuf, struct file *file,
122-
int slots, ca_slot_info_t *slot)
122+
int slots, struct ca_slot_info *slot)
123123
{
124124
int i;
125125
int len = 0;
@@ -264,7 +264,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
264264
break;
265265
case CA_GET_CAP:
266266
{
267-
ca_caps_t cap;
267+
struct ca_caps cap;
268268

269269
cap.slot_num = 2;
270270
cap.slot_type = (FW_CI_LL_SUPPORT(av7110->arm_app) ?
@@ -277,7 +277,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
277277

278278
case CA_GET_SLOT_INFO:
279279
{
280-
ca_slot_info_t *info=(ca_slot_info_t *)parg;
280+
struct ca_slot_info *info=(struct ca_slot_info *)parg;
281281

282282
if (info->num < 0 || info->num > 1) {
283283
mutex_unlock(&av7110->ioctl_mutex);
@@ -286,7 +286,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
286286
av7110->ci_slot[info->num].num = info->num;
287287
av7110->ci_slot[info->num].type = FW_CI_LL_SUPPORT(av7110->arm_app) ?
288288
CA_CI_LINK : CA_CI;
289-
memcpy(info, &av7110->ci_slot[info->num], sizeof(ca_slot_info_t));
289+
memcpy(info, &av7110->ci_slot[info->num], sizeof(struct ca_slot_info));
290290
break;
291291
}
292292

@@ -298,7 +298,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
298298

299299
case CA_GET_DESCR_INFO:
300300
{
301-
ca_descr_info_t info;
301+
struct ca_descr_info info;
302302

303303
info.num = 16;
304304
info.type = CA_ECD;
@@ -308,7 +308,7 @@ static int dvb_ca_ioctl(struct file *file, unsigned int cmd, void *parg)
308308

309309
case CA_SET_DESCR:
310310
{
311-
ca_descr_t *descr = (ca_descr_t*) parg;
311+
struct ca_descr *descr = (struct ca_descr*) parg;
312312

313313
if (descr->index >= 16 || descr->parity > 1) {
314314
mutex_unlock(&av7110->ioctl_mutex);

‎include/uapi/linux/dvb/ca.h‎

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
/* slot interface types and info */
2828

29-
typedef struct ca_slot_info {
29+
struct ca_slot_info {
3030
int num; /* slot number */
3131

3232
int type; /* CA interface this slot supports */
@@ -39,52 +39,65 @@ typedef struct ca_slot_info {
3939
unsigned int flags;
4040
#define CA_CI_MODULE_PRESENT 1 /* module (or card) inserted */
4141
#define CA_CI_MODULE_READY 2
42-
} ca_slot_info_t;
42+
};
4343

4444

4545
/* descrambler types and info */
4646

47-
typedef struct ca_descr_info {
47+
struct ca_descr_info {
4848
unsigned int num; /* number of available descramblers (keys) */
4949
unsigned int type; /* type of supported scrambling system */
5050
#define CA_ECD 1
5151
#define CA_NDS 2
5252
#define CA_DSS 4
53-
} ca_descr_info_t;
53+
};
5454

55-
typedef struct ca_caps {
55+
struct ca_caps {
5656
unsigned int slot_num; /* total number of CA card and module slots */
5757
unsigned int slot_type; /* OR of all supported types */
5858
unsigned int descr_num; /* total number of descrambler slots (keys) */
5959
unsigned int descr_type; /* OR of all supported types */
60-
} ca_caps_t;
60+
};
6161

6262
/* a message to/from a CI-CAM */
63-
typedef struct ca_msg {
63+
struct ca_msg {
6464
unsigned int index;
6565
unsigned int type;
6666
unsigned int length;
6767
unsigned char msg[256];
68-
} ca_msg_t;
68+
};
6969

70-
typedef struct ca_descr {
70+
struct ca_descr {
7171
unsigned int index;
7272
unsigned int parity; /* 0 == even, 1 == odd */
7373
unsigned char cw[8];
74-
} ca_descr_t;
74+
};
7575

76-
typedef struct ca_pid {
76+
struct ca_pid {
7777
unsigned int pid;
7878
int index; /* -1 == disable*/
79-
} ca_pid_t;
79+
};
8080

8181
#define CA_RESET _IO('o', 128)
82-
#define CA_GET_CAP _IOR('o', 129, ca_caps_t)
83-
#define CA_GET_SLOT_INFO _IOR('o', 130, ca_slot_info_t)
84-
#define CA_GET_DESCR_INFO _IOR('o', 131, ca_descr_info_t)
85-
#define CA_GET_MSG _IOR('o', 132, ca_msg_t)
86-
#define CA_SEND_MSG _IOW('o', 133, ca_msg_t)
87-
#define CA_SET_DESCR _IOW('o', 134, ca_descr_t)
88-
#define CA_SET_PID _IOW('o', 135, ca_pid_t)
82+
#define CA_GET_CAP _IOR('o', 129, struct ca_caps)
83+
#define CA_GET_SLOT_INFO _IOR('o', 130, struct ca_slot_info)
84+
#define CA_GET_DESCR_INFO _IOR('o', 131, struct ca_descr_info)
85+
#define CA_GET_MSG _IOR('o', 132, struct ca_msg)
86+
#define CA_SEND_MSG _IOW('o', 133, struct ca_msg)
87+
#define CA_SET_DESCR _IOW('o', 134, struct ca_descr)
88+
#define CA_SET_PID _IOW('o', 135, struct ca_pid)
89+
90+
#if !defined (__KERNEL__)
91+
92+
/* This is needed for legacy userspace support */
93+
typedef struct ca_slot_info ca_slot_info_t;
94+
typedef struct ca_descr_info ca_descr_info_t;
95+
typedef struct ca_caps ca_caps_t;
96+
typedef struct ca_msg ca_msg_t;
97+
typedef struct ca_descr ca_descr_t;
98+
typedef struct ca_pid ca_pid_t;
99+
100+
#endif
101+
89102

90103
#endif

0 commit comments

Comments
 (0)