aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:50 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-05 20:57:50 -0500
commit34394e45c3387bd66619d9a51b4be507e4222b02 (patch)
treee01f4b89b71e9126c02a1f23896a92bd29644754 /drivers/macintosh
parent594765a7316562cb7442f760a9a2f6e02804b610 (diff)
ppc: fix #ifdef-s in mediabay driver (take 2)
* Replace incorrect CONFIG_BLK_DEV_IDE #ifdef in check_media_bay() by CONFIG_MAC_FLOPPY one. * Replace incorrect CONFIG_BLK_DEV_IDE #ifdef-s by CONFIG_BLK_DEV_IDE_PMAC ones. * check_media_bay() is used only by drivers/block/swim3.c so make this function available only if CONFIG_MAC_FLOPPY is defined. * check_media_bay_by_base() and media_bay_set_ide_infos() are used only by drivers/ide/ppc/pmac.c so so make these functions available only if CONFIG_MAC_FLOPPY is defined. v2: * Remove ifdefs from function prototypes. (Andrew Morton) Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/mediabay.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c
index de9ebbfbf122..936788272a5f 100644
--- a/drivers/macintosh/mediabay.c
+++ b/drivers/macintosh/mediabay.c
@@ -78,12 +78,14 @@ struct media_bay_info {
78 int cached_gpio; 78 int cached_gpio;
79 int sleeping; 79 int sleeping;
80 struct semaphore lock; 80 struct semaphore lock;
81#ifdef CONFIG_BLK_DEV_IDE 81#ifdef CONFIG_BLK_DEV_IDE_PMAC
82 void __iomem *cd_base; 82 void __iomem *cd_base;
83 int cd_index;
84 int cd_irq; 83 int cd_irq;
85 int cd_retry; 84 int cd_retry;
86#endif 85#endif
86#if defined(CONFIG_BLK_DEV_IDE_PMAC) || defined(CONFIG_MAC_FLOPPY)
87 int cd_index;
88#endif
87}; 89};
88 90
89#define MAX_BAYS 2 91#define MAX_BAYS 2
@@ -91,7 +93,7 @@ struct media_bay_info {
91static struct media_bay_info media_bays[MAX_BAYS]; 93static struct media_bay_info media_bays[MAX_BAYS];
92int media_bay_count = 0; 94int media_bay_count = 0;
93 95
94#ifdef CONFIG_BLK_DEV_IDE 96#ifdef CONFIG_BLK_DEV_IDE_PMAC
95/* check the busy bit in the media-bay ide interface 97/* check the busy bit in the media-bay ide interface
96 (assumes the media-bay contains an ide device) */ 98 (assumes the media-bay contains an ide device) */
97#define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0) 99#define MB_IDE_READY(i) ((readb(media_bays[i].cd_base + 0x70) & 0x80) == 0)
@@ -401,7 +403,7 @@ static void poll_media_bay(struct media_bay_info* bay)
401 set_mb_power(bay, id != MB_NO); 403 set_mb_power(bay, id != MB_NO);
402 bay->content_id = id; 404 bay->content_id = id;
403 if (id == MB_NO) { 405 if (id == MB_NO) {
404#ifdef CONFIG_BLK_DEV_IDE 406#ifdef CONFIG_BLK_DEV_IDE_PMAC
405 bay->cd_retry = 0; 407 bay->cd_retry = 0;
406#endif 408#endif
407 printk(KERN_INFO "media bay %d is empty\n", bay->index); 409 printk(KERN_INFO "media bay %d is empty\n", bay->index);
@@ -414,9 +416,9 @@ static void poll_media_bay(struct media_bay_info* bay)
414 } 416 }
415} 417}
416 418
419#ifdef CONFIG_MAC_FLOPPY
417int check_media_bay(struct device_node *which_bay, int what) 420int check_media_bay(struct device_node *which_bay, int what)
418{ 421{
419#ifdef CONFIG_BLK_DEV_IDE
420 int i; 422 int i;
421 423
422 for (i=0; i<media_bay_count; i++) 424 for (i=0; i<media_bay_count; i++)
@@ -426,14 +428,14 @@ int check_media_bay(struct device_node *which_bay, int what)
426 media_bays[i].cd_index = -1; 428 media_bays[i].cd_index = -1;
427 return -EINVAL; 429 return -EINVAL;
428 } 430 }
429#endif /* CONFIG_BLK_DEV_IDE */
430 return -ENODEV; 431 return -ENODEV;
431} 432}
432EXPORT_SYMBOL(check_media_bay); 433EXPORT_SYMBOL(check_media_bay);
434#endif /* CONFIG_MAC_FLOPPY */
433 435
436#ifdef CONFIG_BLK_DEV_IDE_PMAC
434int check_media_bay_by_base(unsigned long base, int what) 437int check_media_bay_by_base(unsigned long base, int what)
435{ 438{
436#ifdef CONFIG_BLK_DEV_IDE
437 int i; 439 int i;
438 440
439 for (i=0; i<media_bay_count; i++) 441 for (i=0; i<media_bay_count; i++)
@@ -443,15 +445,13 @@ int check_media_bay_by_base(unsigned long base, int what)
443 media_bays[i].cd_index = -1; 445 media_bays[i].cd_index = -1;
444 return -EINVAL; 446 return -EINVAL;
445 } 447 }
446#endif 448
447
448 return -ENODEV; 449 return -ENODEV;
449} 450}
450 451
451int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, 452int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
452 int irq, int index) 453 int irq, int index)
453{ 454{
454#ifdef CONFIG_BLK_DEV_IDE
455 int i; 455 int i;
456 456
457 for (i=0; i<media_bay_count; i++) { 457 for (i=0; i<media_bay_count; i++) {
@@ -483,10 +483,10 @@ int media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base,
483 return -ENODEV; 483 return -ENODEV;
484 } 484 }
485 } 485 }
486#endif /* CONFIG_BLK_DEV_IDE */ 486
487
488 return -ENODEV; 487 return -ENODEV;
489} 488}
489#endif /* CONFIG_BLK_DEV_IDE_PMAC */
490 490
491static void media_bay_step(int i) 491static void media_bay_step(int i)
492{ 492{
@@ -521,14 +521,13 @@ static void media_bay_step(int i)
521 bay->state = mb_resetting; 521 bay->state = mb_resetting;
522 MBDBG("mediabay%d: waiting reset (kind:%d)\n", i, bay->content_id); 522 MBDBG("mediabay%d: waiting reset (kind:%d)\n", i, bay->content_id);
523 break; 523 break;
524
525 case mb_resetting: 524 case mb_resetting:
526 if (bay->content_id != MB_CD) { 525 if (bay->content_id != MB_CD) {
527 MBDBG("mediabay%d: bay is up (kind:%d)\n", i, bay->content_id); 526 MBDBG("mediabay%d: bay is up (kind:%d)\n", i, bay->content_id);
528 bay->state = mb_up; 527 bay->state = mb_up;
529 break; 528 break;
530 } 529 }
531#ifdef CONFIG_BLK_DEV_IDE 530#ifdef CONFIG_BLK_DEV_IDE_PMAC
532 MBDBG("mediabay%d: waiting IDE reset (kind:%d)\n", i, bay->content_id); 531 MBDBG("mediabay%d: waiting IDE reset (kind:%d)\n", i, bay->content_id);
533 bay->ops->un_reset_ide(bay); 532 bay->ops->un_reset_ide(bay);
534 bay->timer = msecs_to_jiffies(MB_IDE_WAIT); 533 bay->timer = msecs_to_jiffies(MB_IDE_WAIT);
@@ -536,16 +535,14 @@ static void media_bay_step(int i)
536#else 535#else
537 printk(KERN_DEBUG "media-bay %d is ide (not compiled in kernel)\n", i); 536 printk(KERN_DEBUG "media-bay %d is ide (not compiled in kernel)\n", i);
538 set_mb_power(bay, 0); 537 set_mb_power(bay, 0);
539#endif /* CONFIG_BLK_DEV_IDE */ 538#endif /* CONFIG_BLK_DEV_IDE_PMAC */
540 break; 539 break;
541 540#ifdef CONFIG_BLK_DEV_IDE_PMAC
542#ifdef CONFIG_BLK_DEV_IDE
543 case mb_ide_resetting: 541 case mb_ide_resetting:
544 bay->timer = msecs_to_jiffies(MB_IDE_TIMEOUT); 542 bay->timer = msecs_to_jiffies(MB_IDE_TIMEOUT);
545 bay->state = mb_ide_waiting; 543 bay->state = mb_ide_waiting;
546 MBDBG("mediabay%d: waiting IDE ready (kind:%d)\n", i, bay->content_id); 544 MBDBG("mediabay%d: waiting IDE ready (kind:%d)\n", i, bay->content_id);
547 break; 545 break;
548
549 case mb_ide_waiting: 546 case mb_ide_waiting:
550 if (bay->cd_base == NULL) { 547 if (bay->cd_base == NULL) {
551 bay->timer = 0; 548 bay->timer = 0;
@@ -587,11 +584,10 @@ static void media_bay_step(int i)
587 bay->timer = 0; 584 bay->timer = 0;
588 } 585 }
589 break; 586 break;
590#endif /* CONFIG_BLK_DEV_IDE */ 587#endif /* CONFIG_BLK_DEV_IDE_PMAC */
591
592 case mb_powering_down: 588 case mb_powering_down:
593 bay->state = mb_empty; 589 bay->state = mb_empty;
594#ifdef CONFIG_BLK_DEV_IDE 590#ifdef CONFIG_BLK_DEV_IDE_PMAC
595 if (bay->cd_index >= 0) { 591 if (bay->cd_index >= 0) {
596 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i, 592 printk(KERN_DEBUG "Unregistering mb %d ide, index:%d\n", i,
597 bay->cd_index); 593 bay->cd_index);
@@ -607,7 +603,7 @@ static void media_bay_step(int i)
607 bay->content_id = MB_NO; 603 bay->content_id = MB_NO;
608 } 604 }
609 } 605 }
610#endif /* CONFIG_BLK_DEV_IDE */ 606#endif /* CONFIG_BLK_DEV_IDE_PMAC */
611 MBDBG("mediabay%d: end of power down\n", i); 607 MBDBG("mediabay%d: end of power down\n", i);
612 break; 608 break;
613 } 609 }
@@ -739,7 +735,7 @@ static int media_bay_resume(struct macio_dev *mdev)
739 bay->last_value = bay->content_id; 735 bay->last_value = bay->content_id;
740 bay->value_count = msecs_to_jiffies(MB_STABLE_DELAY); 736 bay->value_count = msecs_to_jiffies(MB_STABLE_DELAY);
741 bay->timer = msecs_to_jiffies(MB_POWER_DELAY); 737 bay->timer = msecs_to_jiffies(MB_POWER_DELAY);
742#ifdef CONFIG_BLK_DEV_IDE 738#ifdef CONFIG_BLK_DEV_IDE_PMAC
743 bay->cd_retry = 0; 739 bay->cd_retry = 0;
744#endif 740#endif
745 do { 741 do {
@@ -829,7 +825,7 @@ static int __init media_bay_init(void)
829 for (i=0; i<MAX_BAYS; i++) { 825 for (i=0; i<MAX_BAYS; i++) {
830 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info)); 826 memset((char *)&media_bays[i], 0, sizeof(struct media_bay_info));
831 media_bays[i].content_id = -1; 827 media_bays[i].content_id = -1;
832#ifdef CONFIG_BLK_DEV_IDE 828#ifdef CONFIG_BLK_DEV_IDE_PMAC
833 media_bays[i].cd_index = -1; 829 media_bays[i].cd_index = -1;
834#endif 830#endif
835 } 831 }