From 8aae8284fece2b8fc404ccd40b7a30aa96f317b5 Mon Sep 17 00:00:00 2001 From: Jacob Shin Date: Mon, 21 Nov 2005 07:23:08 -0800 Subject: [CPUFREQ] Improve Error reporting in powernow-k8 This patch cleans up some error messages in the powernow-k8 driver and makes them more understandable. Signed-off-by: Jacob Shin Signed-off-by: Mark Langsdorf Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 31 +++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 68a1fc87f4ca..349782736808 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c @@ -45,7 +45,7 @@ #define PFX "powernow-k8: " #define BFX PFX "BIOS error: " -#define VERSION "version 1.50.4" +#define VERSION "version 1.50.5" #include "powernow-k8.h" /* serialize freq changes */ @@ -464,7 +464,7 @@ static int check_supported_cpu(unsigned int cpu) set_cpus_allowed(current, cpumask_of_cpu(cpu)); if (smp_processor_id() != cpu) { - printk(KERN_ERR "limiting to cpu %u failed\n", cpu); + printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu); goto out; } @@ -517,22 +517,28 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); return -ENODEV; } - if ((pst[j].fid > MAX_FID) - || (pst[j].fid & 1) - || (j && (pst[j].fid < HI_FID_TABLE_BOTTOM))) { + if (pst[j].fid > MAX_FID) { + printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); + return -ENODEV; + } + if (pst[j].fid & 1) { + printk(KERN_ERR BFX "fid invalid - %d : 0x%x\n", j, pst[j].fid); + return -EINVAL; + } + if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { /* Only first fid is allowed to be in "low" range */ - printk(KERN_ERR PFX "two low fids - %d : 0x%x\n", j, pst[j].fid); + printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); return -EINVAL; } if (pst[j].fid < lastfid) lastfid = pst[j].fid; } if (lastfid & 1) { - printk(KERN_ERR PFX "lastfid invalid\n"); + printk(KERN_ERR BFX "lastfid invalid\n"); return -EINVAL; } if (lastfid > LO_FID_TABLE_TOP) - printk(KERN_INFO PFX "first fid not from lo freq table\n"); + printk(KERN_INFO BFX "first fid not from lo freq table\n"); return 0; } @@ -912,7 +918,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); if (smp_processor_id() != pol->cpu) { - printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); + printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); goto err_out; } @@ -982,6 +988,9 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) cpumask_t oldmask = CPU_MASK_ALL; int rc, i; + if (!cpu_online(pol->cpu)) + return -ENODEV; + if (!check_supported_cpu(pol->cpu)) return -ENODEV; @@ -1021,7 +1030,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); if (smp_processor_id() != pol->cpu) { - printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); + printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); goto err_out; } @@ -1162,7 +1171,7 @@ static void __exit powernowk8_exit(void) cpufreq_unregister_driver(&cpufreq_amd64_driver); } -MODULE_AUTHOR("Paul Devriendt and Mark Langsdorf and Mark Langsdorf "); MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 019a61b99338d0ac05de25317b85da88e7ec4b35 Mon Sep 17 00:00:00 2001 From: "Langsdorf, Mark" Date: Tue, 29 Nov 2005 14:18:03 -0600 Subject: [PATCH] Support 100 MHz frequency transitions Future versions of the Opteron processor may support frequency transitions of 100 MHz, instead of the=20 current 200 MHz. This patch enables the powernow-k8 driver to transition to an odd FID code, indicating a multiple of 100 MHz frequency. Signed-off-by: Jacob Shin Signed-off-by: Mark Langsdorf Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 17 +++++++---------- arch/i386/kernel/cpu/cpufreq/powernow-k8.h | 9 +++++---- 2 files changed, 12 insertions(+), 14 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index 349782736808..a342b32c0843 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c @@ -45,7 +45,7 @@ #define PFX "powernow-k8: " #define BFX PFX "BIOS error: " -#define VERSION "version 1.50.5" +#define VERSION "version 1.60.0" #include "powernow-k8.h" /* serialize freq changes */ @@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid /* Phase 2 - core frequency transition */ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) { - u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid; + u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid; if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", @@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) : vcoreqfid - vcocurrfid; while (vcofiddiff > 2) { + (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2); + if (reqfid > data->currfid) { if (data->currfid > LO_FID_TABLE_TOP) { - if (write_new_fid(data, data->currfid + 2)) { + if (write_new_fid(data, data->currfid + fid_interval)) { return 1; } } else { @@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) } } } else { - if (write_new_fid(data, data->currfid - 2)) + if (write_new_fid(data, data->currfid - fid_interval)) return 1; } @@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu) eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || - ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { + ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) { printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); goto out; } @@ -521,10 +523,6 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8 printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j); return -ENODEV; } - if (pst[j].fid & 1) { - printk(KERN_ERR BFX "fid invalid - %d : 0x%x\n", j, pst[j].fid); - return -EINVAL; - } if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) { /* Only first fid is allowed to be in "low" range */ printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid); @@ -1177,4 +1175,3 @@ MODULE_LICENSE("GPL"); late_initcall(powernowk8_init); module_exit(powernowk8_exit); - diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h index b1e85bb36396..d0de37d58e9a 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h @@ -42,7 +42,7 @@ struct powernow_k8_data { #define CPUID_XFAM 0x0ff00000 /* extended family */ #define CPUID_XFAM_K8 0 #define CPUID_XMOD 0x000f0000 /* extended model */ -#define CPUID_XMOD_REV_F 0x00040000 +#define CPUID_XMOD_REV_G 0x00060000 #define CPUID_USE_XFAM_XMOD 0x00000f00 #define CPUID_GET_MAX_CAPABILITIES 0x80000000 #define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 @@ -86,13 +86,14 @@ struct powernow_k8_data { * low fid table * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry * in the low fid table - * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid + * - the parts can only step at <= 200 MHz intervals, odd fid values are + * supported in revision G and later revisions. * - lowest frequency must be >= interprocessor hypertransport link speed * (only applies to MP systems obviously) */ /* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ -#define LO_FID_TABLE_TOP 6 /* fid values marking the boundary */ +#define LO_FID_TABLE_TOP 7 /* fid values marking the boundary */ #define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ #define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ @@ -106,7 +107,7 @@ struct powernow_k8_data { #define MIN_FREQ 800 /* Min and max freqs, per spec */ #define MAX_FREQ 5000 -#define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ +#define INVALID_FID_MASK 0xffffffc0 /* not a valid fid if these bits are set */ #define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ #define VID_OFF 0x3f -- cgit v1.2.3 From 6df8900676c3f5c133328332fb8ad889fd0cc9e3 Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Wed, 30 Nov 2005 13:33:30 -0800 Subject: [CPUFREQ] Fix indentation in powernow-k8 Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index a342b32c0843..f44c1b1b04e9 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c @@ -216,10 +216,10 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid) do { wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); - if (i++ > 100) { - printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); - return 1; - } + if (i++ > 100) { + printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); + return 1; + } } while (query_current_values_with_pending_wait(data)); if (savefid != data->currfid) { -- cgit v1.2.3 From d4921914de19339d7cd987d2ed6d48754821f41a Mon Sep 17 00:00:00 2001 From: "Gabriel A. Devenyi" Date: Thu, 1 Dec 2005 01:09:22 -0800 Subject: [PATCH] cpufreq-nforce2.c fix u32<0 test Thanks to LinuxICC (http://linuxicc.sf.net), a comparison of a u32 less than 0 was found, this patch changes the variable to a signed int so that comparison is meaningful. Signed-off-by: Gabriel A. Devenyi Signed-off-by: Andrew Morton Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c index 04a405345203..2b62dee35c6c 100644 --- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c +++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c @@ -177,9 +177,10 @@ static unsigned int nforce2_fsb_read(int bootfsb) */ static int nforce2_set_fsb(unsigned int fsb) { - u32 pll, temp = 0; + u32 temp = 0; unsigned int tfsb; int diff; + int pll = 0; if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); -- cgit v1.2.3 From cc6e8de8f0fab61760bb7091fb19eef1406e17be Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Tue, 6 Dec 2005 15:03:55 -0800 Subject: [CPUFREQ] Change loglevels on powernow-k8 bios error printk's. If a user has booted with 'quiet', some important messages don't get displayed which really should. We've seen at least one case where powernow-k8 stopped working, and the user needed a BIOS update that they didn't know about. Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/cpufreq/powernow-k8.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c index f44c1b1b04e9..0fbbd4c1072e 100644 --- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c @@ -635,7 +635,7 @@ static int find_psb_table(struct powernow_k8_data *data) dprintk("table vers: 0x%x\n", psb->tableversion); if (psb->tableversion != PSB_VERSION_1_4) { - printk(KERN_INFO BFX "PSB table is not v1.4\n"); + printk(KERN_ERR BFX "PSB table is not v1.4\n"); return -ENODEV; } @@ -693,7 +693,7 @@ static int find_psb_table(struct powernow_k8_data *data) * BIOS and Kernel Developer's Guide, which is available on * www.amd.com */ - printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n"); + printk(KERN_ERR PFX "BIOS error - no PSB or ACPI _PSS objects\n"); return -ENODEV; } -- cgit v1.2.3 From 1a10760c91c394dfe4adfefeeaf85cd8098c4894 Mon Sep 17 00:00:00 2001 From: Mattia Dongili Date: Fri, 2 Dec 2005 21:59:41 +0100 Subject: [CPUFREQ] Measure transition latency at driver initialization The attached patch introduces runtime latency measurement for ICH[234] based chipsets instead of using CPUFREQ_ETERNAL. It includes some sanity checks in case the measured value is out of range and assigns a safe value of 500uSec that should still be enough on problematics chipsets (current testing report values ~200uSec). The measurement is currently done in speedstep_get_freqs in order to avoid further unnecessary transitions and in the hope it'll come handy for SMI also. Signed-off-by: Mattia Dongili Acked-by: Dominik Brodowski Signed-off-by: Dave Jones speedstep-ich.c | 4 ++-- speedstep-lib.c | 32 +++++++++++++++++++++++++++++++- speedstep-lib.h | 1 + speedstep-smi.c | 1 + 4 files changed, 35 insertions(+), 3 deletions(-) --- arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 4 ++-- arch/i386/kernel/cpu/cpufreq/speedstep-lib.c | 32 +++++++++++++++++++++++++++- arch/i386/kernel/cpu/cpufreq/speedstep-lib.h | 1 + arch/i386/kernel/cpu/cpufreq/speedstep-smi.c | 1 + 4 files changed, 35 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 5b7d18a06afa..862e0b5656b9 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c @@ -315,10 +315,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) cpus_allowed = current->cpus_allowed; set_cpus_allowed(current, policy->cpus); - /* detect low and high frequency */ + /* detect low and high frequency and transition latency */ result = speedstep_get_freqs(speedstep_processor, &speedstep_freqs[SPEEDSTEP_LOW].frequency, &speedstep_freqs[SPEEDSTEP_HIGH].frequency, + &policy->cpuinfo.transition_latency, &speedstep_set_state); set_cpus_allowed(current, cpus_allowed); if (result) @@ -335,7 +336,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) /* cpuinfo and default policy values */ policy->governor = CPUFREQ_DEFAULT_GOVERNOR; - policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; policy->cur = speed; result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c index d368b3f5fce8..7c47005a1805 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c @@ -320,11 +320,13 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor); unsigned int speedstep_get_freqs(unsigned int processor, unsigned int *low_speed, unsigned int *high_speed, + unsigned int *transition_latency, void (*set_state) (unsigned int state)) { unsigned int prev_speed; unsigned int ret = 0; unsigned long flags; + struct timeval tv1, tv2; if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) return -EINVAL; @@ -337,7 +339,7 @@ unsigned int speedstep_get_freqs(unsigned int processor, return -EIO; dprintk("previous speed is %u\n", prev_speed); - + local_irq_save(flags); /* switch to low state */ @@ -350,8 +352,17 @@ unsigned int speedstep_get_freqs(unsigned int processor, dprintk("low speed is %u\n", *low_speed); + /* start latency measurement */ + if (transition_latency) + do_gettimeofday(&tv1); + /* switch to high state */ set_state(SPEEDSTEP_HIGH); + + /* end latency measurement */ + if (transition_latency) + do_gettimeofday(&tv2); + *high_speed = speedstep_get_processor_frequency(processor); if (!*high_speed) { ret = -EIO; @@ -369,6 +380,25 @@ unsigned int speedstep_get_freqs(unsigned int processor, if (*high_speed != prev_speed) set_state(SPEEDSTEP_LOW); + if (transition_latency) { + *transition_latency = (tv2.tv_sec - tv1.tv_sec) * USEC_PER_SEC + + tv2.tv_usec - tv1.tv_usec; + dprintk("transition latency is %u uSec\n", *transition_latency); + + /* convert uSec to nSec and add 20% for safety reasons */ + *transition_latency *= 1200; + + /* check if the latency measurement is too high or too low + * and set it to a safe value (500uSec) in that case + */ + if (*transition_latency > 10000000 || *transition_latency < 50000) { + printk (KERN_WARNING "speedstep: frequency transition measured seems out of " + "range (%u nSec), falling back to a safe one of %u nSec.\n", + *transition_latency, 500000); + *transition_latency = 500000; + } + } + out: local_irq_restore(flags); return (ret); diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h index 261a2c9b7f6b..6a727fd3a77e 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h @@ -44,4 +44,5 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor); extern unsigned int speedstep_get_freqs(unsigned int processor, unsigned int *low_speed, unsigned int *high_speed, + unsigned int *transition_latency, void (*set_state) (unsigned int state)); diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c index 2718fb6f6aba..28cc5d524afc 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c @@ -269,6 +269,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy) result = speedstep_get_freqs(speedstep_processor, &speedstep_freqs[SPEEDSTEP_LOW].frequency, &speedstep_freqs[SPEEDSTEP_HIGH].frequency, + NULL, &speedstep_set_state); if (result) { -- cgit v1.2.3 From 9a7d82a89a8bf55b112f2a5c3b3f405eb95a4303 Mon Sep 17 00:00:00 2001 From: Mattia Dongili Date: Wed, 30 Nov 2005 22:00:59 +0100 Subject: [CPUFREQ] Move PMBASE reading away and do it only once at initialization time This patch moves away PMBASE reading and only performs it at cpufreq_register_driver time by exiting with -ENODEV if unable to read the value. Signed-off-by: Mattia Dongili Acked-by: Dominik Brodowski Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/cpufreq/speedstep-ich.c | 43 +++++++++++++++++++--------- 1 file changed, 30 insertions(+), 13 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c index 862e0b5656b9..b425cd3d1838 100644 --- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c +++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c @@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev; */ static unsigned int speedstep_processor = 0; +static u32 pmbase; /* * There are only two frequency states for each processor. Values @@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = { /** - * speedstep_set_state - set the SpeedStep state - * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) + * speedstep_find_register - read the PMBASE address * - * Tries to change the SpeedStep state. + * Returns: -ENODEV if no register could be found */ -static void speedstep_set_state (unsigned int state) +static int speedstep_find_register (void) { - u32 pmbase; - u8 pm2_blk; - u8 value; - unsigned long flags; - - if (!speedstep_chipset_dev || (state > 0x1)) - return; + if (!speedstep_chipset_dev) + return -ENODEV; /* get PMBASE */ pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); if (!(pmbase & 0x01)) { printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); - return; + return -ENODEV; } pmbase &= 0xFFFFFFFE; if (!pmbase) { printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); - return; + return -ENODEV; } + dprintk("pmbase is 0x%x\n", pmbase); + return 0; +} + +/** + * speedstep_set_state - set the SpeedStep state + * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH) + * + * Tries to change the SpeedStep state. + */ +static void speedstep_set_state (unsigned int state) +{ + u8 pm2_blk; + u8 value; + unsigned long flags; + + if (state > 0x1) + return; + /* Disable IRQs */ local_irq_save(flags); @@ -400,6 +414,9 @@ static int __init speedstep_init(void) return -EINVAL; } + if (speedstep_find_register()) + return -ENODEV; + return cpufreq_register_driver(&speedstep_driver); } -- cgit v1.2.3 From 95235ca2c20ac0b31a8eb39e2d599bcc3e9c9a10 Mon Sep 17 00:00:00 2001 From: Venkatesh Pallipadi Date: Fri, 2 Dec 2005 10:43:20 -0800 Subject: [CPUFREQ] CPU frequency display in /proc/cpuinfo What is the value shown in "cpu MHz" of /proc/cpuinfo when CPUs are capable of changing frequency? Today the answer is: It depends. On i386: SMP kernel - It is always the boot frequency UP kernel - Scales with the frequency change and shows that was last set. On x86_64: There is one single variable cpu_khz that gets written by all the CPUs. So, the frequency set by last CPU will be seen on /proc/cpuinfo of all the CPUs in the system. What you see also depends on whether you have constant_tsc capable CPU or not. On ia64: It is always boot time frequency of a particular CPU that gets displayed. The patch below changes this to: Show the last known frequency of the particular CPU, when cpufreq is present. If cpu doesnot support changing of frequency through cpufreq, then boot frequency will be shown. The patch affects i386, x86_64 and ia64 architectures. Signed-off-by: Venkatesh Pallipadi Signed-off-by: Dave Jones --- arch/i386/kernel/cpu/proc.c | 6 +++++- arch/ia64/kernel/setup.c | 8 +++++++- arch/x86_64/kernel/setup.c | 6 +++++- drivers/cpufreq/cpufreq.c | 24 ++++++++++++++++++++++++ include/linux/cpufreq.h | 10 ++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) (limited to 'arch') diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c index e7921315ae9d..6d91b274589c 100644 --- a/arch/i386/kernel/cpu/proc.c +++ b/arch/i386/kernel/cpu/proc.c @@ -3,6 +3,7 @@ #include #include #include +#include /* * Get CPU information for use by the procfs. @@ -86,8 +87,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "stepping\t: unknown\n"); if ( cpu_has(c, X86_FEATURE_TSC) ) { + unsigned int freq = cpufreq_quick_get(n); + if (!freq) + freq = cpu_khz; seq_printf(m, "cpu MHz\t\t: %u.%03u\n", - cpu_khz / 1000, (cpu_khz % 1000)); + freq / 1000, (freq % 1000)); } /* Cache size */ diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c index 5add0bcf87a7..088e5dded8dc 100644 --- a/arch/ia64/kernel/setup.c +++ b/arch/ia64/kernel/setup.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -517,6 +518,7 @@ show_cpuinfo (struct seq_file *m, void *v) char family[32], features[128], *cp, sep; struct cpuinfo_ia64 *c = v; unsigned long mask; + unsigned int proc_freq; int i; mask = c->features; @@ -549,6 +551,10 @@ show_cpuinfo (struct seq_file *m, void *v) sprintf(cp, " 0x%lx", mask); } + proc_freq = cpufreq_quick_get(cpunum); + if (!proc_freq) + proc_freq = c->proc_freq / 1000; + seq_printf(m, "processor : %d\n" "vendor : %s\n" @@ -565,7 +571,7 @@ show_cpuinfo (struct seq_file *m, void *v) "BogoMIPS : %lu.%02lu\n", cpunum, c->vendor, family, c->model, c->revision, c->archrev, features, c->ppn, c->number, - c->proc_freq / 1000000, c->proc_freq % 1000000, + proc_freq / 1000, proc_freq % 1000, c->itc_freq / 1000000, c->itc_freq % 1000000, lpj*HZ/500000, (lpj*HZ/5000) % 100); #ifdef CONFIG_SMP diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c index 750e01dcbdf4..64c4534b930c 100644 --- a/arch/x86_64/kernel/setup.c +++ b/arch/x86_64/kernel/setup.c @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -1256,8 +1257,11 @@ static int show_cpuinfo(struct seq_file *m, void *v) seq_printf(m, "stepping\t: unknown\n"); if (cpu_has(c,X86_FEATURE_TSC)) { + unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data)); + if (!freq) + freq = cpu_khz; seq_printf(m, "cpu MHz\t\t: %u.%03u\n", - cpu_khz / 1000, (cpu_khz % 1000)); + freq / 1000, (freq % 1000)); } /* Cache size */ diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 815902c2c856..a9163d02983a 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -822,6 +822,30 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne } +/** + * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur + * @cpu: CPU number + * + * This is the last known freq, without actually getting it from the driver. + * Return value will be same as what is shown in scaling_cur_freq in sysfs. + */ +unsigned int cpufreq_quick_get(unsigned int cpu) +{ + struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); + unsigned int ret = 0; + + if (policy) { + down(&policy->lock); + ret = policy->cur; + up(&policy->lock); + cpufreq_cpu_put(policy); + } + + return (ret); +} +EXPORT_SYMBOL(cpufreq_quick_get); + + /** * cpufreq_get - get the current CPU frequency (in kHz) * @cpu: CPU number diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index d068176b7ad7..c31650df9241 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -256,6 +256,16 @@ int cpufreq_update_policy(unsigned int cpu); /* query the current CPU frequency (in kHz). If zero, cpufreq couldn't detect it */ unsigned int cpufreq_get(unsigned int cpu); +/* query the last known CPU freq (in kHz). If zero, cpufreq couldn't detect it */ +#ifdef CONFIG_CPU_FREQ +unsigned int cpufreq_quick_get(unsigned int cpu); +#else +static inline unsigned int cpufreq_quick_get(unsigned int cpu) +{ + return 0; +} +#endif + /********************************************************************* * CPUFREQ DEFAULT GOVERNOR * -- cgit v1.2.3 From 02959a875caec8cabd36111046ad537251ef405f Mon Sep 17 00:00:00 2001 From: Brian Gerst Date: Tue, 27 Dec 2005 23:39:51 -0500 Subject: gitignore: x86_64 files Add filters for x86_64 generated files. Signed-off-by: Brian Gerst Signed-off-by: Sam Ravnborg --- arch/x86_64/boot/.gitignore | 3 +++ arch/x86_64/boot/tools/.gitignore | 1 + arch/x86_64/ia32/.gitignore | 1 + 3 files changed, 5 insertions(+) create mode 100644 arch/x86_64/boot/.gitignore create mode 100644 arch/x86_64/boot/tools/.gitignore create mode 100644 arch/x86_64/ia32/.gitignore (limited to 'arch') diff --git a/arch/x86_64/boot/.gitignore b/arch/x86_64/boot/.gitignore new file mode 100644 index 000000000000..495f20c085de --- /dev/null +++ b/arch/x86_64/boot/.gitignore @@ -0,0 +1,3 @@ +bootsect +bzImage +setup diff --git a/arch/x86_64/boot/tools/.gitignore b/arch/x86_64/boot/tools/.gitignore new file mode 100644 index 000000000000..378eac25d311 --- /dev/null +++ b/arch/x86_64/boot/tools/.gitignore @@ -0,0 +1 @@ +build diff --git a/arch/x86_64/ia32/.gitignore b/arch/x86_64/ia32/.gitignore new file mode 100644 index 000000000000..48ab174fe5f1 --- /dev/null +++ b/arch/x86_64/ia32/.gitignore @@ -0,0 +1 @@ +vsyscall*.so -- cgit v1.2.3 From df7b5d13c6c850bc2e3ca6ccfb1038f36bbbcf19 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 3 Jan 2006 13:42:12 +0100 Subject: arch/arm26/nwfpe/fpmodule.c: remove kernel 2.0 #ifdef This patch removes an #ifdef for kernel 2.0 . Signed-off-by: Adrian Bunk --- arch/arm26/nwfpe/fpmodule.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'arch') diff --git a/arch/arm26/nwfpe/fpmodule.c b/arch/arm26/nwfpe/fpmodule.c index 528fa710aa34..5258c6096fb9 100644 --- a/arch/arm26/nwfpe/fpmodule.c +++ b/arch/arm26/nwfpe/fpmodule.c @@ -46,10 +46,9 @@ typedef struct task_struct* PTASK; #ifdef MODULE void fp_send_sig(unsigned long sig, PTASK p, int priv); -#if LINUX_VERSION_CODE > 0x20115 + MODULE_AUTHOR("Scott Bambrough "); MODULE_DESCRIPTION("NWFPE floating point emulator"); -#endif #else #define fp_send_sig send_sig -- cgit v1.2.3 From 81f280e22f14d6d976620acaa1b346a90f4e1adc Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 12 Nov 2005 14:22:11 +0000 Subject: [PATCH] USB: pxa27x OHCI - Separate platform code from main driver To allow multiple platforms to use the PXA27x OHCI driver, the platform code needs to be moved into the board specific files in arch/arm/mach-pxa. This patch does this for mainstone and adds preliminary hooks to allow other boards to use the driver. This has been compile tested for mainstone and successfully run on Spitz (Sharp Zaurus SL-C3000) with the addition of an appropriate board support file. Signed-off-by: Richard Purdie Signed-off-by: Nicolas Pitre Acked-by: David Brownell Signed-off-by: Greg Kroah-Hartman --- arch/arm/mach-pxa/mainstone.c | 21 ++++++++++ arch/arm/mach-pxa/pxa27x.c | 6 +++ drivers/usb/host/ohci-pxa27x.c | 85 +++++++++++++++++++++-------------------- include/asm-arm/arch-pxa/ohci.h | 18 +++++++++ 4 files changed, 88 insertions(+), 42 deletions(-) create mode 100644 include/asm-arm/arch-pxa/ohci.h (limited to 'arch') diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c index 07892f4012d8..277498ae5b6c 100644 --- a/arch/arm/mach-pxa/mainstone.c +++ b/arch/arm/mach-pxa/mainstone.c @@ -43,6 +43,7 @@ #include #include #include +#include #include "generic.h" @@ -393,6 +394,25 @@ static struct platform_device *platform_devices[] __initdata = { &mst_flash_device[1], }; +static int mainstone_ohci_init(struct device *dev) +{ + /* setup Port1 GPIO pin. */ + pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */ + pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */ + + /* Set the Power Control Polarity Low and Power Sense + Polarity Low to active low. */ + UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & + ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); + + return 0; +} + +static struct pxaohci_platform_data mainstone_ohci_platform_data = { + .port_mode = PMM_PERPORT_MODE, + .init = mainstone_ohci_init, +}; + static void __init mainstone_init(void) { int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ @@ -424,6 +444,7 @@ static void __init mainstone_init(void) pxa_set_mci_info(&mainstone_mci_platform_data); pxa_set_ficp_info(&mainstone_ficp_platform_data); + pxa_set_ohci_info(&mainstone_ohci_platform_data); } diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index c722a9a91fcc..b41b1efaa2cf 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "generic.h" @@ -194,6 +195,11 @@ static struct platform_device ohci_device = { .resource = pxa27x_ohci_resources, }; +void __init pxa_set_ohci_info(struct pxaohci_platform_data *info) +{ + ohci_device.dev.platform_data = info; +} + static struct platform_device *devices[] __initdata = { &ohci_device, }; diff --git a/drivers/usb/host/ohci-pxa27x.c b/drivers/usb/host/ohci-pxa27x.c index 9d65ec307990..c165d1ebed5c 100644 --- a/drivers/usb/host/ohci-pxa27x.c +++ b/drivers/usb/host/ohci-pxa27x.c @@ -26,18 +26,12 @@ #include #include #include - - -#define PMM_NPS_MODE 1 -#define PMM_GLOBAL_MODE 2 -#define PMM_PERPORT_MODE 3 +#include #define PXA_UHC_MAX_PORTNUM 3 #define UHCRHPS(x) __REG2( 0x4C000050, (x)<<2 ) -static int pxa27x_ohci_pmm_state; - /* PMM_NPS_MODE -- PMM Non-power switching mode Ports are powered continuously. @@ -50,8 +44,6 @@ static int pxa27x_ohci_pmm_state; */ static int pxa27x_ohci_select_pmm( int mode ) { - pxa27x_ohci_pmm_state = mode; - switch ( mode ) { case PMM_NPS_MODE: UHCRHDA |= RH_A_NPS; @@ -71,7 +63,6 @@ static int pxa27x_ohci_select_pmm( int mode ) "Invalid mode %d, set to non-power switch mode.\n", mode ); - pxa27x_ohci_pmm_state = PMM_NPS_MODE; UHCRHDA |= RH_A_NPS; } @@ -82,8 +73,13 @@ extern int usb_disabled(void); /*-------------------------------------------------------------------------*/ -static void pxa27x_start_hc(struct platform_device *dev) +static int pxa27x_start_hc(struct device *dev) { + int retval = 0; + struct pxaohci_platform_data *inf; + + inf = dev->platform_data; + pxa_set_cken(CKEN10_USBHOST, 1); UHCHR |= UHCHR_FHR; @@ -94,21 +90,11 @@ static void pxa27x_start_hc(struct platform_device *dev) while (UHCHR & UHCHR_FSBIR) cpu_relax(); - /* This could be properly abstracted away through the - device data the day more machines are supported and - their differences can be figured out correctly. */ - if (machine_is_mainstone()) { - /* setup Port1 GPIO pin. */ - pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */ - pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */ - - /* Set the Power Control Polarity Low and Power Sense - Polarity Low to active low. Supply power to USB ports. */ - UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) & - ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE); + if (inf->init) + retval = inf->init(dev); - pxa27x_ohci_pmm_state = PMM_PERPORT_MODE; - } + if (retval < 0) + return retval; UHCHR &= ~UHCHR_SSE; @@ -117,10 +103,19 @@ static void pxa27x_start_hc(struct platform_device *dev) /* Clear any OTG Pin Hold */ if (PSSR & PSSR_OTGPH) PSSR |= PSSR_OTGPH; + + return 0; } -static void pxa27x_stop_hc(struct platform_device *dev) +static void pxa27x_stop_hc(struct device *dev) { + struct pxaohci_platform_data *inf; + + inf = dev->platform_data; + + if (inf->exit) + inf->exit(dev); + UHCHR |= UHCHR_FHR; udelay(11); UHCHR &= ~UHCHR_FHR; @@ -147,22 +142,27 @@ static void pxa27x_stop_hc(struct platform_device *dev) * through the hotplug entry's driver_data. * */ -int usb_hcd_pxa27x_probe (const struct hc_driver *driver, - struct platform_device *dev) +int usb_hcd_pxa27x_probe (const struct hc_driver *driver, struct platform_device *pdev) { int retval; struct usb_hcd *hcd; + struct pxaohci_platform_data *inf; + + inf = pdev->dev.platform_data; - if (dev->resource[1].flags != IORESOURCE_IRQ) { + if (!inf) + return -ENODEV; + + if (pdev->resource[1].flags != IORESOURCE_IRQ) { pr_debug ("resource[1] is not IORESOURCE_IRQ"); return -ENOMEM; } - hcd = usb_create_hcd (driver, &dev->dev, "pxa27x"); + hcd = usb_create_hcd (driver, &pdev->dev, "pxa27x"); if (!hcd) return -ENOMEM; - hcd->rsrc_start = dev->resource[0].start; - hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; + hcd->rsrc_start = pdev->resource[0].start; + hcd->rsrc_len = pdev->resource[0].end - pdev->resource[0].start + 1; if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { pr_debug("request_mem_region failed"); @@ -177,18 +177,22 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, goto err2; } - pxa27x_start_hc(dev); + if ((retval = pxa27x_start_hc(&pdev->dev)) < 0) { + pr_debug("pxa27x_start_hc failed"); + goto err3; + } /* Select Power Management Mode */ - pxa27x_ohci_select_pmm(pxa27x_ohci_pmm_state); + pxa27x_ohci_select_pmm(inf->port_mode); ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); + retval = usb_add_hcd(hcd, pdev->resource[1].start, SA_INTERRUPT); if (retval == 0) return retval; - pxa27x_stop_hc(dev); + pxa27x_stop_hc(&pdev->dev); + err3: iounmap(hcd->regs); err2: release_mem_region(hcd->rsrc_start, hcd->rsrc_len); @@ -211,10 +215,10 @@ int usb_hcd_pxa27x_probe (const struct hc_driver *driver, * context, normally "rmmod", "apmd", or something similar. * */ -void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *dev) +void usb_hcd_pxa27x_remove (struct usb_hcd *hcd, struct platform_device *pdev) { usb_remove_hcd(hcd); - pxa27x_stop_hc(dev); + pxa27x_stop_hc(&pdev->dev); iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); usb_put_hcd(hcd); @@ -292,15 +296,12 @@ static const struct hc_driver ohci_pxa27x_hc_driver = { static int ohci_hcd_pxa27x_drv_probe(struct platform_device *pdev) { - int ret; - pr_debug ("In ohci_hcd_pxa27x_drv_probe"); if (usb_disabled()) return -ENODEV; - ret = usb_hcd_pxa27x_probe(&ohci_pxa27x_hc_driver, pdev); - return ret; + return usb_hcd_pxa27x_probe(&ohci_pxa27x_hc_driver, pdev); } static int ohci_hcd_pxa27x_drv_remove(struct platform_device *pdev) diff --git a/include/asm-arm/arch-pxa/ohci.h b/include/asm-arm/arch-pxa/ohci.h new file mode 100644 index 000000000000..7da89569061e --- /dev/null +++ b/include/asm-arm/arch-pxa/ohci.h @@ -0,0 +1,18 @@ +#ifndef ASMARM_ARCH_OHCI_H +#define ASMARM_ARCH_OHCI_H + +struct device; + +struct pxaohci_platform_data { + int (*init)(struct device *); + void (*exit)(struct device *); + + int port_mode; +#define PMM_NPS_MODE 1 +#define PMM_GLOBAL_MODE 2 +#define PMM_PERPORT_MODE 3 +}; + +extern void pxa_set_ohci_info(struct pxaohci_platform_data *info); + +#endif -- cgit v1.2.3 From 312c004d36ce6c739512bac83b452f4c20ab1f62 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Wed, 16 Nov 2005 09:00:00 +0100 Subject: [PATCH] driver core: replace "hotplug" by "uevent" Leave the overloaded "hotplug" word to susbsystems which are handling real devices. The driver core does not "plug" anything, it just exports the state to userspace and generates events. Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- Documentation/powerpc/eeh-pci-error-recovery.txt | 31 ++++----- arch/powerpc/kernel/vio.c | 2 +- block/genhd.c | 48 ++++++------- drivers/acpi/container.c | 8 +-- drivers/acpi/processor_core.c | 8 +-- drivers/acpi/scan.c | 14 ++-- drivers/base/Kconfig | 4 +- drivers/base/class.c | 66 +++++++++--------- drivers/base/core.c | 42 ++++++------ drivers/base/cpu.c | 4 +- drivers/base/firmware_class.c | 45 ++++++------- drivers/base/memory.c | 12 ++-- drivers/ieee1394/nodemgr.c | 20 +++--- drivers/infiniband/core/sysfs.c | 16 ++--- drivers/input/input.c | 14 ++-- drivers/input/serio/serio.c | 22 +++--- drivers/macintosh/macio_asic.c | 4 +- drivers/mmc/mmc_sysfs.c | 4 +- drivers/pci/hotplug.c | 44 ++++++------ drivers/pci/pci-driver.c | 6 +- drivers/pci/pci.h | 4 +- drivers/pcmcia/cs.c | 10 +-- drivers/pcmcia/ds.c | 50 +++++++------- drivers/scsi/ipr.c | 2 +- drivers/usb/core/usb.c | 86 +++++++++++------------- drivers/usb/host/hc_crisv10.c | 2 +- drivers/w1/w1.c | 14 ++-- fs/partitions/check.c | 6 +- include/linux/device.h | 14 ++-- include/linux/firmware.h | 2 +- include/linux/kobject.h | 40 ++++++----- include/linux/sysctl.h | 2 +- include/linux/usb.h | 2 +- kernel/ksysfs.c | 14 ++-- kernel/sysctl.c | 4 +- lib/kobject.c | 4 +- lib/kobject_uevent.c | 64 +++++++++--------- net/bluetooth/hci_sysfs.c | 4 +- net/bridge/br_sysfs_if.c | 4 +- net/core/net-sysfs.c | 8 +-- 40 files changed, 372 insertions(+), 378 deletions(-) (limited to 'arch') diff --git a/Documentation/powerpc/eeh-pci-error-recovery.txt b/Documentation/powerpc/eeh-pci-error-recovery.txt index e75d7474322c..67a11a36270c 100644 --- a/Documentation/powerpc/eeh-pci-error-recovery.txt +++ b/Documentation/powerpc/eeh-pci-error-recovery.txt @@ -115,7 +115,7 @@ Current PPC64 Linux EEH Implementation At this time, a generic EEH recovery mechanism has been implemented, so that individual device drivers do not need to be modified to support EEH recovery. This generic mechanism piggy-backs on the PCI hotplug -infrastructure, and percolates events up through the hotplug/udev +infrastructure, and percolates events up through the userspace/udev infrastructure. Followiing is a detailed description of how this is accomplished. @@ -172,7 +172,7 @@ A handler for the EEH notifier_block events is implemented in drivers/pci/hotplug/pSeries_pci.c, called handle_eeh_events(). It saves the device BAR's and then calls rpaphp_unconfig_pci_adapter(). This last call causes the device driver for the card to be stopped, -which causes hotplug events to go out to user space. This triggers +which causes uevents to go out to user space. This triggers user-space scripts that might issue commands such as "ifdown eth0" for ethernet cards, and so on. This handler then sleeps for 5 seconds, hoping to give the user-space scripts enough time to complete. @@ -258,29 +258,30 @@ rpa_php_unconfig_pci_adapter() { // in rpaphp_pci.c calls pci_destroy_dev (struct pci_dev *) { calls - device_unregister (&dev->dev) { // in /drivers/base/core.c + device_unregister (&dev->dev) { // in /drivers/base/core.c calls - device_del(struct device * dev) { // in /drivers/base/core.c + device_del(struct device * dev) { // in /drivers/base/core.c calls - kobject_del() { //in /libs/kobject.c + kobject_del() { //in /libs/kobject.c calls - kobject_hotplug() { // in /libs/kobject.c + kobject_uevent() { // in /libs/kobject.c calls - kset_hotplug() { // in /lib/kobject.c + kset_uevent() { // in /lib/kobject.c calls - kset->hotplug_ops->hotplug() which is really just + kset->uevent_ops->uevent() // which is really just a call to - dev_hotplug() { // in /drivers/base/core.c + dev_uevent() { // in /drivers/base/core.c calls - dev->bus->hotplug() which is really just a call to - pci_hotplug () { // in drivers/pci/hotplug.c + dev->bus->uevent() which is really just a call to + pci_uevent () { // in drivers/pci/hotplug.c which prints device name, etc.... } } - then kset_hotplug() calls - call_usermodehelper () with - argv[0]=hotplug_path[] which is "/sbin/hotplug" - --> event to userspace, + then kobject_uevent() sends a netlink uevent to userspace + --> userspace uevent + (during early boot, nobody listens to netlink events and + kobject_uevent() executes uevent_helper[], which runs the + event process /sbin/hotplug) } } kobject_del() then calls sysfs_remove_dir(), which would diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c index 71a6addf9f7f..13c41495fe06 100644 --- a/arch/powerpc/kernel/vio.c +++ b/arch/powerpc/kernel/vio.c @@ -293,6 +293,6 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp, struct bus_type vio_bus_type = { .name = "vio", - .hotplug = vio_hotplug, + .uevent = vio_hotplug, .match = vio_bus_match, }; diff --git a/block/genhd.c b/block/genhd.c index f04609d553b8..f1ed83f3f083 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -358,7 +358,7 @@ static struct sysfs_ops disk_sysfs_ops = { static ssize_t disk_uevent_store(struct gendisk * disk, const char *buf, size_t count) { - kobject_hotplug(&disk->kobj, KOBJ_ADD); + kobject_uevent(&disk->kobj, KOBJ_ADD); return count; } static ssize_t disk_dev_read(struct gendisk * disk, char *page) @@ -455,14 +455,14 @@ static struct kobj_type ktype_block = { extern struct kobj_type ktype_part; -static int block_hotplug_filter(struct kset *kset, struct kobject *kobj) +static int block_uevent_filter(struct kset *kset, struct kobject *kobj) { struct kobj_type *ktype = get_ktype(kobj); return ((ktype == &ktype_block) || (ktype == &ktype_part)); } -static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp, +static int block_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { struct kobj_type *ktype = get_ktype(kobj); @@ -474,40 +474,40 @@ static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp, if (ktype == &ktype_block) { disk = container_of(kobj, struct gendisk, kobj); - add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, - &length, "MINOR=%u", disk->first_minor); + add_uevent_var(envp, num_envp, &i, buffer, buffer_size, + &length, "MINOR=%u", disk->first_minor); } else if (ktype == &ktype_part) { disk = container_of(kobj->parent, struct gendisk, kobj); part = container_of(kobj, struct hd_struct, kobj); - add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, - &length, "MINOR=%u", - disk->first_minor + part->partno); + add_uevent_var(envp, num_envp, &i, buffer, buffer_size, + &length, "MINOR=%u", + disk->first_minor + part->partno); } else return 0; - add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &length, - "MAJOR=%u", disk->major); + add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &length, + "MAJOR=%u", disk->major); /* add physical device, backing this device */ physdev = disk->driverfs_dev; if (physdev) { char *path = kobject_get_path(&physdev->kobj, GFP_KERNEL); - add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, - &length, "PHYSDEVPATH=%s", path); + add_uevent_var(envp, num_envp, &i, buffer, buffer_size, + &length, "PHYSDEVPATH=%s", path); kfree(path); if (physdev->bus) - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVBUS=%s", - physdev->bus->name); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", + physdev->bus->name); if (physdev->driver) - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVDRIVER=%s", - physdev->driver->name); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", + physdev->driver->name); } /* terminate, set to next free slot, shrink available space */ @@ -520,13 +520,13 @@ static int block_hotplug(struct kset *kset, struct kobject *kobj, char **envp, return 0; } -static struct kset_hotplug_ops block_hotplug_ops = { - .filter = block_hotplug_filter, - .hotplug = block_hotplug, +static struct kset_uevent_ops block_uevent_ops = { + .filter = block_uevent_filter, + .uevent = block_uevent, }; /* declare block_subsys. */ -static decl_subsys(block, &ktype_block, &block_hotplug_ops); +static decl_subsys(block, &ktype_block, &block_uevent_ops); /* diff --git a/drivers/acpi/container.c b/drivers/acpi/container.c index 27ec12c1fab0..b69a8cad82b7 100644 --- a/drivers/acpi/container.c +++ b/drivers/acpi/container.c @@ -172,21 +172,21 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context) if (ACPI_FAILURE(status) || !device) { result = container_device_add(&device, handle); if (!result) - kobject_hotplug(&device->kobj, - KOBJ_ONLINE); + kobject_uevent(&device->kobj, + KOBJ_ONLINE); else printk("Failed to add container\n"); } } else { if (ACPI_SUCCESS(status)) { /* device exist and this is a remove request */ - kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + kobject_uevent(&device->kobj, KOBJ_OFFLINE); } } break; case ACPI_NOTIFY_EJECT_REQUEST: if (!acpi_bus_get_device(handle, &device) && device) { - kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + kobject_uevent(&device->kobj, KOBJ_OFFLINE); } break; default: diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 0c561c571f29..1278aca96fe3 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c @@ -748,7 +748,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) return_VALUE(-ENODEV); if ((pr->id >= 0) && (pr->id < NR_CPUS)) { - kobject_hotplug(&(*device)->kobj, KOBJ_ONLINE); + kobject_uevent(&(*device)->kobj, KOBJ_ONLINE); } return_VALUE(0); } @@ -788,13 +788,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) } if (pr->id >= 0 && (pr->id < NR_CPUS)) { - kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + kobject_uevent(&device->kobj, KOBJ_OFFLINE); break; } result = acpi_processor_start(device); if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { - kobject_hotplug(&device->kobj, KOBJ_ONLINE); + kobject_uevent(&device->kobj, KOBJ_ONLINE); } else { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Device [%s] failed to start\n", @@ -818,7 +818,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) } if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) - kobject_hotplug(&device->kobj, KOBJ_OFFLINE); + kobject_uevent(&device->kobj, KOBJ_OFFLINE); break; default: ACPI_DEBUG_PRINT((ACPI_DB_INFO, diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 31218e1d2a18..0745d20afb8c 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -78,7 +78,7 @@ static struct kobj_type ktype_acpi_ns = { .release = acpi_device_release, }; -static int namespace_hotplug(struct kset *kset, struct kobject *kobj, +static int namespace_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { @@ -89,8 +89,8 @@ static int namespace_hotplug(struct kset *kset, struct kobject *kobj, if (!dev->driver) return 0; - if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, - "PHYSDEVDRIVER=%s", dev->driver->name)) + if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len, + "PHYSDEVDRIVER=%s", dev->driver->name)) return -ENOMEM; envp[i] = NULL; @@ -98,8 +98,8 @@ static int namespace_hotplug(struct kset *kset, struct kobject *kobj, return 0; } -static struct kset_hotplug_ops namespace_hotplug_ops = { - .hotplug = &namespace_hotplug, +static struct kset_uevent_ops namespace_uevent_ops = { + .uevent = &namespace_uevent, }; static struct kset acpi_namespace_kset = { @@ -108,7 +108,7 @@ static struct kset acpi_namespace_kset = { }, .subsys = &acpi_subsys, .ktype = &ktype_acpi_ns, - .hotplug_ops = &namespace_hotplug_ops, + .uevent_ops = &namespace_uevent_ops, }; static void acpi_device_register(struct acpi_device *device, @@ -347,7 +347,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device) } /* -------------------------------------------------------------------------- - ACPI hotplug sysfs device file support + ACPI sysfs device file support -------------------------------------------------------------------------- */ static ssize_t acpi_eject_store(struct acpi_device *device, const char *buf, size_t count); diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 934149c1512b..f0eff3dac58d 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -19,11 +19,11 @@ config PREVENT_FIRMWARE_BUILD If unsure say Y here. config FW_LOADER - tristate "Hotplug firmware loading support" + tristate "Userspace firmware loading support" select HOTPLUG ---help--- This option is provided for the case where no in-kernel-tree modules - require hotplug firmware loading support, but a module built outside + require userspace firmware loading support, but a module built outside the kernel tree does. config DEBUG_DRIVER diff --git a/drivers/base/class.c b/drivers/base/class.c index db65fd0babe9..df7fdabd0730 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c @@ -178,7 +178,7 @@ static void class_device_create_release(struct class_device *class_dev) } /* needed to allow these devices to have parent class devices */ -static int class_device_create_hotplug(struct class_device *class_dev, +static int class_device_create_uevent(struct class_device *class_dev, char **envp, int num_envp, char *buffer, int buffer_size) { @@ -331,7 +331,7 @@ static struct kobj_type ktype_class_device = { .release = class_dev_release, }; -static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) +static int class_uevent_filter(struct kset *kset, struct kobject *kobj) { struct kobj_type *ktype = get_ktype(kobj); @@ -343,14 +343,14 @@ static int class_hotplug_filter(struct kset *kset, struct kobject *kobj) return 0; } -static const char *class_hotplug_name(struct kset *kset, struct kobject *kobj) +static const char *class_uevent_name(struct kset *kset, struct kobject *kobj) { struct class_device *class_dev = to_class_dev(kobj); return class_dev->class->name; } -static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp, +static int class_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { struct class_device *class_dev = to_class_dev(kobj); @@ -365,29 +365,29 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp, struct device *dev = class_dev->dev; char *path = kobject_get_path(&dev->kobj, GFP_KERNEL); - add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, - &length, "PHYSDEVPATH=%s", path); + add_uevent_var(envp, num_envp, &i, buffer, buffer_size, + &length, "PHYSDEVPATH=%s", path); kfree(path); if (dev->bus) - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVBUS=%s", dev->bus->name); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); if (dev->driver) - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVDRIVER=%s", dev->driver->name); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); } if (MAJOR(class_dev->devt)) { - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "MAJOR=%u", MAJOR(class_dev->devt)); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MAJOR=%u", MAJOR(class_dev->devt)); - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "MINOR=%u", MINOR(class_dev->devt)); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MINOR=%u", MINOR(class_dev->devt)); } /* terminate, set to next free slot, shrink available space */ @@ -397,30 +397,30 @@ static int class_hotplug(struct kset *kset, struct kobject *kobj, char **envp, buffer = &buffer[length]; buffer_size -= length; - if (class_dev->hotplug) { + if (class_dev->uevent) { /* have the class device specific function add its stuff */ - retval = class_dev->hotplug(class_dev, envp, num_envp, + retval = class_dev->uevent(class_dev, envp, num_envp, buffer, buffer_size); if (retval) - pr_debug("class_dev->hotplug() returned %d\n", retval); - } else if (class_dev->class->hotplug) { + pr_debug("class_dev->uevent() returned %d\n", retval); + } else if (class_dev->class->uevent) { /* have the class specific function add its stuff */ - retval = class_dev->class->hotplug(class_dev, envp, num_envp, + retval = class_dev->class->uevent(class_dev, envp, num_envp, buffer, buffer_size); if (retval) - pr_debug("class->hotplug() returned %d\n", retval); + pr_debug("class->uevent() returned %d\n", retval); } return retval; } -static struct kset_hotplug_ops class_hotplug_ops = { - .filter = class_hotplug_filter, - .name = class_hotplug_name, - .hotplug = class_hotplug, +static struct kset_uevent_ops class_uevent_ops = { + .filter = class_uevent_filter, + .name = class_uevent_name, + .uevent = class_uevent, }; -static decl_subsys(class_obj, &ktype_class_device, &class_hotplug_ops); +static decl_subsys(class_obj, &ktype_class_device, &class_uevent_ops); static int class_device_add_attrs(struct class_device * cd) @@ -464,7 +464,7 @@ static ssize_t show_dev(struct class_device *class_dev, char *buf) static ssize_t store_uevent(struct class_device *class_dev, const char *buf, size_t count) { - kobject_hotplug(&class_dev->kobj, KOBJ_ADD); + kobject_uevent(&class_dev->kobj, KOBJ_ADD); return count; } @@ -559,7 +559,7 @@ int class_device_add(struct class_device *class_dev) class_name); } - kobject_hotplug(&class_dev->kobj, KOBJ_ADD); + kobject_uevent(&class_dev->kobj, KOBJ_ADD); /* notify any interfaces this device is now here */ if (parent_class) { @@ -632,7 +632,7 @@ struct class_device *class_device_create(struct class *cls, class_dev->class = cls; class_dev->parent = parent; class_dev->release = class_device_create_release; - class_dev->hotplug = class_device_create_hotplug; + class_dev->uevent = class_device_create_uevent; va_start(args, fmt); vsnprintf(class_dev->class_id, BUS_ID_SIZE, fmt, args); @@ -674,7 +674,7 @@ void class_device_del(struct class_device *class_dev) class_device_remove_file(class_dev, class_dev->devt_attr); class_device_remove_attrs(class_dev); - kobject_hotplug(&class_dev->kobj, KOBJ_REMOVE); + kobject_uevent(&class_dev->kobj, KOBJ_REMOVE); kobject_del(&class_dev->kobj); class_device_put(parent_device); diff --git a/drivers/base/core.c b/drivers/base/core.c index 8615b42b517a..fd8059920dbf 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -90,7 +90,7 @@ static struct kobj_type ktype_device = { }; -static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj) +static int dev_uevent_filter(struct kset *kset, struct kobject *kobj) { struct kobj_type *ktype = get_ktype(kobj); @@ -102,14 +102,14 @@ static int dev_hotplug_filter(struct kset *kset, struct kobject *kobj) return 0; } -static const char *dev_hotplug_name(struct kset *kset, struct kobject *kobj) +static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj) { struct device *dev = to_dev(kobj); return dev->bus->name; } -static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, +static int dev_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { struct device *dev = to_dev(kobj); @@ -119,15 +119,15 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, /* add bus name of physical device */ if (dev->bus) - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVBUS=%s", dev->bus->name); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVBUS=%s", dev->bus->name); /* add driver name of physical device */ if (dev->driver) - add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PHYSDEVDRIVER=%s", dev->driver->name); + add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PHYSDEVDRIVER=%s", dev->driver->name); /* terminate, set to next free slot, shrink available space */ envp[i] = NULL; @@ -136,11 +136,11 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, buffer = &buffer[length]; buffer_size -= length; - if (dev->bus && dev->bus->hotplug) { + if (dev->bus && dev->bus->uevent) { /* have the bus specific function add its stuff */ - retval = dev->bus->hotplug (dev, envp, num_envp, buffer, buffer_size); + retval = dev->bus->uevent(dev, envp, num_envp, buffer, buffer_size); if (retval) { - pr_debug ("%s - hotplug() returned %d\n", + pr_debug ("%s - uevent() returned %d\n", __FUNCTION__, retval); } } @@ -148,16 +148,16 @@ static int dev_hotplug(struct kset *kset, struct kobject *kobj, char **envp, return retval; } -static struct kset_hotplug_ops device_hotplug_ops = { - .filter = dev_hotplug_filter, - .name = dev_hotplug_name, - .hotplug = dev_hotplug, +static struct kset_uevent_ops device_uevent_ops = { + .filter = dev_uevent_filter, + .name = dev_uevent_name, + .uevent = dev_uevent, }; static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - kobject_hotplug(&dev->kobj, KOBJ_ADD); + kobject_uevent(&dev->kobj, KOBJ_ADD); return count; } @@ -165,7 +165,7 @@ static ssize_t store_uevent(struct device *dev, struct device_attribute *attr, * device_subsys - structure to be registered with kobject core. */ -decl_subsys(devices, &ktype_device, &device_hotplug_ops); +decl_subsys(devices, &ktype_device, &device_uevent_ops); /** @@ -274,7 +274,7 @@ int device_add(struct device *dev) dev->uevent_attr.store = store_uevent; device_create_file(dev, &dev->uevent_attr); - kobject_hotplug(&dev->kobj, KOBJ_ADD); + kobject_uevent(&dev->kobj, KOBJ_ADD); if ((error = device_pm_add(dev))) goto PMError; if ((error = bus_add_device(dev))) @@ -291,7 +291,7 @@ int device_add(struct device *dev) BusError: device_pm_remove(dev); PMError: - kobject_hotplug(&dev->kobj, KOBJ_REMOVE); + kobject_uevent(&dev->kobj, KOBJ_REMOVE); kobject_del(&dev->kobj); Error: if (parent) @@ -374,7 +374,7 @@ void device_del(struct device * dev) platform_notify_remove(dev); bus_remove_device(dev); device_pm_remove(dev); - kobject_hotplug(&dev->kobj, KOBJ_REMOVE); + kobject_uevent(&dev->kobj, KOBJ_REMOVE); kobject_del(&dev->kobj); if (parent) put_device(parent); diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index a95844790f7b..281d26784d25 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -41,14 +41,14 @@ static ssize_t store_online(struct sys_device *dev, const char *buf, case '0': ret = cpu_down(cpu->sysdev.id); if (!ret) - kobject_hotplug(&dev->kobj, KOBJ_OFFLINE); + kobject_uevent(&dev->kobj, KOBJ_OFFLINE); break; case '1': ret = smp_prepare_cpu(cpu->sysdev.id); if (!ret) ret = cpu_up(cpu->sysdev.id); if (!ret) - kobject_hotplug(&dev->kobj, KOBJ_ONLINE); + kobject_uevent(&dev->kobj, KOBJ_ONLINE); break; default: ret = -EINVAL; diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index 59dacb6552c0..5b3d5e9ddcb6 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c @@ -85,17 +85,17 @@ firmware_timeout_store(struct class *class, const char *buf, size_t count) static CLASS_ATTR(timeout, 0644, firmware_timeout_show, firmware_timeout_store); static void fw_class_dev_release(struct class_device *class_dev); -int firmware_class_hotplug(struct class_device *dev, char **envp, +int firmware_class_uevent(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size); static struct class firmware_class = { .name = "firmware", - .hotplug = firmware_class_hotplug, + .uevent = firmware_class_uevent, .release = fw_class_dev_release, }; int -firmware_class_hotplug(struct class_device *class_dev, char **envp, +firmware_class_uevent(struct class_device *class_dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct firmware_priv *fw_priv = class_get_devdata(class_dev); @@ -104,13 +104,12 @@ firmware_class_hotplug(struct class_device *class_dev, char **envp, if (!test_bit(FW_STATUS_READY, &fw_priv->status)) return -ENODEV; - if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, - "FIRMWARE=%s", fw_priv->fw_id)) + if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len, + "FIRMWARE=%s", fw_priv->fw_id)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, &len, - "TIMEOUT=%i", loading_timeout)) + if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, &len, + "TIMEOUT=%i", loading_timeout)) return -ENOMEM; - envp[i] = NULL; return 0; @@ -352,7 +351,7 @@ error_kfree: static int fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, - const char *fw_name, struct device *device, int hotplug) + const char *fw_name, struct device *device, int uevent) { struct class_device *class_dev; struct firmware_priv *fw_priv; @@ -384,7 +383,7 @@ fw_setup_class_device(struct firmware *fw, struct class_device **class_dev_p, goto error_unreg; } - if (hotplug) + if (uevent) set_bit(FW_STATUS_READY, &fw_priv->status); else set_bit(FW_STATUS_READY_NOHOTPLUG, &fw_priv->status); @@ -399,7 +398,7 @@ out: static int _request_firmware(const struct firmware **firmware_p, const char *name, - struct device *device, int hotplug) + struct device *device, int uevent) { struct class_device *class_dev; struct firmware_priv *fw_priv; @@ -418,19 +417,19 @@ _request_firmware(const struct firmware **firmware_p, const char *name, } retval = fw_setup_class_device(firmware, &class_dev, name, device, - hotplug); + uevent); if (retval) goto error_kfree_fw; fw_priv = class_get_devdata(class_dev); - if (hotplug) { + if (uevent) { if (loading_timeout > 0) { fw_priv->timeout.expires = jiffies + loading_timeout * HZ; add_timer(&fw_priv->timeout); } - kobject_hotplug(&class_dev->kobj, KOBJ_ADD); + kobject_uevent(&class_dev->kobj, KOBJ_ADD); wait_for_completion(&fw_priv->completion); set_bit(FW_STATUS_DONE, &fw_priv->status); del_timer_sync(&fw_priv->timeout); @@ -456,7 +455,7 @@ out: } /** - * request_firmware: - request firmware to hotplug and wait for it + * request_firmware: - send firmware request and wait for it * @firmware_p: pointer to firmware image * @name: name of firmware file * @device: device for which firmware is being loaded @@ -466,7 +465,7 @@ out: * * Should be called from user context where sleeping is allowed. * - * @name will be used as $FIRMWARE in the hotplug environment and + * @name will be used as $FIRMWARE in the uevent environment and * should be distinctive enough not to be confused with any other * firmware image for this or any other device. **/ @@ -474,8 +473,8 @@ int request_firmware(const struct firmware **firmware_p, const char *name, struct device *device) { - int hotplug = 1; - return _request_firmware(firmware_p, name, device, hotplug); + int uevent = 1; + return _request_firmware(firmware_p, name, device, uevent); } /** @@ -518,7 +517,7 @@ struct firmware_work { struct device *device; void *context; void (*cont)(const struct firmware *fw, void *context); - int hotplug; + int uevent; }; static int @@ -533,7 +532,7 @@ request_firmware_work_func(void *arg) } daemonize("%s/%s", "firmware", fw_work->name); ret = _request_firmware(&fw, fw_work->name, fw_work->device, - fw_work->hotplug); + fw_work->uevent); if (ret < 0) fw_work->cont(NULL, fw_work->context); else { @@ -548,7 +547,7 @@ request_firmware_work_func(void *arg) /** * request_firmware_nowait: asynchronous version of request_firmware * @module: module requesting the firmware - * @hotplug: invokes hotplug event to copy the firmware image if this flag + * @uevent: sends uevent to copy the firmware image if this flag * is non-zero else the firmware copy must be done manually. * @name: name of firmware file * @device: device for which firmware is being loaded @@ -562,7 +561,7 @@ request_firmware_work_func(void *arg) **/ int request_firmware_nowait( - struct module *module, int hotplug, + struct module *module, int uevent, const char *name, struct device *device, void *context, void (*cont)(const struct firmware *fw, void *context)) { @@ -583,7 +582,7 @@ request_firmware_nowait( .device = device, .context = context, .cont = cont, - .hotplug = hotplug, + .uevent = uevent, }; ret = kernel_thread(request_firmware_work_func, fw_work, diff --git a/drivers/base/memory.c b/drivers/base/memory.c index bc3ca6a656b2..7e1d077874df 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -29,12 +29,12 @@ static struct sysdev_class memory_sysdev_class = { set_kset_name(MEMORY_CLASS_NAME), }; -static char *memory_hotplug_name(struct kset *kset, struct kobject *kobj) +static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj) { return MEMORY_CLASS_NAME; } -static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp, +static int memory_uevent(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size) { int retval = 0; @@ -42,9 +42,9 @@ static int memory_hotplug(struct kset *kset, struct kobject *kobj, char **envp, return retval; } -static struct kset_hotplug_ops memory_hotplug_ops = { - .name = memory_hotplug_name, - .hotplug = memory_hotplug, +static struct kset_uevent_ops memory_uevent_ops = { + .name = memory_uevent_name, + .uevent = memory_uevent, }; static struct notifier_block *memory_chain; @@ -431,7 +431,7 @@ int __init memory_dev_init(void) unsigned int i; int ret; - memory_sysdev_class.kset.hotplug_ops = &memory_hotplug_ops; + memory_sysdev_class.kset.uevent_ops = &memory_uevent_ops; ret = sysdev_class_register(&memory_sysdev_class); /* diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c index 0ea37b1bccb2..f2453668acf5 100644 --- a/drivers/ieee1394/nodemgr.c +++ b/drivers/ieee1394/nodemgr.c @@ -121,8 +121,8 @@ struct host_info { }; static int nodemgr_bus_match(struct device * dev, struct device_driver * drv); -static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp, - char *buffer, int buffer_size); +static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, + char *buffer, int buffer_size); static void nodemgr_resume_ne(struct node_entry *ne); static void nodemgr_remove_ne(struct node_entry *ne); static struct node_entry *find_entry_by_guid(u64 guid); @@ -162,7 +162,7 @@ static void ud_cls_release(struct class_device *class_dev) static struct class nodemgr_ud_class = { .name = "ieee1394", .release = ud_cls_release, - .hotplug = nodemgr_hotplug, + .uevent = nodemgr_uevent, }; static struct hpsb_highlevel nodemgr_highlevel; @@ -966,7 +966,7 @@ static struct unit_directory *nodemgr_process_unit_directory if (ud_child == NULL) break; - /* inherit unspecified values so hotplug picks it up */ + /* inherit unspecified values, the driver core picks it up */ if ((ud->flags & UNIT_DIRECTORY_MODEL_ID) && !(ud_child->flags & UNIT_DIRECTORY_MODEL_ID)) { @@ -1062,8 +1062,8 @@ static void nodemgr_process_root_directory(struct host_info *hi, struct node_ent #ifdef CONFIG_HOTPLUG -static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp, - char *buffer, int buffer_size) +static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, + char *buffer, int buffer_size) { struct unit_directory *ud; int i = 0; @@ -1112,8 +1112,8 @@ do { \ #else -static int nodemgr_hotplug(struct class_device *cdev, char **envp, int num_envp, - char *buffer, int buffer_size) +static int nodemgr_uevent(struct class_device *cdev, char **envp, int num_envp, + char *buffer, int buffer_size) { return -ENODEV; } @@ -1618,8 +1618,8 @@ static int nodemgr_host_thread(void *__hi) /* Scan our nodes to get the bus options and create node * entries. This does not do the sysfs stuff, since that - * would trigger hotplug callbacks and such, which is a - * bad idea at this point. */ + * would trigger uevents and such, which is a bad idea at + * this point. */ nodemgr_node_scan(hi, generation); /* This actually does the full probe, with sysfs diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c index 08648b1a387e..1f1743c5c9a3 100644 --- a/drivers/infiniband/core/sysfs.c +++ b/drivers/infiniband/core/sysfs.c @@ -434,24 +434,24 @@ static void ib_device_release(struct class_device *cdev) kfree(dev); } -static int ib_device_hotplug(struct class_device *cdev, char **envp, - int num_envp, char *buf, int size) +static int ib_device_uevent(struct class_device *cdev, char **envp, + int num_envp, char *buf, int size) { struct ib_device *dev = container_of(cdev, struct ib_device, class_dev); int i = 0, len = 0; - if (add_hotplug_env_var(envp, num_envp, &i, buf, size, &len, - "NAME=%s", dev->name)) + if (add_uevent_var(envp, num_envp, &i, buf, size, &len, + "NAME=%s", dev->name)) return -ENOMEM; /* - * It might be nice to pass the node GUID to hotplug, but + * It might be nice to pass the node GUID with the event, but * right now the only way to get it is to query the device * provider, and this can crash during device removal because * we are will be running after driver removal has started. * We could add a node_guid field to struct ib_device, or we - * could just let the hotplug script read the node GUID from - * sysfs when devices are added. + * could just let userspace read the node GUID from sysfs when + * devices are added. */ envp[i] = NULL; @@ -653,7 +653,7 @@ static struct class_device_attribute *ib_class_attributes[] = { static struct class ib_class = { .name = "infiniband", .release = ib_device_release, - .hotplug = ib_device_hotplug, + .uevent = ib_device_uevent, }; int ib_device_register_sysfs(struct ib_device *device) diff --git a/drivers/input/input.c b/drivers/input/input.c index 43b49ccd7dad..2d37b394e384 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -610,10 +610,10 @@ static void input_dev_release(struct class_device *class_dev) } /* - * Input hotplugging interface - loading event handlers based on + * Input uevent interface - loading event handlers based on * device bitfields. */ -static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index, +static int input_add_uevent_bm_var(char **envp, int num_envp, int *cur_index, char *buffer, int buffer_size, int *cur_len, const char *name, unsigned long *bitmap, int max) { @@ -638,7 +638,7 @@ static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index, #define INPUT_ADD_HOTPLUG_VAR(fmt, val...) \ do { \ - int err = add_hotplug_env_var(envp, num_envp, &i, \ + int err = add_uevent_var(envp, num_envp, &i, \ buffer, buffer_size, &len, \ fmt, val); \ if (err) \ @@ -647,15 +647,15 @@ static int input_add_hotplug_bm_var(char **envp, int num_envp, int *cur_index, #define INPUT_ADD_HOTPLUG_BM_VAR(name, bm, max) \ do { \ - int err = input_add_hotplug_bm_var(envp, num_envp, &i, \ + int err = input_add_uevent_bm_var(envp, num_envp, &i, \ buffer, buffer_size, &len, \ name, bm, max); \ if (err) \ return err; \ } while (0) -static int input_dev_hotplug(struct class_device *cdev, char **envp, - int num_envp, char *buffer, int buffer_size) +static int input_dev_uevent(struct class_device *cdev, char **envp, + int num_envp, char *buffer, int buffer_size) { struct input_dev *dev = to_input_dev(cdev); int i = 0; @@ -697,7 +697,7 @@ static int input_dev_hotplug(struct class_device *cdev, char **envp, struct class input_class = { .name = "input", .release = input_dev_release, - .hotplug = input_dev_hotplug, + .uevent = input_dev_uevent, }; struct input_dev *input_allocate_device(void) diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index fbb69ef6a77b..8e530cc970e1 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c @@ -800,16 +800,16 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv) #ifdef CONFIG_HOTPLUG -#define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \ +#define SERIO_ADD_UEVENT_VAR(fmt, val...) \ do { \ - int err = add_hotplug_env_var(envp, num_envp, &i, \ + int err = add_uevent_var(envp, num_envp, &i, \ buffer, buffer_size, &len, \ fmt, val); \ if (err) \ return err; \ } while (0) -static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) +static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct serio *serio; int i = 0; @@ -820,21 +820,21 @@ static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *bu serio = to_serio_port(dev); - SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type); - SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto); - SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id); - SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra); - SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", + SERIO_ADD_UEVENT_VAR("SERIO_TYPE=%02x", serio->id.type); + SERIO_ADD_UEVENT_VAR("SERIO_PROTO=%02x", serio->id.proto); + SERIO_ADD_UEVENT_VAR("SERIO_ID=%02x", serio->id.id); + SERIO_ADD_UEVENT_VAR("SERIO_EXTRA=%02x", serio->id.extra); + SERIO_ADD_UEVENT_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); envp[i] = NULL; return 0; } -#undef SERIO_ADD_HOTPLUG_VAR +#undef SERIO_ADD_UEVENT_VAR #else -static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) +static int serio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { return -ENODEV; } @@ -908,7 +908,7 @@ static int __init serio_init(void) serio_bus.dev_attrs = serio_device_attrs; serio_bus.drv_attrs = serio_driver_attrs; serio_bus.match = serio_bus_match; - serio_bus.hotplug = serio_hotplug; + serio_bus.uevent = serio_uevent; serio_bus.resume = serio_resume; bus_register(&serio_bus); diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c index c34c96d18907..228e1852a836 100644 --- a/drivers/macintosh/macio_asic.c +++ b/drivers/macintosh/macio_asic.c @@ -128,7 +128,7 @@ static int macio_device_resume(struct device * dev) return 0; } -static int macio_hotplug (struct device *dev, char **envp, int num_envp, +static int macio_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct macio_dev * macio_dev; @@ -203,7 +203,7 @@ extern struct device_attribute macio_dev_attrs[]; struct bus_type macio_bus_type = { .name = "macio", .match = macio_bus_match, - .hotplug = macio_hotplug, + .uevent = macio_uevent, .suspend = macio_device_suspend, .resume = macio_device_resume, .dev_attrs = macio_dev_attrs, diff --git a/drivers/mmc/mmc_sysfs.c b/drivers/mmc/mmc_sysfs.c index 3f4a66ca9555..ec701667abfc 100644 --- a/drivers/mmc/mmc_sysfs.c +++ b/drivers/mmc/mmc_sysfs.c @@ -80,7 +80,7 @@ static int mmc_bus_match(struct device *dev, struct device_driver *drv) } static int -mmc_bus_hotplug(struct device *dev, char **envp, int num_envp, char *buf, +mmc_bus_uevent(struct device *dev, char **envp, int num_envp, char *buf, int buf_size) { struct mmc_card *card = dev_to_mmc_card(dev); @@ -140,7 +140,7 @@ static struct bus_type mmc_bus_type = { .name = "mmc", .dev_attrs = mmc_dev_attrs, .match = mmc_bus_match, - .hotplug = mmc_bus_hotplug, + .uevent = mmc_bus_uevent, .suspend = mmc_bus_suspend, .resume = mmc_bus_resume, }; diff --git a/drivers/pci/hotplug.c b/drivers/pci/hotplug.c index e1743be31909..1c97e7dd130b 100644 --- a/drivers/pci/hotplug.c +++ b/drivers/pci/hotplug.c @@ -3,8 +3,8 @@ #include #include "pci.h" -int pci_hotplug (struct device *dev, char **envp, int num_envp, - char *buffer, int buffer_size) +int pci_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) { struct pci_dev *pdev; int i = 0; @@ -17,34 +17,34 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp, if (!pdev) return -ENODEV; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PCI_CLASS=%04X", pdev->class)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PCI_CLASS=%04X", pdev->class)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PCI_ID=%04X:%04X", pdev->vendor, pdev->device)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PCI_ID=%04X:%04X", pdev->vendor, pdev->device)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor, - pdev->subsystem_device)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PCI_SUBSYS_ID=%04X:%04X", pdev->subsystem_vendor, + pdev->subsystem_device)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PCI_SLOT_NAME=%s", pci_name(pdev))) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PCI_SLOT_NAME=%s", pci_name(pdev))) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", - pdev->vendor, pdev->device, - pdev->subsystem_vendor, pdev->subsystem_device, - (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), - (u8)(pdev->class))) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MODALIAS=pci:v%08Xd%08Xsv%08Xsd%08Xbc%02Xsc%02Xi%02x", + pdev->vendor, pdev->device, + pdev->subsystem_vendor, pdev->subsystem_device, + (u8)(pdev->class >> 16), (u8)(pdev->class >> 8), + (u8)(pdev->class))) return -ENOMEM; envp[i] = NULL; diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index a9046d4b8af3..7146b69b812c 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -502,8 +502,8 @@ void pci_dev_put(struct pci_dev *dev) } #ifndef CONFIG_HOTPLUG -int pci_hotplug (struct device *dev, char **envp, int num_envp, - char *buffer, int buffer_size) +int pci_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) { return -ENODEV; } @@ -512,7 +512,7 @@ int pci_hotplug (struct device *dev, char **envp, int num_envp, struct bus_type pci_bus_type = { .name = "pci", .match = pci_bus_match, - .hotplug = pci_hotplug, + .uevent = pci_uevent, .suspend = pci_device_suspend, .resume = pci_device_resume, .dev_attrs = pci_dev_attrs, diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 6527b36c9a61..294849d24590 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -1,7 +1,7 @@ /* Functions internal to the PCI core code */ -extern int pci_hotplug (struct device *dev, char **envp, int num_envp, - char *buffer, int buffer_size); +extern int pci_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size); extern int pci_create_sysfs_dev_files(struct pci_dev *pdev); extern void pci_remove_sysfs_dev_files(struct pci_dev *pdev); extern void pci_cleanup_rom(struct pci_dev *dev); diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index a30aa74304a2..7cf09084ef61 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -901,14 +901,14 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) EXPORT_SYMBOL(pcmcia_insert_card); -static int pcmcia_socket_hotplug(struct class_device *dev, char **envp, - int num_envp, char *buffer, int buffer_size) +static int pcmcia_socket_uevent(struct class_device *dev, char **envp, + int num_envp, char *buffer, int buffer_size) { struct pcmcia_socket *s = container_of(dev, struct pcmcia_socket, dev); int i = 0, length = 0; - if (add_hotplug_env_var(envp, num_envp, &i, buffer, buffer_size, - &length, "SOCKET_NO=%u", s->sock)) + if (add_uevent_var(envp, num_envp, &i, buffer, buffer_size, + &length, "SOCKET_NO=%u", s->sock)) return -ENOMEM; envp[i] = NULL; @@ -927,7 +927,7 @@ static void pcmcia_release_socket_class(struct class *data) struct class pcmcia_socket_class = { .name = "pcmcia_socket", - .hotplug = pcmcia_socket_hotplug, + .uevent = pcmcia_socket_uevent, .release = pcmcia_release_socket, .class_release = pcmcia_release_socket_class, }; diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7f8219f3fd9e..6fb76399547e 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -779,8 +779,8 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { #ifdef CONFIG_HOTPLUG -static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, - char *buffer, int buffer_size) +static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) { struct pcmcia_device *p_dev; int i, length = 0; @@ -800,31 +800,31 @@ static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, i = 0; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "SOCKET_NO=%u", - p_dev->socket->sock)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "SOCKET_NO=%u", + p_dev->socket->sock)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "DEVICE_NO=%02X", - p_dev->device_no)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "DEVICE_NO=%02X", + p_dev->device_no)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" - "pa%08Xpb%08Xpc%08Xpd%08X", - p_dev->has_manf_id ? p_dev->manf_id : 0, - p_dev->has_card_id ? p_dev->card_id : 0, - p_dev->has_func_id ? p_dev->func_id : 0, - p_dev->func, - p_dev->device_no, - hash[0], - hash[1], - hash[2], - hash[3])) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MODALIAS=pcmcia:m%04Xc%04Xf%02Xfn%02Xpfn%02X" + "pa%08Xpb%08Xpc%08Xpd%08X", + p_dev->has_manf_id ? p_dev->manf_id : 0, + p_dev->has_card_id ? p_dev->card_id : 0, + p_dev->has_func_id ? p_dev->func_id : 0, + p_dev->func, + p_dev->device_no, + hash[0], + hash[1], + hash[2], + hash[3])) return -ENOMEM; envp[i] = NULL; @@ -834,7 +834,7 @@ static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, #else -static int pcmcia_bus_hotplug(struct device *dev, char **envp, int num_envp, +static int pcmcia_bus_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { return -ENODEV; @@ -1223,7 +1223,7 @@ static struct class_interface pcmcia_bus_interface = { struct bus_type pcmcia_bus_type = { .name = "pcmcia", - .hotplug = pcmcia_bus_hotplug, + .uevent = pcmcia_bus_uevent, .match = pcmcia_bus_match, .dev_attrs = pcmcia_dev_attrs, }; diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index bf44a409ba0d..07ddf9a38758 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -2132,7 +2132,7 @@ restart: } spin_unlock_irqrestore(ioa_cfg->host->host_lock, lock_flags); - kobject_hotplug(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE); + kobject_uevent(&ioa_cfg->host->shost_classdev.kobj, KOBJ_CHANGE); LEAVE; } diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index e80ef9467825..af2f0941baac 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -363,8 +363,7 @@ void usb_driver_release_interface(struct usb_driver *driver, * Most USB device drivers will use this indirectly, through the usb core, * but some layered driver frameworks use it directly. * These device tables are exported with MODULE_DEVICE_TABLE, through - * modutils and "modules.usbmap", to support the driver loading - * functionality of USB hotplugging. + * modutils, to support the driver loading functionality of USB hotplugging. * * What Matches: * @@ -545,10 +544,7 @@ static int usb_device_match (struct device *dev, struct device_driver *drv) #ifdef CONFIG_HOTPLUG /* - * USB hotplugging invokes what /proc/sys/kernel/hotplug says - * (normally /sbin/hotplug) when USB devices get added or removed. - * - * This invokes a user mode policy agent, typically helping to load driver + * This sends an uevent to userspace, typically helping to load driver * or other modules, configure the device, and more. Drivers can provide * a MODULE_DEVICE_TABLE to help with module loading subtasks. * @@ -557,8 +553,8 @@ static int usb_device_match (struct device *dev, struct device_driver *drv) * delays in event delivery. Use sysfs (and DEVPATH) to make sure the * device (and this configuration!) are still present. */ -static int usb_hotplug (struct device *dev, char **envp, int num_envp, - char *buffer, int buffer_size) +static int usb_uevent(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size) { struct usb_interface *intf; struct usb_device *usb_dev; @@ -570,7 +566,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, return -ENODEV; /* driver is often null here; dev_dbg() would oops */ - pr_debug ("usb %s: hotplug\n", dev->bus_id); + pr_debug ("usb %s: uevent\n", dev->bus_id); /* Must check driver_data here, as on remove driver is always NULL */ if ((dev->driver == &usb_generic_driver) || @@ -597,51 +593,51 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, * * FIXME reduce hardwired intelligence here */ - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "DEVICE=/proc/bus/usb/%03d/%03d", - usb_dev->bus->busnum, usb_dev->devnum)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "DEVICE=/proc/bus/usb/%03d/%03d", + usb_dev->bus->busnum, usb_dev->devnum)) return -ENOMEM; #endif /* per-device configurations are common */ - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "PRODUCT=%x/%x/%x", - le16_to_cpu(usb_dev->descriptor.idVendor), - le16_to_cpu(usb_dev->descriptor.idProduct), - le16_to_cpu(usb_dev->descriptor.bcdDevice))) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "PRODUCT=%x/%x/%x", + le16_to_cpu(usb_dev->descriptor.idVendor), + le16_to_cpu(usb_dev->descriptor.idProduct), + le16_to_cpu(usb_dev->descriptor.bcdDevice))) return -ENOMEM; /* class-based driver binding models */ - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "TYPE=%d/%d/%d", - usb_dev->descriptor.bDeviceClass, - usb_dev->descriptor.bDeviceSubClass, - usb_dev->descriptor.bDeviceProtocol)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "TYPE=%d/%d/%d", + usb_dev->descriptor.bDeviceClass, + usb_dev->descriptor.bDeviceSubClass, + usb_dev->descriptor.bDeviceProtocol)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "INTERFACE=%d/%d/%d", - alt->desc.bInterfaceClass, - alt->desc.bInterfaceSubClass, - alt->desc.bInterfaceProtocol)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "INTERFACE=%d/%d/%d", + alt->desc.bInterfaceClass, + alt->desc.bInterfaceSubClass, + alt->desc.bInterfaceProtocol)) return -ENOMEM; - if (add_hotplug_env_var(envp, num_envp, &i, - buffer, buffer_size, &length, - "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", - le16_to_cpu(usb_dev->descriptor.idVendor), - le16_to_cpu(usb_dev->descriptor.idProduct), - le16_to_cpu(usb_dev->descriptor.bcdDevice), - usb_dev->descriptor.bDeviceClass, - usb_dev->descriptor.bDeviceSubClass, - usb_dev->descriptor.bDeviceProtocol, - alt->desc.bInterfaceClass, - alt->desc.bInterfaceSubClass, - alt->desc.bInterfaceProtocol)) + if (add_uevent_var(envp, num_envp, &i, + buffer, buffer_size, &length, + "MODALIAS=usb:v%04Xp%04Xd%04Xdc%02Xdsc%02Xdp%02Xic%02Xisc%02Xip%02X", + le16_to_cpu(usb_dev->descriptor.idVendor), + le16_to_cpu(usb_dev->descriptor.idProduct), + le16_to_cpu(usb_dev->descriptor.bcdDevice), + usb_dev->descriptor.bDeviceClass, + usb_dev->descriptor.bDeviceSubClass, + usb_dev->descriptor.bDeviceProtocol, + alt->desc.bInterfaceClass, + alt->desc.bInterfaceSubClass, + alt->desc.bInterfaceProtocol)) return -ENOMEM; envp[i] = NULL; @@ -651,7 +647,7 @@ static int usb_hotplug (struct device *dev, char **envp, int num_envp, #else -static int usb_hotplug (struct device *dev, char **envp, +static int usb_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { return -ENODEV; @@ -1491,7 +1487,7 @@ static int usb_generic_resume(struct device *dev) struct bus_type usb_bus_type = { .name = "usb", .match = usb_device_match, - .hotplug = usb_hotplug, + .uevent = usb_uevent, .suspend = usb_generic_suspend, .resume = usb_generic_resume, }; diff --git a/drivers/usb/host/hc_crisv10.c b/drivers/usb/host/hc_crisv10.c index 0eaabeb37ac3..641268d7e6f3 100644 --- a/drivers/usb/host/hc_crisv10.c +++ b/drivers/usb/host/hc_crisv10.c @@ -4397,7 +4397,7 @@ static int __init etrax_usb_hc_init(void) device_initialize(&fake_device); kobject_set_name(&fake_device.kobj, "etrax_usb"); kobject_add(&fake_device.kobj); - kobject_hotplug(&fake_device.kobj, KOBJ_ADD); + kobject_uevent(&fake_device.kobj, KOBJ_ADD); hc->bus->controller = &fake_device; usb_register_bus(hc->bus); diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index 14016b1cd948..024206c4a0e4 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -142,12 +142,12 @@ static struct bin_attribute w1_slave_attr_bin_id = { /* Default family */ static struct w1_family w1_default_family; -static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size); +static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size); static struct bus_type w1_bus_type = { .name = "w1", .match = w1_master_match, - .hotplug = w1_hotplug, + .uevent = w1_uevent, }; struct device_driver w1_master_driver = { @@ -361,7 +361,7 @@ void w1_destroy_master_attributes(struct w1_master *master) } #ifdef CONFIG_HOTPLUG -static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) +static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct w1_master *md = NULL; struct w1_slave *sl = NULL; @@ -377,7 +377,7 @@ static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffe event_owner = "slave"; name = sl->name; } else { - dev_dbg(dev, "Unknown hotplug event.\n"); + dev_dbg(dev, "Unknown event.\n"); return -EINVAL; } @@ -386,18 +386,18 @@ static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffe if (dev->driver != &w1_slave_driver || !sl) return 0; - err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family); + err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_FID=%02X", sl->reg_num.family); if (err) return err; - err = add_hotplug_env_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id); + err = add_uevent_var(envp, num_envp, &cur_index, buffer, buffer_size, &cur_len, "W1_SLAVE_ID=%024LX", (u64)sl->reg_num.id); if (err) return err; return 0; }; #else -static int w1_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) +static int w1_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { return 0; } diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 8dc1822a7022..7187a57d51e8 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c @@ -226,7 +226,7 @@ static struct sysfs_ops part_sysfs_ops = { static ssize_t part_uevent_store(struct hd_struct * p, const char *page, size_t count) { - kobject_hotplug(&p->kobj, KOBJ_ADD); + kobject_uevent(&p->kobj, KOBJ_ADD); return count; } static ssize_t part_dev_read(struct hd_struct * p, char *page) @@ -360,7 +360,7 @@ void register_disk(struct gendisk *disk) if ((err = kobject_add(&disk->kobj))) return; disk_sysfs_symlinks(disk); - kobject_hotplug(&disk->kobj, KOBJ_ADD); + kobject_uevent(&disk->kobj, KOBJ_ADD); /* No minors to use for partitions */ if (disk->minors == 1) { @@ -465,6 +465,6 @@ void del_gendisk(struct gendisk *disk) sysfs_remove_link(&disk->driverfs_dev->kobj, "block"); put_device(disk->driverfs_dev); } - kobject_hotplug(&disk->kobj, KOBJ_REMOVE); + kobject_uevent(&disk->kobj, KOBJ_REMOVE); kobject_del(&disk->kobj); } diff --git a/include/linux/device.h b/include/linux/device.h index 17cbc6db67b4..0cdee78e5ce1 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -47,8 +47,8 @@ struct bus_type { struct driver_attribute * drv_attrs; int (*match)(struct device * dev, struct device_driver * drv); - int (*hotplug) (struct device *dev, char **envp, - int num_envp, char *buffer, int buffer_size); + int (*uevent)(struct device *dev, char **envp, + int num_envp, char *buffer, int buffer_size); int (*suspend)(struct device * dev, pm_message_t state); int (*resume)(struct device * dev); }; @@ -151,7 +151,7 @@ struct class { struct class_attribute * class_attrs; struct class_device_attribute * class_dev_attrs; - int (*hotplug)(struct class_device *dev, char **envp, + int (*uevent)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size); void (*release)(struct class_device *dev); @@ -209,9 +209,9 @@ extern int class_device_create_file(struct class_device *, * set, this will be called instead of the class specific release function. * Only use this if you want to override the default release function, like * when you are nesting class_device structures. - * @hotplug: pointer to a hotplug function for this struct class_device. If - * set, this will be called instead of the class specific hotplug function. - * Only use this if you want to override the default hotplug function, like + * @uevent: pointer to a uevent function for this struct class_device. If + * set, this will be called instead of the class specific uevent function. + * Only use this if you want to override the default uevent function, like * when you are nesting class_device structures. */ struct class_device { @@ -227,7 +227,7 @@ struct class_device { struct class_device *parent; /* parent of this child device, if there is one */ void (*release)(struct class_device *dev); - int (*hotplug)(struct class_device *dev, char **envp, + int (*uevent)(struct class_device *dev, char **envp, int num_envp, char *buffer, int buffer_size); char class_id[BUS_ID_SIZE]; /* unique to this class */ }; diff --git a/include/linux/firmware.h b/include/linux/firmware.h index 2063c0839d4f..2d716080be4a 100644 --- a/include/linux/firmware.h +++ b/include/linux/firmware.h @@ -14,7 +14,7 @@ struct device; int request_firmware(const struct firmware **fw, const char *name, struct device *device); int request_firmware_nowait( - struct module *module, int hotplug, + struct module *module, int uevent, const char *name, struct device *device, void *context, void (*cont)(const struct firmware *fw, void *context)); diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 5b08248fba72..8eb21f2f25e1 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -26,15 +26,14 @@ #include #include -#define KOBJ_NAME_LEN 20 - -#define HOTPLUG_PATH_LEN 256 +#define KOBJ_NAME_LEN 20 +#define UEVENT_HELPER_PATH_LEN 256 /* path to the userspace helper executed on an event */ -extern char hotplug_path[]; +extern char uevent_helper[]; -/* counter to tag the hotplug event, read only except for the kobject core */ -extern u64 hotplug_seqnum; +/* counter to tag the uevent, read only except for the kobject core */ +extern u64 uevent_seqnum; /* the actions here must match the proper string in lib/kobject_uevent.c */ typedef int __bitwise kobject_action_t; @@ -101,15 +100,14 @@ struct kobj_type { * of object; multiple ksets can belong to one subsystem. All * ksets of a subsystem share the subsystem's lock. * - * Each kset can support hotplugging; if it does, it will be given - * the opportunity to filter out specific kobjects from being - * reported, as well as to add its own "data" elements to the - * environment being passed to the hotplug helper. + * Each kset can support specific event variables; it can + * supress the event generation or add subsystem specific + * variables carried with the event. */ -struct kset_hotplug_ops { +struct kset_uevent_ops { int (*filter)(struct kset *kset, struct kobject *kobj); const char *(*name)(struct kset *kset, struct kobject *kobj); - int (*hotplug)(struct kset *kset, struct kobject *kobj, char **envp, + int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp, int num_envp, char *buffer, int buffer_size); }; @@ -119,7 +117,7 @@ struct kset { struct list_head list; spinlock_t list_lock; struct kobject kobj; - struct kset_hotplug_ops * hotplug_ops; + struct kset_uevent_ops * uevent_ops; }; @@ -167,20 +165,20 @@ struct subsystem { struct rw_semaphore rwsem; }; -#define decl_subsys(_name,_type,_hotplug_ops) \ +#define decl_subsys(_name,_type,_uevent_ops) \ struct subsystem _name##_subsys = { \ .kset = { \ .kobj = { .name = __stringify(_name) }, \ .ktype = _type, \ - .hotplug_ops =_hotplug_ops, \ + .uevent_ops =_uevent_ops, \ } \ } -#define decl_subsys_name(_varname,_name,_type,_hotplug_ops) \ +#define decl_subsys_name(_varname,_name,_type,_uevent_ops) \ struct subsystem _varname##_subsys = { \ .kset = { \ .kobj = { .name = __stringify(_name) }, \ .ktype = _type, \ - .hotplug_ops =_hotplug_ops, \ + .uevent_ops =_uevent_ops, \ } \ } @@ -256,16 +254,16 @@ extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); extern void subsys_remove_file(struct subsystem * , struct subsys_attribute *); #ifdef CONFIG_HOTPLUG -void kobject_hotplug(struct kobject *kobj, enum kobject_action action); +void kobject_uevent(struct kobject *kobj, enum kobject_action action); -int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, +int add_uevent_var(char **envp, int num_envp, int *cur_index, char *buffer, int buffer_size, int *cur_len, const char *format, ...) __attribute__((format (printf, 7, 8))); #else -static inline void kobject_hotplug(struct kobject *kobj, enum kobject_action action) { } +static inline void kobject_uevent(struct kobject *kobj, enum kobject_action action) { } -static inline int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, +static inline int add_uevent_var(char **envp, int num_envp, int *cur_index, char *buffer, int buffer_size, int *cur_len, const char *format, ...) { return 0; } diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 4be34ef8c2f7..501564264518 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h @@ -124,7 +124,7 @@ enum KERN_OVERFLOWUID=46, /* int: overflow UID */ KERN_OVERFLOWGID=47, /* int: overflow GID */ KERN_SHMPATH=48, /* string: path to shm fs */ - KERN_HOTPLUG=49, /* string: path to hotplug policy agent */ + KERN_HOTPLUG=49, /* string: path to uevent helper (deprecated) */ KERN_IEEE_EMULATION_WARNINGS=50, /* int: unimplemented ieee instructions */ KERN_S390_USER_DEBUG_LOGGING=51, /* int: dumps of user faults */ KERN_CORE_USES_PID=52, /* int: use core or core.%pid */ diff --git a/include/linux/usb.h b/include/linux/usb.h index d81b050e5955..7a20997e8071 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -225,7 +225,7 @@ struct usb_interface_cache { * Device drivers should not attempt to activate configurations. The choice * of which configuration to install is a policy decision based on such * considerations as available power, functionality provided, and the user's - * desires (expressed through hotplug scripts). However, drivers can call + * desires (expressed through userspace tools). However, drivers can call * usb_reset_configuration() to reinitialize the current configuration and * all its interfaces. */ diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c index e975a76a9d5b..bfb4a7a54e22 100644 --- a/kernel/ksysfs.c +++ b/kernel/ksysfs.c @@ -26,23 +26,23 @@ static struct subsys_attribute _name##_attr = \ /* current uevent sequence number */ static ssize_t uevent_seqnum_show(struct subsystem *subsys, char *page) { - return sprintf(page, "%llu\n", (unsigned long long)hotplug_seqnum); + return sprintf(page, "%llu\n", (unsigned long long)uevent_seqnum); } KERNEL_ATTR_RO(uevent_seqnum); /* uevent helper program, used during early boo */ static ssize_t uevent_helper_show(struct subsystem *subsys, char *page) { - return sprintf(page, "%s\n", hotplug_path); + return sprintf(page, "%s\n", uevent_helper); } static ssize_t uevent_helper_store(struct subsystem *subsys, const char *page, size_t count) { - if (count+1 > HOTPLUG_PATH_LEN) + if (count+1 > UEVENT_HELPER_PATH_LEN) return -ENOENT; - memcpy(hotplug_path, page, count); - hotplug_path[count] = '\0'; - if (count && hotplug_path[count-1] == '\n') - hotplug_path[count-1] = '\0'; + memcpy(uevent_helper, page, count); + uevent_helper[count] = '\0'; + if (count && uevent_helper[count-1] == '\n') + uevent_helper[count-1] = '\0'; return count; } KERNEL_ATTR_RW(uevent_helper); diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 6a51e25d4466..345f4a1d533f 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c @@ -395,8 +395,8 @@ static ctl_table kern_table[] = { { .ctl_name = KERN_HOTPLUG, .procname = "hotplug", - .data = &hotplug_path, - .maxlen = HOTPLUG_PATH_LEN, + .data = &uevent_helper, + .maxlen = UEVENT_HELPER_PATH_LEN, .mode = 0644, .proc_handler = &proc_dostring, .strategy = &sysctl_string, diff --git a/lib/kobject.c b/lib/kobject.c index a181abed89f6..7a0e6809490d 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -207,7 +207,7 @@ int kobject_register(struct kobject * kobj) kobject_name(kobj),error); dump_stack(); } else - kobject_hotplug(kobj, KOBJ_ADD); + kobject_uevent(kobj, KOBJ_ADD); } else error = -EINVAL; return error; @@ -312,7 +312,7 @@ void kobject_del(struct kobject * kobj) void kobject_unregister(struct kobject * kobj) { pr_debug("kobject %s: unregistering\n",kobject_name(kobj)); - kobject_hotplug(kobj, KOBJ_REMOVE); + kobject_uevent(kobj, KOBJ_REMOVE); kobject_del(kobj); kobject_put(kobj); } diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index dd061da3aba9..01479e5c6d18 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -22,12 +22,12 @@ #include #include -#define BUFFER_SIZE 1024 /* buffer for the hotplug env */ +#define BUFFER_SIZE 1024 /* buffer for the variables */ #define NUM_ENVP 32 /* number of env pointers */ #if defined(CONFIG_HOTPLUG) -char hotplug_path[HOTPLUG_PATH_LEN] = "/sbin/hotplug"; -u64 hotplug_seqnum; +char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug"; +u64 uevent_seqnum; static DEFINE_SPINLOCK(sequence_lock); static struct sock *uevent_sock; @@ -50,12 +50,12 @@ static char *action_to_string(enum kobject_action action) } /** - * kobject_hotplug - notify userspace by executing /sbin/hotplug + * kobject_uevent - notify userspace by ending an uevent * - * @action: action that is happening (usually "ADD" or "REMOVE") + * @action: action that is happening (usually KOBJ_ADD and KOBJ_REMOVE) * @kobj: struct kobject that the action is happening to */ -void kobject_hotplug(struct kobject *kobj, enum kobject_action action) +void kobject_uevent(struct kobject *kobj, enum kobject_action action) { char **envp; char *buffer; @@ -65,7 +65,7 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) const char *subsystem; struct kobject *top_kobj; struct kset *kset; - struct kset_hotplug_ops *hotplug_ops; + struct kset_uevent_ops *uevent_ops; u64 seq; char *seq_buff; int i = 0; @@ -88,11 +88,11 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) return; kset = top_kobj->kset; - hotplug_ops = kset->hotplug_ops; + uevent_ops = kset->uevent_ops; /* skip the event, if the filter returns zero. */ - if (hotplug_ops && hotplug_ops->filter) - if (!hotplug_ops->filter(kset, kobj)) + if (uevent_ops && uevent_ops->filter) + if (!uevent_ops->filter(kset, kobj)) return; /* environment index */ @@ -111,8 +111,8 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) goto exit; /* originating subsystem */ - if (hotplug_ops && hotplug_ops->name) - subsystem = hotplug_ops->name(kset, kobj); + if (uevent_ops && uevent_ops->name) + subsystem = uevent_ops->name(kset, kobj); else subsystem = kobject_name(&kset->kobj); @@ -134,12 +134,12 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) scratch += strlen("SEQNUM=18446744073709551616") + 1; /* let the kset specific function add its stuff */ - if (hotplug_ops && hotplug_ops->hotplug) { - retval = hotplug_ops->hotplug (kset, kobj, + if (uevent_ops && uevent_ops->uevent) { + retval = uevent_ops->uevent(kset, kobj, &envp[i], NUM_ENVP - i, scratch, BUFFER_SIZE - (scratch - buffer)); if (retval) { - pr_debug ("%s - hotplug() returned %d\n", + pr_debug ("%s - uevent() returned %d\n", __FUNCTION__, retval); goto exit; } @@ -147,7 +147,7 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) /* we will send an event, request a new sequence number */ spin_lock(&sequence_lock); - seq = ++hotplug_seqnum; + seq = ++uevent_seqnum; spin_unlock(&sequence_lock); sprintf(seq_buff, "SEQNUM=%llu", (unsigned long long)seq); @@ -177,10 +177,10 @@ void kobject_hotplug(struct kobject *kobj, enum kobject_action action) } /* call uevent_helper, usually only enabled during early boot */ - if (hotplug_path[0]) { + if (uevent_helper[0]) { char *argv [3]; - argv [0] = hotplug_path; + argv [0] = uevent_helper; argv [1] = (char *)subsystem; argv [2] = NULL; call_usermodehelper (argv[0], argv, envp, 0); @@ -192,39 +192,39 @@ exit: kfree(envp); return; } -EXPORT_SYMBOL(kobject_hotplug); +EXPORT_SYMBOL_GPL(kobject_uevent); /** - * add_hotplug_env_var - helper for creating hotplug environment variables + * add_uevent_var - helper for creating event variables * @envp: Pointer to table of environment variables, as passed into - * hotplug() method. + * uevent() method. * @num_envp: Number of environment variable slots available, as - * passed into hotplug() method. + * passed into uevent() method. * @cur_index: Pointer to current index into @envp. It should be - * initialized to 0 before the first call to add_hotplug_env_var(), + * initialized to 0 before the first call to add_uevent_var(), * and will be incremented on success. * @buffer: Pointer to buffer for environment variables, as passed - * into hotplug() method. - * @buffer_size: Length of @buffer, as passed into hotplug() method. + * into uevent() method. + * @buffer_size: Length of @buffer, as passed into uevent() method. * @cur_len: Pointer to current length of space used in @buffer. * Should be initialized to 0 before the first call to - * add_hotplug_env_var(), and will be incremented on success. + * add_uevent_var(), and will be incremented on success. * @format: Format for creating environment variable (of the form * "XXX=%x") for snprintf(). * * Returns 0 if environment variable was added successfully or -ENOMEM * if no space was available. */ -int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, - char *buffer, int buffer_size, int *cur_len, - const char *format, ...) +int add_uevent_var(char **envp, int num_envp, int *cur_index, + char *buffer, int buffer_size, int *cur_len, + const char *format, ...) { va_list args; /* * We check against num_envp - 1 to make sure there is at - * least one slot left after we return, since the hotplug - * method needs to set the last slot to NULL. + * least one slot left after we return, since kobject_uevent() + * needs to set the last slot to NULL. */ if (*cur_index >= num_envp - 1) return -ENOMEM; @@ -243,7 +243,7 @@ int add_hotplug_env_var(char **envp, int num_envp, int *cur_index, (*cur_index)++; return 0; } -EXPORT_SYMBOL(add_hotplug_env_var); +EXPORT_SYMBOL_GPL(add_uevent_var); static int __init kobject_uevent_init(void) { diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index bd7568ac87fc..0ed38740388c 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c @@ -78,7 +78,7 @@ static struct class_device_attribute *bt_attrs[] = { }; #ifdef CONFIG_HOTPLUG -static int bt_hotplug(struct class_device *cdev, char **envp, int num_envp, char *buf, int size) +static int bt_uevent(struct class_device *cdev, char **envp, int num_envp, char *buf, int size) { struct hci_dev *hdev = class_get_devdata(cdev); int n, i = 0; @@ -107,7 +107,7 @@ struct class bt_class = { .name = "bluetooth", .release = bt_release, #ifdef CONFIG_HOTPLUG - .hotplug = bt_hotplug, + .uevent = bt_uevent, #endif }; diff --git a/net/bridge/br_sysfs_if.c b/net/bridge/br_sysfs_if.c index f6a19d53eaeb..2ebdc23bbe26 100644 --- a/net/bridge/br_sysfs_if.c +++ b/net/bridge/br_sysfs_if.c @@ -248,7 +248,7 @@ int br_sysfs_addif(struct net_bridge_port *p) if (err) goto out2; - kobject_hotplug(&p->kobj, KOBJ_ADD); + kobject_uevent(&p->kobj, KOBJ_ADD); return 0; out2: kobject_del(&p->kobj); @@ -260,7 +260,7 @@ void br_sysfs_removeif(struct net_bridge_port *p) { pr_debug("br_sysfs_removeif\n"); sysfs_remove_link(&p->br->ifobj, p->dev->name); - kobject_hotplug(&p->kobj, KOBJ_REMOVE); + kobject_uevent(&p->kobj, KOBJ_REMOVE); kobject_del(&p->kobj); } diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c index e2137f3e489d..198655dd9a77 100644 --- a/net/core/net-sysfs.c +++ b/net/core/net-sysfs.c @@ -369,14 +369,14 @@ static struct attribute_group wireless_group = { #endif #ifdef CONFIG_HOTPLUG -static int netdev_hotplug(struct class_device *cd, char **envp, - int num_envp, char *buf, int size) +static int netdev_uevent(struct class_device *cd, char **envp, + int num_envp, char *buf, int size) { struct net_device *dev = to_net_dev(cd); int i = 0; int n; - /* pass interface in env to hotplug. */ + /* pass interface to uevent. */ envp[i++] = buf; n = snprintf(buf, size, "INTERFACE=%s", dev->name) + 1; buf += n; @@ -408,7 +408,7 @@ static struct class net_class = { .name = "net", .release = netdev_release, #ifdef CONFIG_HOTPLUG - .hotplug = netdev_hotplug, + .uevent = netdev_uevent, #endif }; -- cgit v1.2.3 From 6d20b035dee4300e9786c6e1cb77a765c7f9460a Mon Sep 17 00:00:00 2001 From: Paul Jackson Date: Fri, 25 Nov 2005 20:04:26 -0800 Subject: [PATCH] driver kill hotplug word from sn and others fix The first of these changes s/hotplug/uevent/ was needed to compile sn2_defconfig (ia64/sn). The other three files changed are blind changes of all remaining bus_type.hotplug references I could find to bus_type.uevent. This patch attempts to finish similar changes made in the gregkh-driver-kill-hotplug-word-from-driver-core Nov 22 patch. Signed-off-by: Paul Jackson Signed-off-by: Greg Kroah-Hartman --- arch/arm/common/amba.c | 6 +++--- arch/ia64/sn/kernel/tiocx.c | 4 ++-- drivers/s390/cio/ccwgroup.c | 4 ++-- drivers/s390/cio/device.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'arch') diff --git a/arch/arm/common/amba.c b/arch/arm/common/amba.c index e1013112c354..c95ec9eab996 100644 --- a/arch/arm/common/amba.c +++ b/arch/arm/common/amba.c @@ -45,7 +45,7 @@ static int amba_match(struct device *dev, struct device_driver *drv) } #ifdef CONFIG_HOTPLUG -static int amba_hotplug(struct device *dev, char **envp, int nr_env, char *buf, int bufsz) +static int amba_uevent(struct device *dev, char **envp, int nr_env, char *buf, int bufsz) { struct amba_device *pcdev = to_amba_device(dev); @@ -58,7 +58,7 @@ static int amba_hotplug(struct device *dev, char **envp, int nr_env, char *buf, return 0; } #else -#define amba_hotplug NULL +#define amba_uevent NULL #endif static int amba_suspend(struct device *dev, pm_message_t state) @@ -88,7 +88,7 @@ static int amba_resume(struct device *dev) static struct bus_type amba_bustype = { .name = "amba", .match = amba_match, - .hotplug = amba_hotplug, + .uevent = amba_uevent, .suspend = amba_suspend, .resume = amba_resume, }; diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c index 0d8592a745a7..768c21deb2e5 100644 --- a/arch/ia64/sn/kernel/tiocx.c +++ b/arch/ia64/sn/kernel/tiocx.c @@ -65,7 +65,7 @@ static int tiocx_match(struct device *dev, struct device_driver *drv) } -static int tiocx_hotplug(struct device *dev, char **envp, int num_envp, +static int tiocx_uevent(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { return -ENODEV; @@ -79,7 +79,7 @@ static void tiocx_bus_release(struct device *dev) struct bus_type tiocx_bus_type = { .name = "tiocx", .match = tiocx_match, - .hotplug = tiocx_hotplug, + .uevent = tiocx_uevent, }; /** diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index e7bd7f37f080..be9d2d65c22f 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -45,7 +45,7 @@ ccwgroup_bus_match (struct device * dev, struct device_driver * drv) return 0; } static int -ccwgroup_hotplug (struct device *dev, char **envp, int num_envp, char *buffer, +ccwgroup_uevent (struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { /* TODO */ @@ -55,7 +55,7 @@ ccwgroup_hotplug (struct device *dev, char **envp, int num_envp, char *buffer, static struct bus_type ccwgroup_bus_type = { .name = "ccwgroup", .match = ccwgroup_bus_match, - .hotplug = ccwgroup_hotplug, + .uevent = ccwgroup_uevent, }; static inline void diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index 811c9d150637..85908cacc3b8 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -59,7 +59,7 @@ ccw_bus_match (struct device * dev, struct device_driver * drv) * Heavily modeled on pci and usb hotplug. */ static int -ccw_hotplug (struct device *dev, char **envp, int num_envp, +ccw_uevent (struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) { struct ccw_device *cdev = to_ccwdev(dev); @@ -110,7 +110,7 @@ ccw_hotplug (struct device *dev, char **envp, int num_envp, struct bus_type ccw_bus_type = { .name = "ccw", .match = &ccw_bus_match, - .hotplug = &ccw_hotplug, + .uevent = &ccw_uevent, }; static int io_subchannel_probe (struct device *); -- cgit v1.2.3 From e28cc71572da38a5a12c1cfe4d7032017adccf69 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Wed, 4 Jan 2006 16:20:40 -0800 Subject: Relax the rw_verify_area() error checking. In particular, allow over-large read- or write-requests to be downgraded to a more reasonable range, rather than considering them outright errors. We want to protect lower layers from (the sadly all too common) overflow conditions, but prefer to do so by chopping the requests up, rather than just refusing them outright. Cc: Peter Anvin Cc: Ulrich Drepper Cc: Andi Kleen Cc: Al Viro Signed-off-by: Linus Torvalds --- arch/mips/kernel/linux32.c | 4 ++-- fs/compat.c | 2 +- fs/read_write.c | 34 +++++++++++++++++++++++++--------- 3 files changed, 28 insertions(+), 12 deletions(-) (limited to 'arch') diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c index 330cf84d21fe..60353f5acc48 100644 --- a/arch/mips/kernel/linux32.c +++ b/arch/mips/kernel/linux32.c @@ -420,7 +420,7 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf, goto out; pos = merge_64(a4, a5); ret = rw_verify_area(READ, file, &pos, count); - if (ret) + if (ret < 0) goto out; ret = -EINVAL; if (!file->f_op || !(read = file->f_op->read)) @@ -455,7 +455,7 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf, goto out; pos = merge_64(a4, a5); ret = rw_verify_area(WRITE, file, &pos, count); - if (ret) + if (ret < 0) goto out; ret = -EINVAL; if (!file->f_op || !(write = file->f_op->write)) diff --git a/fs/compat.c b/fs/compat.c index 818634120b69..55ac0324aaf1 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1170,7 +1170,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, } ret = rw_verify_area(type, file, pos, tot_len); - if (ret) + if (ret < 0) goto out; fnv = NULL; diff --git a/fs/read_write.c b/fs/read_write.c index a091ee4f430d..df3468a22fea 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -182,22 +183,33 @@ bad: } #endif +/* + * rw_verify_area doesn't like huge counts. We limit + * them to something that fits in "int" so that others + * won't have to do range checks all the time. + */ +#define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK) int rw_verify_area(int read_write, struct file *file, loff_t *ppos, size_t count) { struct inode *inode; loff_t pos; - if (unlikely(count > INT_MAX)) + if (unlikely((ssize_t) count < 0)) goto Einval; pos = *ppos; if (unlikely((pos < 0) || (loff_t) (pos + count) < 0)) goto Einval; inode = file->f_dentry->d_inode; - if (inode->i_flock && MANDATORY_LOCK(inode)) - return locks_mandatory_area(read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, inode, file, pos, count); - return 0; + if (inode->i_flock && MANDATORY_LOCK(inode)) { + int retval = locks_mandatory_area( + read_write == READ ? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE, + inode, file, pos, count); + if (retval < 0) + return retval; + } + return count > MAX_RW_COUNT ? MAX_RW_COUNT : count; Einval: return -EINVAL; @@ -244,7 +256,8 @@ ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) return -EFAULT; ret = rw_verify_area(READ, file, pos, count); - if (!ret) { + if (ret >= 0) { + count = ret; ret = security_file_permission (file, MAY_READ); if (!ret) { if (file->f_op->read) @@ -295,7 +308,8 @@ ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_ return -EFAULT; ret = rw_verify_area(WRITE, file, pos, count); - if (!ret) { + if (ret >= 0) { + count = ret; ret = security_file_permission (file, MAY_WRITE); if (!ret) { if (file->f_op->write) @@ -497,7 +511,7 @@ static ssize_t do_readv_writev(int type, struct file *file, } ret = rw_verify_area(type, file, pos, tot_len); - if (ret) + if (ret < 0) goto out; ret = security_file_permission(file, type == READ ? MAY_READ : MAY_WRITE); if (ret) @@ -653,8 +667,9 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, if (!(in_file->f_mode & FMODE_PREAD)) goto fput_in; retval = rw_verify_area(READ, in_file, ppos, count); - if (retval) + if (retval < 0) goto fput_in; + count = retval; retval = security_file_permission (in_file, MAY_READ); if (retval) @@ -674,8 +689,9 @@ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, goto fput_out; out_inode = out_file->f_dentry->d_inode; retval = rw_verify_area(WRITE, out_file, &out_file->f_pos, count); - if (retval) + if (retval < 0) goto fput_out; + count = retval; retval = security_file_permission (out_file, MAY_WRITE); if (retval) -- cgit v1.2.3 From 631b034724364b413e8a52e7c2e03a9d77e4c2b4 Mon Sep 17 00:00:00 2001 From: Chuck Ebbert <76306.1226@compuserve.com> Date: Tue, 3 Jan 2006 22:36:14 -0500 Subject: [PATCH] i386: "invalid operand" -> "invalid opcode" According to the manual, INT 6 is "invalid opcode", not "invalid operand". Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com> Signed-off-by: Linus Torvalds --- arch/i386/kernel/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch') diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c index f0dffa03fbba..ab0e9430f775 100644 --- a/arch/i386/kernel/traps.c +++ b/arch/i386/kernel/traps.c @@ -452,7 +452,7 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3) #endif DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) -DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->eip) +DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip) DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) -- cgit v1.2.3