[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hard Drive light



According to Benjamin Herrenschmidt, on Mon, 20 Dec 2004 17:00:43 +0100, 
>
>> I chose macio since I had the struct device pointer easily accessible in pmac.c.
>
>Not all laptops have the IDE under macio though ... some have it under a
>PCI node. It should be per-controller ideally... (some machines have
>both the macio one and the PCI one).
>
>> I don't think so. Module parameters do not depend of the module name (as far as I
>> understand from the doc). What I guess is that ide-pmac module is initialized too early
>to> have correct boot parameters. For instance, I tried to had a dummy module_init
>function,> and it is called much later than ide_pmac_setup_device (where blinking is
>initialized).> Anybody can confirm or infirm this guess ?
>
>When a module is built-in, it's parameters are passed in the form
>modulename.paramname=value
>
>> Furthermore I've looked at the way framebuffers manage boot params, and these module
>seems> to be parsing the comand line themselves too. 
>
>Framebuffers use a setup function, not a module param.
>
>Ben.
>

Hi all,

Thanks for your help. 

I could not find how to attach the sys entry to the ide interface,
but now, it is attached to the bus owning the IDE, either macio or pci according
to which 'attach' function is called. On my ibook, it is macio and I have no way to test
if the pci entry works fine. 

In accord with popular demand, the blink by default is ON, and it can be disabled with
boot parameter ide_core.noblink, or through the /sys/bus/(macio|pci)/*/blinking_led
interface.

With the christmas break, I will not be able to work on that for a couple of week.
So if there is still modifications to do, they will have to wait, (or I don't mind if 
someone else handle them :). 

-- 
Cedric Pradalier
--- pmac.c	2004-12-23 23:00:49.184102112 +1100
+++ pmac.c.old	2004-12-05 23:58:25.000000000 +1100
@@ -35,11 +35,6 @@
 #include <linux/adb.h>
 #include <linux/pmu.h>
 
-#ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
-#include <linux/device.h>
-#include <asm/of_device.h>
-#endif
-
 #include <asm/prom.h>
 #include <asm/io.h>
 #include <asm/dbdma.h>
@@ -377,15 +372,6 @@
 
 #ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
 
-MODULE_AUTHOR("Paul Mackerras & Ben. Herrenschmidt");
-MODULE_DESCRIPTION("Support for IDE interfaces on PowerMacs");
-MODULE_LICENSE("GPL");
-
-static int blinking_led = 0;
-module_param_named(noblink,blinking_led, invbool, 0666);
-MODULE_PARM_DESC(noblink,"Enable/Disable blinking led [Default: enabled]");
-
-
 /* Set to 50ms minimum led-on time (also used to limit frequency
  * of requests sent to the PMU
  */
@@ -396,7 +382,8 @@
 static unsigned long pmu_blink_stoptime;
 static int pmu_blink_ledstate;
 static struct timer_list pmu_blink_timer;
-static int pmu_ide_blink_enabled = 0;
+static int pmu_ide_blink_enabled;
+
 
 static void
 pmu_hd_blink_timeout(unsigned long data)
@@ -426,8 +413,6 @@
 pmu_hd_kick_blink(void *data, int rw)
 {
 	unsigned long flags;
-	if (!blinking_led)
-		return;
 	
 	pmu_blink_stoptime = jiffies + PMU_HD_BLINK_TIME;
 	wmb();
@@ -443,28 +428,8 @@
 	spin_unlock_irqrestore(&pmu_blink_lock, flags);
 }
 
-static ssize_t show_blinkingled_activity(struct device *dev, char *buf)\
-{  
-	return sprintf(buf, "%c\n", blinking_led?'1':'0'); 
-}
-
-static ssize_t set_blinkingled_activity(struct device *dev, 
-		const char *buf, size_t count)
-{
-	int blink;
-	if (sscanf (buf, "%d", &blink) != 1)
-		return -EINVAL;
-	blinking_led = (blink != 0);
-	printk(KERN_INFO "pmac blinking led initialized (blink %s)\n",
-			blinking_led?"enabled":"disabled");
-	return count;
-}
-
-static DEVICE_ATTR (blinking_led, S_IRUGO | S_IWUSR, 
-		show_blinkingled_activity, set_blinkingled_activity);
-
 static int
-pmu_hd_blink_init(struct device * dev)
+pmu_hd_blink_init(void)
 {
 	struct device_node *dt;
 	const char *model;
@@ -493,11 +458,6 @@
 	init_timer(&pmu_blink_timer);
 	pmu_blink_timer.function = pmu_hd_blink_timeout;
 
-	device_create_file (dev, &dev_attr_blinking_led);
-	
-	printk(KERN_INFO "pmac blinking led initialized (blink %s)\n",
-			blinking_led?"enabled":"disabled");
-
 	return 1;
 }
 
@@ -1270,7 +1230,7 @@
 	hwif->speedproc = pmac_ide_tune_chipset;
 
 #ifdef CONFIG_BLK_DEV_IDE_PMAC_BLINK
-	pmu_ide_blink_enabled = pmu_hd_blink_init(hwif->gendev.parent);
+	pmu_ide_blink_enabled = pmu_hd_blink_init();
 
 	if (pmu_ide_blink_enabled)
 		hwif->led_act = pmu_hd_kick_blink;
@@ -1382,7 +1342,6 @@
 #endif /* CONFIG_BLK_DEV_IDEDMA_PMAC */
 	dev_set_drvdata(&mdev->ofdev.dev, hwif);
 
-	printk(KERN_INFO "pmac: using macio interface");
 	rc = pmac_ide_setup_device(pmif, hwif);
 	if (rc != 0) {
 		/* The inteface is released to the common IDE layer */
@@ -1495,7 +1454,6 @@
 
 	pci_set_drvdata(pdev, hwif);
 
-	printk(KERN_INFO "pmac: using PCI interface");
 	rc = pmac_ide_setup_device(pmif, hwif);
 	if (rc != 0) {
 		/* The inteface is released to the common IDE layer */

Reply to: