aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/mars.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/mars.c')
-rw-r--r--drivers/media/video/gspca/mars.c327
1 files changed, 164 insertions, 163 deletions
diff --git a/drivers/media/video/gspca/mars.c b/drivers/media/video/gspca/mars.c
index 031f7195ce0d..a81536e78698 100644
--- a/drivers/media/video/gspca/mars.c
+++ b/drivers/media/video/gspca/mars.c
@@ -28,14 +28,23 @@ MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
28MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver"); 28MODULE_DESCRIPTION("GSPCA/Mars USB Camera Driver");
29MODULE_LICENSE("GPL"); 29MODULE_LICENSE("GPL");
30 30
31/* controls */
32enum e_ctrl {
33 BRIGHTNESS,
34 COLORS,
35 GAMMA,
36 SHARPNESS,
37 ILLUM_TOP,
38 ILLUM_BOT,
39 NCTRLS /* number of controls */
40};
41
31/* specific webcam descriptor */ 42/* specific webcam descriptor */
32struct sd { 43struct sd {
33 struct gspca_dev gspca_dev; /* !! must be the first item */ 44 struct gspca_dev gspca_dev; /* !! must be the first item */
34 45
35 u8 brightness; 46 struct gspca_ctrl ctrls[NCTRLS];
36 u8 colors; 47
37 u8 gamma;
38 u8 sharpness;
39 u8 quality; 48 u8 quality;
40#define QUALITY_MIN 40 49#define QUALITY_MIN 40
41#define QUALITY_MAX 70 50#define QUALITY_MAX 70
@@ -45,17 +54,15 @@ struct sd {
45}; 54};
46 55
47/* V4L2 controls supported by the driver */ 56/* V4L2 controls supported by the driver */
48static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val); 57static void setbrightness(struct gspca_dev *gspca_dev);
49static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val); 58static void setcolors(struct gspca_dev *gspca_dev);
50static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val); 59static void setgamma(struct gspca_dev *gspca_dev);
51static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val); 60static void setsharpness(struct gspca_dev *gspca_dev);
52static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val); 61static int sd_setilluminator1(struct gspca_dev *gspca_dev, __s32 val);
53static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val); 62static int sd_setilluminator2(struct gspca_dev *gspca_dev, __s32 val);
54static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val); 63
55static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val); 64static const struct ctrl sd_ctrls[NCTRLS] = {
56 65[BRIGHTNESS] = {
57static const struct ctrl sd_ctrls[] = {
58 {
59 { 66 {
60 .id = V4L2_CID_BRIGHTNESS, 67 .id = V4L2_CID_BRIGHTNESS,
61 .type = V4L2_CTRL_TYPE_INTEGER, 68 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -63,13 +70,11 @@ static const struct ctrl sd_ctrls[] = {
63 .minimum = 0, 70 .minimum = 0,
64 .maximum = 30, 71 .maximum = 30,
65 .step = 1, 72 .step = 1,
66#define BRIGHTNESS_DEF 15 73 .default_value = 15,
67 .default_value = BRIGHTNESS_DEF,
68 }, 74 },
69 .set = sd_setbrightness, 75 .set_control = setbrightness
70 .get = sd_getbrightness,
71 }, 76 },
72 { 77[COLORS] = {
73 { 78 {
74 .id = V4L2_CID_SATURATION, 79 .id = V4L2_CID_SATURATION,
75 .type = V4L2_CTRL_TYPE_INTEGER, 80 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -77,13 +82,11 @@ static const struct ctrl sd_ctrls[] = {
77 .minimum = 1, 82 .minimum = 1,
78 .maximum = 255, 83 .maximum = 255,
79 .step = 1, 84 .step = 1,
80#define COLOR_DEF 200 85 .default_value = 200,
81 .default_value = COLOR_DEF,
82 }, 86 },
83 .set = sd_setcolors, 87 .set_control = setcolors
84 .get = sd_getcolors,
85 }, 88 },
86 { 89[GAMMA] = {
87 { 90 {
88 .id = V4L2_CID_GAMMA, 91 .id = V4L2_CID_GAMMA,
89 .type = V4L2_CTRL_TYPE_INTEGER, 92 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -91,13 +94,11 @@ static const struct ctrl sd_ctrls[] = {
91 .minimum = 0, 94 .minimum = 0,
92 .maximum = 3, 95 .maximum = 3,
93 .step = 1, 96 .step = 1,
94#define GAMMA_DEF 1 97 .default_value = 1,
95 .default_value = GAMMA_DEF,
96 }, 98 },
97 .set = sd_setgamma, 99 .set_control = setgamma
98 .get = sd_getgamma,
99 }, 100 },
100 { 101[SHARPNESS] = {
101 { 102 {
102 .id = V4L2_CID_SHARPNESS, 103 .id = V4L2_CID_SHARPNESS,
103 .type = V4L2_CTRL_TYPE_INTEGER, 104 .type = V4L2_CTRL_TYPE_INTEGER,
@@ -105,11 +106,35 @@ static const struct ctrl sd_ctrls[] = {
105 .minimum = 0, 106 .minimum = 0,
106 .maximum = 2, 107 .maximum = 2,
107 .step = 1, 108 .step = 1,
108#define SHARPNESS_DEF 1 109 .default_value = 1,
109 .default_value = SHARPNESS_DEF, 110 },
111 .set_control = setsharpness
112 },
113[ILLUM_TOP] = {
114 {
115 .id = V4L2_CID_ILLUMINATORS_1,
116 .type = V4L2_CTRL_TYPE_BOOLEAN,
117 .name = "Top illuminator",
118 .minimum = 0,
119 .maximum = 1,
120 .step = 1,
121 .default_value = 0,
122 .flags = V4L2_CTRL_FLAG_UPDATE,
123 },
124 .set = sd_setilluminator1
125 },
126[ILLUM_BOT] = {
127 {
128 .id = V4L2_CID_ILLUMINATORS_2,
129 .type = V4L2_CTRL_TYPE_BOOLEAN,
130 .name = "Bottom illuminator",
131 .minimum = 0,
132 .maximum = 1,
133 .step = 1,
134 .default_value = 0,
135 .flags = V4L2_CTRL_FLAG_UPDATE,
110 }, 136 },
111 .set = sd_setsharpness, 137 .set = sd_setilluminator2
112 .get = sd_getsharpness,
113 }, 138 },
114}; 139};
115 140
@@ -138,21 +163,25 @@ static const __u8 mi_data[0x20] = {
138}; 163};
139 164
140/* write <len> bytes from gspca_dev->usb_buf */ 165/* write <len> bytes from gspca_dev->usb_buf */
141static int reg_w(struct gspca_dev *gspca_dev, 166static void reg_w(struct gspca_dev *gspca_dev,
142 int len) 167 int len)
143{ 168{
144 int alen, ret; 169 int alen, ret;
145 170
171 if (gspca_dev->usb_err < 0)
172 return;
173
146 ret = usb_bulk_msg(gspca_dev->dev, 174 ret = usb_bulk_msg(gspca_dev->dev,
147 usb_sndbulkpipe(gspca_dev->dev, 4), 175 usb_sndbulkpipe(gspca_dev->dev, 4),
148 gspca_dev->usb_buf, 176 gspca_dev->usb_buf,
149 len, 177 len,
150 &alen, 178 &alen,
151 500); /* timeout in milliseconds */ 179 500); /* timeout in milliseconds */
152 if (ret < 0) 180 if (ret < 0) {
153 PDEBUG(D_ERR, "reg write [%02x] error %d", 181 err("reg write [%02x] error %d",
154 gspca_dev->usb_buf[0], ret); 182 gspca_dev->usb_buf[0], ret);
155 return ret; 183 gspca_dev->usb_err = ret;
184 }
156} 185}
157 186
158static void mi_w(struct gspca_dev *gspca_dev, 187static void mi_w(struct gspca_dev *gspca_dev,
@@ -167,6 +196,59 @@ static void mi_w(struct gspca_dev *gspca_dev,
167 reg_w(gspca_dev, 4); 196 reg_w(gspca_dev, 4);
168} 197}
169 198
199static void setbrightness(struct gspca_dev *gspca_dev)
200{
201 struct sd *sd = (struct sd *) gspca_dev;
202
203 gspca_dev->usb_buf[0] = 0x61;
204 gspca_dev->usb_buf[1] = sd->ctrls[BRIGHTNESS].val;
205 reg_w(gspca_dev, 2);
206}
207
208static void setcolors(struct gspca_dev *gspca_dev)
209{
210 struct sd *sd = (struct sd *) gspca_dev;
211 s16 val;
212
213 val = sd->ctrls[COLORS].val;
214 gspca_dev->usb_buf[0] = 0x5f;
215 gspca_dev->usb_buf[1] = val << 3;
216 gspca_dev->usb_buf[2] = ((val >> 2) & 0xf8) | 0x04;
217 reg_w(gspca_dev, 3);
218}
219
220static void setgamma(struct gspca_dev *gspca_dev)
221{
222 struct sd *sd = (struct sd *) gspca_dev;
223
224 gspca_dev->usb_buf[0] = 0x06;
225 gspca_dev->usb_buf[1] = sd->ctrls[GAMMA].val * 0x40;
226 reg_w(gspca_dev, 2);
227}
228
229static void setsharpness(struct gspca_dev *gspca_dev)
230{
231 struct sd *sd = (struct sd *) gspca_dev;
232
233 gspca_dev->usb_buf[0] = 0x67;
234 gspca_dev->usb_buf[1] = sd->ctrls[SHARPNESS].val * 4 + 3;
235 reg_w(gspca_dev, 2);
236}
237
238static void setilluminators(struct gspca_dev *gspca_dev)
239{
240 struct sd *sd = (struct sd *) gspca_dev;
241
242 gspca_dev->usb_buf[0] = 0x22;
243 if (sd->ctrls[ILLUM_TOP].val)
244 gspca_dev->usb_buf[1] = 0x76;
245 else if (sd->ctrls[ILLUM_BOT].val)
246 gspca_dev->usb_buf[1] = 0x7a;
247 else
248 gspca_dev->usb_buf[1] = 0x7e;
249 reg_w(gspca_dev, 2);
250}
251
170/* this function is called at probe time */ 252/* this function is called at probe time */
171static int sd_config(struct gspca_dev *gspca_dev, 253static int sd_config(struct gspca_dev *gspca_dev,
172 const struct usb_device_id *id) 254 const struct usb_device_id *id)
@@ -177,10 +259,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
177 cam = &gspca_dev->cam; 259 cam = &gspca_dev->cam;
178 cam->cam_mode = vga_mode; 260 cam->cam_mode = vga_mode;
179 cam->nmodes = ARRAY_SIZE(vga_mode); 261 cam->nmodes = ARRAY_SIZE(vga_mode);
180 sd->brightness = BRIGHTNESS_DEF; 262 cam->ctrls = sd->ctrls;
181 sd->colors = COLOR_DEF;
182 sd->gamma = GAMMA_DEF;
183 sd->sharpness = SHARPNESS_DEF;
184 sd->quality = QUALITY_DEF; 263 sd->quality = QUALITY_DEF;
185 gspca_dev->nbalt = 9; /* use the altsetting 08 */ 264 gspca_dev->nbalt = 9; /* use the altsetting 08 */
186 return 0; 265 return 0;
@@ -189,13 +268,13 @@ static int sd_config(struct gspca_dev *gspca_dev,
189/* this function is called at probe and resume time */ 268/* this function is called at probe and resume time */
190static int sd_init(struct gspca_dev *gspca_dev) 269static int sd_init(struct gspca_dev *gspca_dev)
191{ 270{
271 gspca_dev->ctrl_inac = (1 << ILLUM_TOP) | (1 << ILLUM_BOT);
192 return 0; 272 return 0;
193} 273}
194 274
195static int sd_start(struct gspca_dev *gspca_dev) 275static int sd_start(struct gspca_dev *gspca_dev)
196{ 276{
197 struct sd *sd = (struct sd *) gspca_dev; 277 struct sd *sd = (struct sd *) gspca_dev;
198 int err_code;
199 u8 *data; 278 u8 *data;
200 int i; 279 int i;
201 280
@@ -208,9 +287,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
208 287
209 data[0] = 0x01; /* address */ 288 data[0] = 0x01; /* address */
210 data[1] = 0x01; 289 data[1] = 0x01;
211 err_code = reg_w(gspca_dev, 2); 290 reg_w(gspca_dev, 2);
212 if (err_code < 0)
213 return err_code;
214 291
215 /* 292 /*
216 Initialize the MR97113 chip register 293 Initialize the MR97113 chip register
@@ -223,7 +300,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
223 data[5] = 0x30; /* reg 4, MI, PAS5101 : 300 data[5] = 0x30; /* reg 4, MI, PAS5101 :
224 * 0x30 for 24mhz , 0x28 for 12mhz */ 301 * 0x30 for 24mhz , 0x28 for 12mhz */
225 data[6] = 0x02; /* reg 5, H start - was 0x04 */ 302 data[6] = 0x02; /* reg 5, H start - was 0x04 */
226 data[7] = sd->gamma * 0x40; /* reg 0x06: gamma */ 303 data[7] = sd->ctrls[GAMMA].val * 0x40; /* reg 0x06: gamma */
227 data[8] = 0x01; /* reg 7, V start - was 0x03 */ 304 data[8] = 0x01; /* reg 7, V start - was 0x03 */
228/* if (h_size == 320 ) */ 305/* if (h_size == 320 ) */
229/* data[9]= 0x56; * reg 8, 24MHz, 2:1 scale down */ 306/* data[9]= 0x56; * reg 8, 24MHz, 2:1 scale down */
@@ -232,16 +309,12 @@ static int sd_start(struct gspca_dev *gspca_dev)
232/*jfm: from win trace*/ 309/*jfm: from win trace*/
233 data[10] = 0x18; 310 data[10] = 0x18;
234 311
235 err_code = reg_w(gspca_dev, 11); 312 reg_w(gspca_dev, 11);
236 if (err_code < 0)
237 return err_code;
238 313
239 data[0] = 0x23; /* address */ 314 data[0] = 0x23; /* address */
240 data[1] = 0x09; /* reg 35, append frame header */ 315 data[1] = 0x09; /* reg 35, append frame header */
241 316
242 err_code = reg_w(gspca_dev, 2); 317 reg_w(gspca_dev, 2);
243 if (err_code < 0)
244 return err_code;
245 318
246 data[0] = 0x3c; /* address */ 319 data[0] = 0x3c; /* address */
247/* if (gspca_dev->width == 1280) */ 320/* if (gspca_dev->width == 1280) */
@@ -250,9 +323,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
250/* else */ 323/* else */
251 data[1] = 50; /* 50 reg 60, pc-cam frame size 324 data[1] = 50; /* 50 reg 60, pc-cam frame size
252 * (unit: 4KB) 200KB */ 325 * (unit: 4KB) 200KB */
253 err_code = reg_w(gspca_dev, 2); 326 reg_w(gspca_dev, 2);
254 if (err_code < 0)
255 return err_code;
256 327
257 /* auto dark-gain */ 328 /* auto dark-gain */
258 data[0] = 0x5e; /* address */ 329 data[0] = 0x5e; /* address */
@@ -261,37 +332,29 @@ static int sd_start(struct gspca_dev *gspca_dev)
261 /* reg 0x5f/0x60 (LE) = saturation */ 332 /* reg 0x5f/0x60 (LE) = saturation */
262 /* h (60): xxxx x100 333 /* h (60): xxxx x100
263 * l (5f): xxxx x000 */ 334 * l (5f): xxxx x000 */
264 data[2] = sd->colors << 3; 335 data[2] = sd->ctrls[COLORS].val << 3;
265 data[3] = ((sd->colors >> 2) & 0xf8) | 0x04; 336 data[3] = ((sd->ctrls[COLORS].val >> 2) & 0xf8) | 0x04;
266 data[4] = sd->brightness; /* reg 0x61 = brightness */ 337 data[4] = sd->ctrls[BRIGHTNESS].val; /* reg 0x61 = brightness */
267 data[5] = 0x00; 338 data[5] = 0x00;
268 339
269 err_code = reg_w(gspca_dev, 6); 340 reg_w(gspca_dev, 6);
270 if (err_code < 0)
271 return err_code;
272 341
273 data[0] = 0x67; 342 data[0] = 0x67;
274/*jfm: from win trace*/ 343/*jfm: from win trace*/
275 data[1] = sd->sharpness * 4 + 3; 344 data[1] = sd->ctrls[SHARPNESS].val * 4 + 3;
276 data[2] = 0x14; 345 data[2] = 0x14;
277 err_code = reg_w(gspca_dev, 3); 346 reg_w(gspca_dev, 3);
278 if (err_code < 0)
279 return err_code;
280 347
281 data[0] = 0x69; 348 data[0] = 0x69;
282 data[1] = 0x2f; 349 data[1] = 0x2f;
283 data[2] = 0x28; 350 data[2] = 0x28;
284 data[3] = 0x42; 351 data[3] = 0x42;
285 err_code = reg_w(gspca_dev, 4); 352 reg_w(gspca_dev, 4);
286 if (err_code < 0)
287 return err_code;
288 353
289 data[0] = 0x63; 354 data[0] = 0x63;
290 data[1] = 0x07; 355 data[1] = 0x07;
291 err_code = reg_w(gspca_dev, 2); 356 reg_w(gspca_dev, 2);
292/*jfm: win trace - many writes here to reg 0x64*/ 357/*jfm: win trace - many writes here to reg 0x64*/
293 if (err_code < 0)
294 return err_code;
295 358
296 /* initialize the MI sensor */ 359 /* initialize the MI sensor */
297 for (i = 0; i < sizeof mi_data; i++) 360 for (i = 0; i < sizeof mi_data; i++)
@@ -300,18 +363,26 @@ static int sd_start(struct gspca_dev *gspca_dev)
300 data[0] = 0x00; 363 data[0] = 0x00;
301 data[1] = 0x4d; /* ISOC transfering enable... */ 364 data[1] = 0x4d; /* ISOC transfering enable... */
302 reg_w(gspca_dev, 2); 365 reg_w(gspca_dev, 2);
303 return 0; 366
367 gspca_dev->ctrl_inac = 0; /* activate the illuminator controls */
368 return gspca_dev->usb_err;
304} 369}
305 370
306static void sd_stopN(struct gspca_dev *gspca_dev) 371static void sd_stopN(struct gspca_dev *gspca_dev)
307{ 372{
308 int result; 373 struct sd *sd = (struct sd *) gspca_dev;
374
375 gspca_dev->ctrl_inac = (1 << ILLUM_TOP) | (1 << ILLUM_BOT);
376 if (sd->ctrls[ILLUM_TOP].val || sd->ctrls[ILLUM_BOT].val) {
377 sd->ctrls[ILLUM_TOP].val = 0;
378 sd->ctrls[ILLUM_BOT].val = 0;
379 setilluminators(gspca_dev);
380 msleep(20);
381 }
309 382
310 gspca_dev->usb_buf[0] = 1; 383 gspca_dev->usb_buf[0] = 1;
311 gspca_dev->usb_buf[1] = 0; 384 gspca_dev->usb_buf[1] = 0;
312 result = reg_w(gspca_dev, 2); 385 reg_w(gspca_dev, 2);
313 if (result < 0)
314 PDEBUG(D_ERR, "Camera Stop failed");
315} 386}
316 387
317static void sd_pkt_scan(struct gspca_dev *gspca_dev, 388static void sd_pkt_scan(struct gspca_dev *gspca_dev,
@@ -352,91 +423,28 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev,
352 gspca_frame_add(gspca_dev, INTER_PACKET, data, len); 423 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
353} 424}
354 425
355static int sd_setbrightness(struct gspca_dev *gspca_dev, __s32 val) 426static int sd_setilluminator1(struct gspca_dev *gspca_dev, __s32 val)
356{
357 struct sd *sd = (struct sd *) gspca_dev;
358
359 sd->brightness = val;
360 if (gspca_dev->streaming) {
361 gspca_dev->usb_buf[0] = 0x61;
362 gspca_dev->usb_buf[1] = val;
363 reg_w(gspca_dev, 2);
364 }
365 return 0;
366}
367
368static int sd_getbrightness(struct gspca_dev *gspca_dev, __s32 *val)
369{ 427{
370 struct sd *sd = (struct sd *) gspca_dev; 428 struct sd *sd = (struct sd *) gspca_dev;
371 429
372 *val = sd->brightness; 430 /* only one illuminator may be on */
373 return 0; 431 sd->ctrls[ILLUM_TOP].val = val;
432 if (val)
433 sd->ctrls[ILLUM_BOT].val = 0;
434 setilluminators(gspca_dev);
435 return gspca_dev->usb_err;
374} 436}
375 437
376static int sd_setcolors(struct gspca_dev *gspca_dev, __s32 val) 438static int sd_setilluminator2(struct gspca_dev *gspca_dev, __s32 val)
377{ 439{
378 struct sd *sd = (struct sd *) gspca_dev; 440 struct sd *sd = (struct sd *) gspca_dev;
379 441
380 sd->colors = val; 442 /* only one illuminator may be on */
381 if (gspca_dev->streaming) { 443 sd->ctrls[ILLUM_BOT].val = val;
382 444 if (val)
383 /* see sd_start */ 445 sd->ctrls[ILLUM_TOP].val = 0;
384 gspca_dev->usb_buf[0] = 0x5f; 446 setilluminators(gspca_dev);
385 gspca_dev->usb_buf[1] = sd->colors << 3; 447 return gspca_dev->usb_err;
386 gspca_dev->usb_buf[2] = ((sd->colors >> 2) & 0xf8) | 0x04;
387 reg_w(gspca_dev, 3);
388 }
389 return 0;
390}
391
392static int sd_getcolors(struct gspca_dev *gspca_dev, __s32 *val)
393{
394 struct sd *sd = (struct sd *) gspca_dev;
395
396 *val = sd->colors;
397 return 0;
398}
399
400static int sd_setgamma(struct gspca_dev *gspca_dev, __s32 val)
401{
402 struct sd *sd = (struct sd *) gspca_dev;
403
404 sd->gamma = val;
405 if (gspca_dev->streaming) {
406 gspca_dev->usb_buf[0] = 0x06;
407 gspca_dev->usb_buf[1] = val * 0x40;
408 reg_w(gspca_dev, 2);
409 }
410 return 0;
411}
412
413static int sd_getgamma(struct gspca_dev *gspca_dev, __s32 *val)
414{
415 struct sd *sd = (struct sd *) gspca_dev;
416
417 *val = sd->gamma;
418 return 0;
419}
420
421static int sd_setsharpness(struct gspca_dev *gspca_dev, __s32 val)
422{
423 struct sd *sd = (struct sd *) gspca_dev;
424
425 sd->sharpness = val;
426 if (gspca_dev->streaming) {
427 gspca_dev->usb_buf[0] = 0x67;
428 gspca_dev->usb_buf[1] = val * 4 + 3;
429 reg_w(gspca_dev, 2);
430 }
431 return 0;
432}
433
434static int sd_getsharpness(struct gspca_dev *gspca_dev, __s32 *val)
435{
436 struct sd *sd = (struct sd *) gspca_dev;
437
438 *val = sd->sharpness;
439 return 0;
440} 448}
441 449
442static int sd_set_jcomp(struct gspca_dev *gspca_dev, 450static int sd_set_jcomp(struct gspca_dev *gspca_dev,
@@ -471,7 +479,7 @@ static int sd_get_jcomp(struct gspca_dev *gspca_dev,
471static const struct sd_desc sd_desc = { 479static const struct sd_desc sd_desc = {
472 .name = MODULE_NAME, 480 .name = MODULE_NAME,
473 .ctrls = sd_ctrls, 481 .ctrls = sd_ctrls,
474 .nctrls = ARRAY_SIZE(sd_ctrls), 482 .nctrls = NCTRLS,
475 .config = sd_config, 483 .config = sd_config,
476 .init = sd_init, 484 .init = sd_init,
477 .start = sd_start, 485 .start = sd_start,
@@ -510,18 +518,11 @@ static struct usb_driver sd_driver = {
510/* -- module insert / remove -- */ 518/* -- module insert / remove -- */
511static int __init sd_mod_init(void) 519static int __init sd_mod_init(void)
512{ 520{
513 int ret; 521 return usb_register(&sd_driver);
514
515 ret = usb_register(&sd_driver);
516 if (ret < 0)
517 return ret;
518 PDEBUG(D_PROBE, "registered");
519 return 0;
520} 522}
521static void __exit sd_mod_exit(void) 523static void __exit sd_mod_exit(void)
522{ 524{
523 usb_deregister(&sd_driver); 525 usb_deregister(&sd_driver);
524 PDEBUG(D_PROBE, "deregistered");
525} 526}
526 527
527module_init(sd_mod_init); 528module_init(sd_mod_init);