diff options
author | Duncan Sands <baldrick@free.fr> | 2006-01-17 05:15:13 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-31 20:23:39 -0500 |
commit | 0ec3c7e856319b600311750d784262caa8ed94b9 (patch) | |
tree | 86d0b3aa9105a8b92bbfc514c5964c9abe7da0e7 /drivers/usb/atm/cxacru.c | |
parent | 7ce08c93e388922e25a96a7d9895784182e4c72c (diff) |
[PATCH] USBATM: trivial modifications
Formatting, changes to variable names, comments, log level changes,
printk rate limiting.
Signed-off-by: Duncan Sands <baldrick@free.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/atm/cxacru.c')
-rw-r--r-- | drivers/usb/atm/cxacru.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index af0a41e7870e..139be1207d22 100644 --- a/drivers/usb/atm/cxacru.c +++ b/drivers/usb/atm/cxacru.c | |||
@@ -352,7 +352,6 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, | |||
352 | struct atm_dev *atm_dev) | 352 | struct atm_dev *atm_dev) |
353 | { | 353 | { |
354 | struct cxacru_data *instance = usbatm_instance->driver_data; | 354 | struct cxacru_data *instance = usbatm_instance->driver_data; |
355 | struct device *dev = &usbatm_instance->usb_intf->dev; | ||
356 | /* | 355 | /* |
357 | struct atm_dev *atm_dev = usbatm_instance->atm_dev; | 356 | struct atm_dev *atm_dev = usbatm_instance->atm_dev; |
358 | */ | 357 | */ |
@@ -364,14 +363,14 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, | |||
364 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_MAC_ADDRESS, NULL, 0, | 363 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_MAC_ADDRESS, NULL, 0, |
365 | atm_dev->esi, sizeof(atm_dev->esi)); | 364 | atm_dev->esi, sizeof(atm_dev->esi)); |
366 | if (ret < 0) { | 365 | if (ret < 0) { |
367 | dev_err(dev, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret); | 366 | atm_err(usbatm_instance, "cxacru_atm_start: CARD_GET_MAC_ADDRESS returned %d\n", ret); |
368 | return ret; | 367 | return ret; |
369 | } | 368 | } |
370 | 369 | ||
371 | /* start ADSL */ | 370 | /* start ADSL */ |
372 | ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); | 371 | ret = cxacru_cm(instance, CM_REQUEST_CHIP_ADSL_LINE_START, NULL, 0, NULL, 0); |
373 | if (ret < 0) { | 372 | if (ret < 0) { |
374 | dev_err(dev, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); | 373 | atm_err(usbatm_instance, "cxacru_atm_start: CHIP_ADSL_LINE_START returned %d\n", ret); |
375 | return ret; | 374 | return ret; |
376 | } | 375 | } |
377 | 376 | ||
@@ -383,13 +382,13 @@ static int cxacru_atm_start(struct usbatm_data *usbatm_instance, | |||
383 | static void cxacru_poll_status(struct cxacru_data *instance) | 382 | static void cxacru_poll_status(struct cxacru_data *instance) |
384 | { | 383 | { |
385 | u32 buf[CXINF_MAX] = {}; | 384 | u32 buf[CXINF_MAX] = {}; |
386 | struct device *dev = &instance->usbatm->usb_intf->dev; | 385 | struct usbatm_data *usbatm = instance->usbatm; |
387 | struct atm_dev *atm_dev = instance->usbatm->atm_dev; | 386 | struct atm_dev *atm_dev = usbatm->atm_dev; |
388 | int ret; | 387 | int ret; |
389 | 388 | ||
390 | ret = cxacru_cm_get_array(instance, CM_REQUEST_CARD_INFO_GET, buf, CXINF_MAX); | 389 | ret = cxacru_cm_get_array(instance, CM_REQUEST_CARD_INFO_GET, buf, CXINF_MAX); |
391 | if (ret < 0) { | 390 | if (ret < 0) { |
392 | dev_warn(dev, "poll status: error %d\n", ret); | 391 | atm_warn(usbatm, "poll status: error %d\n", ret); |
393 | goto reschedule; | 392 | goto reschedule; |
394 | } | 393 | } |
395 | 394 | ||
@@ -400,50 +399,50 @@ static void cxacru_poll_status(struct cxacru_data *instance) | |||
400 | switch (instance->line_status) { | 399 | switch (instance->line_status) { |
401 | case 0: | 400 | case 0: |
402 | atm_dev->signal = ATM_PHY_SIG_LOST; | 401 | atm_dev->signal = ATM_PHY_SIG_LOST; |
403 | dev_info(dev, "ADSL line: down\n"); | 402 | atm_info(usbatm, "ADSL line: down\n"); |
404 | break; | 403 | break; |
405 | 404 | ||
406 | case 1: | 405 | case 1: |
407 | atm_dev->signal = ATM_PHY_SIG_LOST; | 406 | atm_dev->signal = ATM_PHY_SIG_LOST; |
408 | dev_info(dev, "ADSL line: attemtping to activate\n"); | 407 | atm_info(usbatm, "ADSL line: attempting to activate\n"); |
409 | break; | 408 | break; |
410 | 409 | ||
411 | case 2: | 410 | case 2: |
412 | atm_dev->signal = ATM_PHY_SIG_LOST; | 411 | atm_dev->signal = ATM_PHY_SIG_LOST; |
413 | dev_info(dev, "ADSL line: training\n"); | 412 | atm_info(usbatm, "ADSL line: training\n"); |
414 | break; | 413 | break; |
415 | 414 | ||
416 | case 3: | 415 | case 3: |
417 | atm_dev->signal = ATM_PHY_SIG_LOST; | 416 | atm_dev->signal = ATM_PHY_SIG_LOST; |
418 | dev_info(dev, "ADSL line: channel analysis\n"); | 417 | atm_info(usbatm, "ADSL line: channel analysis\n"); |
419 | break; | 418 | break; |
420 | 419 | ||
421 | case 4: | 420 | case 4: |
422 | atm_dev->signal = ATM_PHY_SIG_LOST; | 421 | atm_dev->signal = ATM_PHY_SIG_LOST; |
423 | dev_info(dev, "ADSL line: exchange\n"); | 422 | atm_info(usbatm, "ADSL line: exchange\n"); |
424 | break; | 423 | break; |
425 | 424 | ||
426 | case 5: | 425 | case 5: |
427 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; | 426 | atm_dev->link_rate = buf[CXINF_DOWNSTREAM_RATE] * 1000 / 424; |
428 | atm_dev->signal = ATM_PHY_SIG_FOUND; | 427 | atm_dev->signal = ATM_PHY_SIG_FOUND; |
429 | 428 | ||
430 | dev_info(dev, "ADSL line: up (%d kb/s down | %d kb/s up)\n", | 429 | atm_info(usbatm, "ADSL line: up (%d kb/s down | %d kb/s up)\n", |
431 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); | 430 | buf[CXINF_DOWNSTREAM_RATE], buf[CXINF_UPSTREAM_RATE]); |
432 | break; | 431 | break; |
433 | 432 | ||
434 | case 6: | 433 | case 6: |
435 | atm_dev->signal = ATM_PHY_SIG_LOST; | 434 | atm_dev->signal = ATM_PHY_SIG_LOST; |
436 | dev_info(dev, "ADSL line: waiting\n"); | 435 | atm_info(usbatm, "ADSL line: waiting\n"); |
437 | break; | 436 | break; |
438 | 437 | ||
439 | case 7: | 438 | case 7: |
440 | atm_dev->signal = ATM_PHY_SIG_LOST; | 439 | atm_dev->signal = ATM_PHY_SIG_LOST; |
441 | dev_info(dev, "ADSL line: initializing\n"); | 440 | atm_info(usbatm, "ADSL line: initializing\n"); |
442 | break; | 441 | break; |
443 | 442 | ||
444 | default: | 443 | default: |
445 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; | 444 | atm_dev->signal = ATM_PHY_SIG_UNKNOWN; |
446 | dev_info(dev, "Unknown line state %02x\n", instance->line_status); | 445 | atm_info(usbatm, "Unknown line state %02x\n", instance->line_status); |
447 | break; | 446 | break; |
448 | } | 447 | } |
449 | reschedule: | 448 | reschedule: |
@@ -504,8 +503,8 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
504 | { | 503 | { |
505 | int ret; | 504 | int ret; |
506 | int off; | 505 | int off; |
507 | struct usb_device *usb_dev = instance->usbatm->usb_dev; | 506 | struct usbatm_data *usbatm = instance->usbatm; |
508 | struct device *dev = &instance->usbatm->usb_intf->dev; | 507 | struct usb_device *usb_dev = usbatm->usb_dev; |
509 | u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; | 508 | u16 signature[] = { usb_dev->descriptor.idVendor, usb_dev->descriptor.idProduct }; |
510 | u32 val; | 509 | u32 val; |
511 | 510 | ||
@@ -515,7 +514,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
515 | val = cpu_to_le32(instance->modem_type->pll_f_clk); | 514 | val = cpu_to_le32(instance->modem_type->pll_f_clk); |
516 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); | 515 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLFCLK_ADDR, (u8 *) &val, 4); |
517 | if (ret) { | 516 | if (ret) { |
518 | dev_err(dev, "FirmwarePllFClkValue failed: %d\n", ret); | 517 | usb_err(usbatm, "FirmwarePllFClkValue failed: %d\n", ret); |
519 | return; | 518 | return; |
520 | } | 519 | } |
521 | 520 | ||
@@ -523,7 +522,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
523 | val = cpu_to_le32(instance->modem_type->pll_b_clk); | 522 | val = cpu_to_le32(instance->modem_type->pll_b_clk); |
524 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); | 523 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, PLLBCLK_ADDR, (u8 *) &val, 4); |
525 | if (ret) { | 524 | if (ret) { |
526 | dev_err(dev, "FirmwarePllBClkValue failed: %d\n", ret); | 525 | usb_err(usbatm, "FirmwarePllBClkValue failed: %d\n", ret); |
527 | return; | 526 | return; |
528 | } | 527 | } |
529 | 528 | ||
@@ -531,14 +530,14 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
531 | val = cpu_to_le32(SDRAM_ENA); | 530 | val = cpu_to_le32(SDRAM_ENA); |
532 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); | 531 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SDRAMEN_ADDR, (u8 *) &val, 4); |
533 | if (ret) { | 532 | if (ret) { |
534 | dev_err(dev, "Enable SDRAM failed: %d\n", ret); | 533 | usb_err(usbatm, "Enable SDRAM failed: %d\n", ret); |
535 | return; | 534 | return; |
536 | } | 535 | } |
537 | 536 | ||
538 | /* Firmware */ | 537 | /* Firmware */ |
539 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); | 538 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, FW_ADDR, fw->data, fw->size); |
540 | if (ret) { | 539 | if (ret) { |
541 | dev_err(dev, "Firmware upload failed: %d\n", ret); | 540 | usb_err(usbatm, "Firmware upload failed: %d\n", ret); |
542 | return; | 541 | return; |
543 | } | 542 | } |
544 | 543 | ||
@@ -546,7 +545,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
546 | if (instance->modem_type->boot_rom_patch) { | 545 | if (instance->modem_type->boot_rom_patch) { |
547 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); | 546 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, BR_ADDR, bp->data, bp->size); |
548 | if (ret) { | 547 | if (ret) { |
549 | dev_err(dev, "Boot ROM patching failed: %d\n", ret); | 548 | usb_err(usbatm, "Boot ROM patching failed: %d\n", ret); |
550 | return; | 549 | return; |
551 | } | 550 | } |
552 | } | 551 | } |
@@ -554,7 +553,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
554 | /* Signature */ | 553 | /* Signature */ |
555 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); | 554 | ret = cxacru_fw(usb_dev, FW_WRITE_MEM, 0x2, 0x0, SIG_ADDR, (u8 *) signature, 4); |
556 | if (ret) { | 555 | if (ret) { |
557 | dev_err(dev, "Signature storing failed: %d\n", ret); | 556 | usb_err(usbatm, "Signature storing failed: %d\n", ret); |
558 | return; | 557 | return; |
559 | } | 558 | } |
560 | 559 | ||
@@ -566,7 +565,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
566 | ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); | 565 | ret = cxacru_fw(usb_dev, FW_GOTO_MEM, 0x0, 0x0, FW_ADDR, NULL, 0); |
567 | } | 566 | } |
568 | if (ret) { | 567 | if (ret) { |
569 | dev_err(dev, "Passing control to firmware failed: %d\n", ret); | 568 | usb_err(usbatm, "Passing control to firmware failed: %d\n", ret); |
570 | return; | 569 | return; |
571 | } | 570 | } |
572 | 571 | ||
@@ -580,7 +579,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
580 | 579 | ||
581 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); | 580 | ret = cxacru_cm(instance, CM_REQUEST_CARD_GET_STATUS, NULL, 0, NULL, 0); |
582 | if (ret < 0) { | 581 | if (ret < 0) { |
583 | dev_err(dev, "modem failed to initialize: %d\n", ret); | 582 | usb_err(usbatm, "modem failed to initialize: %d\n", ret); |
584 | return; | 583 | return; |
585 | } | 584 | } |
586 | 585 | ||
@@ -597,7 +596,7 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
597 | ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET, | 596 | ret = cxacru_cm(instance, CM_REQUEST_CARD_DATA_SET, |
598 | (u8 *) buf, len, NULL, 0); | 597 | (u8 *) buf, len, NULL, 0); |
599 | if (ret < 0) { | 598 | if (ret < 0) { |
600 | dev_err(dev, "load config data failed: %d\n", ret); | 599 | usb_err(usbatm, "load config data failed: %d\n", ret); |
601 | return; | 600 | return; |
602 | } | 601 | } |
603 | } | 602 | } |
@@ -608,18 +607,19 @@ static void cxacru_upload_firmware(struct cxacru_data *instance, | |||
608 | static int cxacru_find_firmware(struct cxacru_data *instance, | 607 | static int cxacru_find_firmware(struct cxacru_data *instance, |
609 | char* phase, const struct firmware **fw_p) | 608 | char* phase, const struct firmware **fw_p) |
610 | { | 609 | { |
611 | struct device *dev = &instance->usbatm->usb_intf->dev; | 610 | struct usbatm_data *usbatm = instance->usbatm; |
611 | struct device *dev = &usbatm->usb_intf->dev; | ||
612 | char buf[16]; | 612 | char buf[16]; |
613 | 613 | ||
614 | sprintf(buf, "cxacru-%s.bin", phase); | 614 | sprintf(buf, "cxacru-%s.bin", phase); |
615 | dbg("cxacru_find_firmware: looking for %s", buf); | 615 | dbg("cxacru_find_firmware: looking for %s", buf); |
616 | 616 | ||
617 | if (request_firmware(fw_p, buf, dev)) { | 617 | if (request_firmware(fw_p, buf, dev)) { |
618 | dev_dbg(dev, "no stage %s firmware found\n", phase); | 618 | usb_dbg(usbatm, "no stage %s firmware found\n", phase); |
619 | return -ENOENT; | 619 | return -ENOENT; |
620 | } | 620 | } |
621 | 621 | ||
622 | dev_info(dev, "found firmware %s\n", buf); | 622 | usb_info(usbatm, "found firmware %s\n", buf); |
623 | 623 | ||
624 | return 0; | 624 | return 0; |
625 | } | 625 | } |
@@ -627,20 +627,19 @@ static int cxacru_find_firmware(struct cxacru_data *instance, | |||
627 | static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, | 627 | static int cxacru_heavy_init(struct usbatm_data *usbatm_instance, |
628 | struct usb_interface *usb_intf) | 628 | struct usb_interface *usb_intf) |
629 | { | 629 | { |
630 | struct device *dev = &usbatm_instance->usb_intf->dev; | ||
631 | const struct firmware *fw, *bp, *cf; | 630 | const struct firmware *fw, *bp, *cf; |
632 | struct cxacru_data *instance = usbatm_instance->driver_data; | 631 | struct cxacru_data *instance = usbatm_instance->driver_data; |
633 | 632 | ||
634 | int ret = cxacru_find_firmware(instance, "fw", &fw); | 633 | int ret = cxacru_find_firmware(instance, "fw", &fw); |
635 | if (ret) { | 634 | if (ret) { |
636 | dev_warn(dev, "firmware (cxacru-fw.bin) unavailable (hotplug misconfiguration?)\n"); | 635 | usb_warn(usbatm_instance, "firmware (cxacru-fw.bin) unavailable (system misconfigured?)\n"); |
637 | return ret; | 636 | return ret; |
638 | } | 637 | } |
639 | 638 | ||
640 | if (instance->modem_type->boot_rom_patch) { | 639 | if (instance->modem_type->boot_rom_patch) { |
641 | ret = cxacru_find_firmware(instance, "bp", &bp); | 640 | ret = cxacru_find_firmware(instance, "bp", &bp); |
642 | if (ret) { | 641 | if (ret) { |
643 | dev_warn(dev, "boot ROM patch (cxacru-bp.bin) unavailable (hotplug misconfiguration?)\n"); | 642 | usb_warn(usbatm_instance, "boot ROM patch (cxacru-bp.bin) unavailable (system misconfigured?)\n"); |
644 | release_firmware(fw); | 643 | release_firmware(fw); |
645 | return ret; | 644 | return ret; |
646 | } | 645 | } |
@@ -787,12 +786,12 @@ static const struct usb_device_id cxacru_usb_ids[] = { | |||
787 | { /* V = Conexant P = ADSL modem (Hasbani project) */ | 786 | { /* V = Conexant P = ADSL modem (Hasbani project) */ |
788 | USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 | 787 | USB_DEVICE(0x0572, 0xcb00), .driver_info = (unsigned long) &cxacru_cb00 |
789 | }, | 788 | }, |
790 | { /* V = Conexant P = ADSL modem (Well PTI-800 */ | ||
791 | USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 | ||
792 | }, | ||
793 | { /* V = Conexant P = ADSL modem */ | 789 | { /* V = Conexant P = ADSL modem */ |
794 | USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 | 790 | USB_DEVICE(0x0572, 0xcb01), .driver_info = (unsigned long) &cxacru_cb00 |
795 | }, | 791 | }, |
792 | { /* V = Conexant P = ADSL modem (Well PTI-800) */ | ||
793 | USB_DEVICE(0x0572, 0xcb02), .driver_info = (unsigned long) &cxacru_cb00 | ||
794 | }, | ||
796 | { /* V = Conexant P = ADSL modem */ | 795 | { /* V = Conexant P = ADSL modem */ |
797 | USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00 | 796 | USB_DEVICE(0x0572, 0xcb06), .driver_info = (unsigned long) &cxacru_cb00 |
798 | }, | 797 | }, |