Skip to content

Commit

Permalink
Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
Browse files Browse the repository at this point in the history
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6: (23 commits)
  [PATCH] sysfs: fix a kobject leak in sysfs_add_link on the error path
  [PATCH] sysfs: don't export dir symbols
  [PATCH] get_cpu_sysdev() signedness fix
  [PATCH] kobject_add_dir
  [PATCH] debugfs: Add debugfs_create_blob() helper for exporting binary data
  [PATCH] sysfs: fix problem with duplicate sysfs directories and files
  [PATCH] Kobject: kobject.h: fix a typo
  [PATCH] Kobject: provide better warning messages when people do stupid things
  [PATCH] Driver core: add macros notice(), dev_notice()
  [PATCH] firmware: fix BUG: in fw_realloc_buffer
  [PATCH] sysfs: kzalloc conversion
  [PATCH] fix module sysfs files reference counting
  [PATCH] add EXPORT_SYMBOL_GPL_FUTURE() to USB subsystem
  [PATCH] add EXPORT_SYMBOL_GPL_FUTURE() to RCU subsystem
  [PATCH] add EXPORT_SYMBOL_GPL_FUTURE()
  [PATCH] Clean up module.c symbol searching logic
  [PATCH] kobj_map semaphore to mutex conversion
  [PATCH] kref: avoid an atomic operation in kref_put()
  [PATCH] handle errors returned by platform_get_irq*()
  [PATCH] driver core: platform_get_irq*(): return -ENXIO on error
  ...
  • Loading branch information
Linus Torvalds committed Mar 21, 2006
2 parents ba93c62 + b322908 commit 08a4ece
Show file tree
Hide file tree
Showing 53 changed files with 514 additions and 219 deletions.
18 changes: 18 additions & 0 deletions Documentation/feature-removal-schedule.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,21 @@ Why: Board specific code doesn't build anymore since ~2.6.0 and no
users have complained indicating there is no more need for these
boards. This should really be considered a last call.
Who: Ralf Baechle <ralf@linux-mips.org>

---------------------------

What: USB driver API moves to EXPORT_SYMBOL_GPL
When: Febuary 2008
Files: include/linux/usb.h, drivers/usb/core/driver.c
Why: The USB subsystem has changed a lot over time, and it has been
possible to create userspace USB drivers using usbfs/libusb/gadgetfs
that operate as fast as the USB bus allows. Because of this, the USB
subsystem will not be allowing closed source kernel drivers to
register with it, after this grace period is over. If anyone needs
any help in converting their closed source drivers over to use the
userspace filesystems, please contact the
linux-usb-devel@lists.sourceforge.net mailing list, and the developers
there will be glad to help you out.
Who: Greg Kroah-Hartman <gregkh@suse.de>

---------------------------
2 changes: 2 additions & 0 deletions arch/arm/common/locomo.c
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ static int locomo_probe(struct platform_device *dev)
if (!mem)
return -EINVAL;
irq = platform_get_irq(dev, 0);
if (irq < 0)
return -ENXIO;

return __locomo_probe(&dev->dev, mem, irq);
}
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/common/sa1111.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@ static int sa1111_probe(struct platform_device *pdev)
if (!mem)
return -EINVAL;
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return -ENXIO;

return __sa1111_probe(&pdev->dev, mem, irq);
}
Expand Down
10 changes: 10 additions & 0 deletions arch/m68knommu/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ SECTIONS {
*(__ksymtab_gpl)
__stop___ksymtab_gpl = .;

/* Kernel symbol table: GPL-future symbols */
__start___ksymtab_gpl_future = .;
*(__ksymtab_gpl_future)
__stop___ksymtab_gpl_future = .;

/* Kernel symbol table: Normal symbols */
__start___kcrctab = .;
*(__kcrctab)
Expand All @@ -279,6 +284,11 @@ SECTIONS {
*(__kcrctab_gpl)
__stop___kcrctab_gpl = .;

/* Kernel symbol table: GPL-future symbols */
__start___kcrctab_gpl_future = .;
*(__kcrctab_gpl_future)
__stop___kcrctab_gpl_future = .;

/* Kernel symbol table: strings */
*(__ksymtab_strings)

Expand Down
8 changes: 8 additions & 0 deletions arch/v850/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@
___start___ksymtab_gpl = .; \
*(__ksymtab_gpl) \
___stop___ksymtab_gpl = .; \
/* Kernel symbol table: GPL-future symbols */ \
___start___ksymtab_gpl_future = .; \
*(__ksymtab_gpl_future) \
___stop___ksymtab_gpl_future = .; \
/* Kernel symbol table: strings */ \
*(__ksymtab_strings) \
/* Kernel symbol table: Normal symbols */ \
Expand All @@ -74,6 +78,10 @@
___start___kcrctab_gpl = .; \
*(__kcrctab_gpl) \
___stop___kcrctab_gpl = .; \
/* Kernel symbol table: GPL-future symbols */ \
___start___kcrctab_gpl_future = .; \
*(__kcrctab_gpl_future) \
___stop___kcrctab_gpl_future = .; \
/* Built-in module parameters */ \
. = ALIGN (4) ; \
___start___param = .; \
Expand Down
31 changes: 16 additions & 15 deletions block/genhd.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
#include <linux/kmod.h>
#include <linux/kobj_map.h>
#include <linux/buffer_head.h>
#include <linux/mutex.h>

#define MAX_PROBE_HASH 255 /* random */

static struct subsystem block_subsys;

static DECLARE_MUTEX(block_subsys_sem);
static DEFINE_MUTEX(block_subsys_lock);

/*
* Can be deleted altogether. Later.
Expand All @@ -46,7 +47,7 @@ struct blkdev_info {
/*
* iterate over a list of blkdev_info structures. allows
* the major_names array to be iterated over from outside this file
* must be called with the block_subsys_sem held
* must be called with the block_subsys_lock held
*/
void *get_next_blkdev(void *dev)
{
Expand Down Expand Up @@ -85,20 +86,20 @@ void *get_next_blkdev(void *dev)

void *acquire_blkdev_list(void)
{
down(&block_subsys_sem);
mutex_lock(&block_subsys_lock);
return get_next_blkdev(NULL);
}

void release_blkdev_list(void *dev)
{
up(&block_subsys_sem);
mutex_unlock(&block_subsys_lock);
kfree(dev);
}


/*
* Count the number of records in the blkdev_list.
* must be called with the block_subsys_sem held
* must be called with the block_subsys_lock held
*/
int count_blkdev_list(void)
{
Expand All @@ -118,7 +119,7 @@ int count_blkdev_list(void)
/*
* extract the major and name values from a blkdev_info struct
* passed in as a void to *dev. Must be called with
* block_subsys_sem held
* block_subsys_lock held
*/
int get_blkdev_info(void *dev, int *major, char **name)
{
Expand All @@ -138,7 +139,7 @@ int register_blkdev(unsigned int major, const char *name)
struct blk_major_name **n, *p;
int index, ret = 0;

down(&block_subsys_sem);
mutex_lock(&block_subsys_lock);

/* temporary */
if (major == 0) {
Expand Down Expand Up @@ -183,7 +184,7 @@ int register_blkdev(unsigned int major, const char *name)
kfree(p);
}
out:
up(&block_subsys_sem);
mutex_unlock(&block_subsys_lock);
return ret;
}

Expand All @@ -197,7 +198,7 @@ int unregister_blkdev(unsigned int major, const char *name)
int index = major_to_index(major);
int ret = 0;

down(&block_subsys_sem);
mutex_lock(&block_subsys_lock);
for (n = &major_names[index]; *n; n = &(*n)->next)
if ((*n)->major == major)
break;
Expand All @@ -207,7 +208,7 @@ int unregister_blkdev(unsigned int major, const char *name)
p = *n;
*n = p->next;
}
up(&block_subsys_sem);
mutex_unlock(&block_subsys_lock);
kfree(p);

return ret;
Expand Down Expand Up @@ -301,7 +302,7 @@ static void *part_start(struct seq_file *part, loff_t *pos)
struct list_head *p;
loff_t l = *pos;

down(&block_subsys_sem);
mutex_lock(&block_subsys_lock);
list_for_each(p, &block_subsys.kset.list)
if (!l--)
return list_entry(p, struct gendisk, kobj.entry);
Expand All @@ -318,7 +319,7 @@ static void *part_next(struct seq_file *part, void *v, loff_t *pos)

static void part_stop(struct seq_file *part, void *v)
{
up(&block_subsys_sem);
mutex_unlock(&block_subsys_lock);
}

static int show_partition(struct seq_file *part, void *v)
Expand Down Expand Up @@ -377,7 +378,7 @@ static struct kobject *base_probe(dev_t dev, int *part, void *data)

static int __init genhd_device_init(void)
{
bdev_map = kobj_map_init(base_probe, &block_subsys_sem);
bdev_map = kobj_map_init(base_probe, &block_subsys_lock);
blk_dev_init();
subsystem_register(&block_subsys);
return 0;
Expand Down Expand Up @@ -611,7 +612,7 @@ static void *diskstats_start(struct seq_file *part, loff_t *pos)
loff_t k = *pos;
struct list_head *p;

down(&block_subsys_sem);
mutex_lock(&block_subsys_lock);
list_for_each(p, &block_subsys.kset.list)
if (!k--)
return list_entry(p, struct gendisk, kobj.entry);
Expand All @@ -628,7 +629,7 @@ static void *diskstats_next(struct seq_file *part, void *v, loff_t *pos)

static void diskstats_stop(struct seq_file *part, void *v)
{
up(&block_subsys_sem);
mutex_unlock(&block_subsys_lock);
}

static int diskstats_show(struct seq_file *s, void *v)
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int __devinit register_cpu(struct cpu *cpu, int num, struct node *root)
return error;
}

struct sys_device *get_cpu_sysdev(int cpu)
struct sys_device *get_cpu_sysdev(unsigned cpu)
{
if (cpu < NR_CPUS)
return cpu_sys_devices[cpu];
Expand Down
6 changes: 4 additions & 2 deletions drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,20 @@ static int
fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
{
u8 *new_data;
int new_size = fw_priv->alloc_size;

if (min_size <= fw_priv->alloc_size)
return 0;

new_data = vmalloc(fw_priv->alloc_size + PAGE_SIZE);
new_size = ALIGN(min_size, PAGE_SIZE);
new_data = vmalloc(new_size);
if (!new_data) {
printk(KERN_ERR "%s: unable to alloc buffer\n", __FUNCTION__);
/* Make sure that we don't keep incomplete data */
fw_load_abort(fw_priv);
return -ENOMEM;
}
fw_priv->alloc_size += PAGE_SIZE;
fw_priv->alloc_size = new_size;
if (fw_priv->fw->data) {
memcpy(new_data, fw_priv->fw->data, fw_priv->fw->size);
vfree(fw_priv->fw->data);
Expand Down
21 changes: 11 additions & 10 deletions drivers/base/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <linux/module.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/kdev_t.h>
#include <linux/kobject.h>
#include <linux/kobj_map.h>
Expand All @@ -25,7 +26,7 @@ struct kobj_map {
int (*lock)(dev_t, void *);
void *data;
} *probes[255];
struct semaphore *sem;
struct mutex *lock;
};

int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
Expand Down Expand Up @@ -53,15 +54,15 @@ int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
p->range = range;
p->data = data;
}
down(domain->sem);
mutex_lock(domain->lock);
for (i = 0, p -= n; i < n; i++, p++, index++) {
struct probe **s = &domain->probes[index % 255];
while (*s && (*s)->range < range)
s = &(*s)->next;
p->next = *s;
*s = p;
}
up(domain->sem);
mutex_unlock(domain->lock);
return 0;
}

Expand All @@ -75,7 +76,7 @@ void kobj_unmap(struct kobj_map *domain, dev_t dev, unsigned long range)
if (n > 255)
n = 255;

down(domain->sem);
mutex_lock(domain->lock);
for (i = 0; i < n; i++, index++) {
struct probe **s;
for (s = &domain->probes[index % 255]; *s; s = &(*s)->next) {
Expand All @@ -88,7 +89,7 @@ void kobj_unmap(struct kobj_map *domain, dev_t dev, unsigned long range)
}
}
}
up(domain->sem);
mutex_unlock(domain->lock);
kfree(found);
}

Expand All @@ -99,7 +100,7 @@ struct kobject *kobj_lookup(struct kobj_map *domain, dev_t dev, int *index)
unsigned long best = ~0UL;

retry:
down(domain->sem);
mutex_lock(domain->lock);
for (p = domain->probes[MAJOR(dev) % 255]; p; p = p->next) {
struct kobject *(*probe)(dev_t, int *, void *);
struct module *owner;
Expand All @@ -120,19 +121,19 @@ struct kobject *kobj_lookup(struct kobj_map *domain, dev_t dev, int *index)
module_put(owner);
continue;
}
up(domain->sem);
mutex_unlock(domain->lock);
kobj = probe(dev, index, data);
/* Currently ->owner protects _only_ ->probe() itself. */
module_put(owner);
if (kobj)
return kobj;
goto retry;
}
up(domain->sem);
mutex_unlock(domain->lock);
return NULL;
}

struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct semaphore *sem)
struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct mutex *lock)
{
struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL);
struct probe *base = kzalloc(sizeof(*base), GFP_KERNEL);
Expand All @@ -149,6 +150,6 @@ struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct semaphore *sem)
base->get = base_probe;
for (i = 0; i < 255; i++)
p->probes[i] = base;
p->sem = sem;
p->lock = lock;
return p;
}
4 changes: 2 additions & 2 deletions drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)
{
struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);

return r ? r->start : 0;
return r ? r->start : -ENXIO;
}
EXPORT_SYMBOL_GPL(platform_get_irq);

Expand Down Expand Up @@ -98,7 +98,7 @@ int platform_get_irq_byname(struct platform_device *dev, char *name)
{
struct resource *r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name);

return r ? r->start : 0;
return r ? r->start : -ENXIO;
}
EXPORT_SYMBOL_GPL(platform_get_irq_byname);

Expand Down
4 changes: 2 additions & 2 deletions drivers/char/s3c2410-rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -448,13 +448,13 @@ static int s3c2410_rtc_probe(struct platform_device *pdev)
/* find the IRQs */

s3c2410_rtc_tickno = platform_get_irq(pdev, 1);
if (s3c2410_rtc_tickno <= 0) {
if (s3c2410_rtc_tickno < 0) {
dev_err(&pdev->dev, "no irq for rtc tick\n");
return -ENOENT;
}

s3c2410_rtc_alarmno = platform_get_irq(pdev, 0);
if (s3c2410_rtc_alarmno <= 0) {
if (s3c2410_rtc_alarmno < 0) {
dev_err(&pdev->dev, "no irq for alarm\n");
return -ENOENT;
}
Expand Down
4 changes: 4 additions & 0 deletions drivers/char/watchdog/mpcore_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ static int __devinit mpcore_wdt_probe(struct platform_device *dev)

wdt->dev = &dev->dev;
wdt->irq = platform_get_irq(dev, 0);
if (wdt->irq < 0) {
ret = -ENXIO;
goto err_free;
}
wdt->base = ioremap(res->start, res->end - res->start + 1);
if (!wdt->base) {
ret = -ENOMEM;
Expand Down
Loading

0 comments on commit 08a4ece

Please sign in to comment.