projects/linux·commit d6fb1db0

Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6

d6fb1db0 · Linus Torvalds <[email protected]> · 2010-05-21 10:48:32 -07:00

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (38 commits)
  net: Expose all network devices in a namespaces in sysfs
  hotplug: netns aware uevent_helper
  kobj: Send hotplug events in the proper namespace.
  netlink: Implment netlink_broadcast_filtered
  net/sysfs: Fix the bitrot in network device kobject namespace support
  netns: Teach network device kobjects which namespace they are in.
  kobject: Send hotplug events in all network namespaces
  driver-core: fix Typo in drivers/base/core.c for CONFIG_MODULE
  pci: check caps from sysfs file open to read device dependent config space
  sysfs: add struct file* to bin_attr callbacks
  sysfs: Remove usage of S_BIAS to avoid merge conflict with the vfs tree
  sysfs: Don't use enums in inline function declaration.
  sysfs-namespaces: add a high-level Documentation file
  sysfs: Comment sysfs directory tagging logic
  driver core: Implement ns directory support for device classes.
  sysfs: Implement sysfs_delete_link
  sysfs: Add support for tagged directories with untagged members.
  sysfs: Implement sysfs tagged directory support.
  kobj: Add basic infrastructure for dealing with namespaces.
  sysfs: Remove double free sysfs_get_sb
  ...
Commit
d6fb1db02e02aea98f2d7e121fd30e24c84639d6
Parents
b4e6b097 · a1b3f594

Merge commit. Changes below are compared with the first parent: b4e6b097.

Changes

94 files changed · +1165 −411

FileStatusAddDelContent
Documentation/filesystems/sysfs-tagging.txtadded+42−0View file
arch/alpha/kernel/pci-sysfs.cmodified+5−3View file
arch/mips/txx9/generic/setup.cmodified+2−2View file
arch/powerpc/sysdev/mv64x60_pci.cmodified+2−2View file
arch/s390/kernel/ipl.cmodified+8−6View file
drivers/acpi/system.cmodified+1−1View file
drivers/base/Kconfigmodified+5−2View file
drivers/base/class.cmodified+9−0View file
drivers/base/core.cmodified+100−30View file
drivers/base/cpu.cmodified+1−1View file
drivers/base/dd.cmodified+2−2View file
drivers/base/devtmpfs.cmodified+5−0View file
drivers/base/firmware_class.cmodified+116−90View file
drivers/base/module.cmodified+1−3View file
drivers/base/platform.cmodified+4−4View file
drivers/block/loop.cmodified+9−1View file
drivers/firmware/dcdbas.cmodified+2−2View file
drivers/firmware/dell_rbu.cmodified+5−5View file
drivers/firmware/efivars.cmodified+2−2View file
drivers/gpio/gpiolib.cmodified+1−1View file
drivers/gpu/drm/drm_sysfs.cmodified+3−2View file
drivers/md/bitmap.cmodified+2−2View file
drivers/md/md.cmodified+3−3View file
drivers/misc/c2port/core.cmodified+2−2View file
drivers/misc/ds1682.cmodified+4−2View file
drivers/misc/eeprom/at24.cmodified+4−2View file
drivers/misc/eeprom/at25.cmodified+4−2View file
drivers/misc/eeprom/eeprom.cmodified+2−1View file
drivers/misc/eeprom/max6875.cmodified+1−1View file
drivers/net/mlx4/mlx4.hmodified+1−0View file
drivers/net/netxen/netxen_nic_main.cmodified+7−4View file
drivers/net/qlcnic/qlcnic_main.cmodified+8−4View file
drivers/pci/hotplug/acpiphp_ibm.cmodified+3−2View file
drivers/pci/pci-sysfs.cmodified+32−13View file
drivers/pcmcia/cistpl.cmodified+2−2View file
drivers/power/olpc_battery.cmodified+1−1View file
drivers/rapidio/rio-sysfs.cmodified+4−2View file
drivers/rtc/rtc-cmos.cmodified+4−2View file
drivers/rtc/rtc-ds1305.cmodified+4−2View file
drivers/rtc/rtc-ds1307.cmodified+4−2View file
drivers/rtc/rtc-ds1511.cmodified+6−4View file
drivers/rtc/rtc-ds1553.cmodified+2−2View file
drivers/rtc/rtc-ds1742.cmodified+2−2View file
drivers/rtc/rtc-m48t59.cmodified+2−2View file
drivers/rtc/rtc-stk17ta8.cmodified+2−2View file
drivers/rtc/rtc-tx4939.cmodified+2−2View file
drivers/s390/cio/chp.cmodified+3−2View file
drivers/scsi/3w-sas.cmodified+2−2View file
drivers/scsi/arcmsr/arcmsr_attr.cmodified+6−3View file
drivers/scsi/ibmvscsi/ibmvfc.cmodified+2−1View file
drivers/scsi/ipr.cmodified+6−3View file
drivers/scsi/lpfc/lpfc_attr.cmodified+15−5View file
drivers/scsi/qla2xxx/qla_attr.cmodified+16−16View file
drivers/staging/comedi/drivers/quatech_daqp_cs.cmodified+1−0View file
drivers/staging/udlfb/udlfb.cmodified+2−1View file
drivers/usb/core/sysfs.cmodified+2−1View file
drivers/usb/core/usb.cmodified+1−1View file
drivers/video/aty/radeon_base.cmodified+2−2View file
drivers/w1/slaves/w1_ds2431.cmodified+2−2View file
drivers/w1/slaves/w1_ds2433.cmodified+2−2View file
drivers/w1/slaves/w1_ds2760.cmodified+1−1View file
drivers/w1/w1.cmodified+2−2View file
drivers/zorro/zorro-sysfs.cmodified+1−1View file
fs/ramfs/inode.cmodified+1−1View file
fs/sysfs/bin.cmodified+12−14View file
fs/sysfs/dir.cmodified+90−24View file
fs/sysfs/file.cmodified+10−7View file
fs/sysfs/group.cmodified+3−3View file
fs/sysfs/inode.cmodified+4−2View file
fs/sysfs/mount.cmodified+92−3View file
fs/sysfs/symlink.cmodified+32−3View file
fs/sysfs/sysfs.hmodified+30−4View file
include/linux/device.hmodified+7−5View file
include/linux/firmware.hmodified+1−0View file
include/linux/kobject.hmodified+38−0View file
include/linux/kref.hmodified+0−1View file
include/linux/lockdep.hmodified+8−0View file
include/linux/netlink.hmodified+4−0View file
include/linux/ramfs.hmodified+2−0View file
include/linux/sysfs.hmodified+23−3View file
kernel/ksysfs.cmodified+2−1View file
kernel/lockdep.cmodified+5−0View file
kernel/module.cmodified+1−1View file
kernel/user_namespace.cmodified+2−2View file
lib/kobject.cmodified+115−0View file
lib/kobject_uevent.cmodified+97−12View file
lib/kref.cmodified+2−13View file
net/bridge/br_sysfs_br.cmodified+1−1View file
net/core/dev.cmodified+5−23View file
net/core/net-sysfs.cmodified+47−16View file
net/core/net-sysfs.hmodified+0−1View file
net/netlink/af_netlink.cmodified+19−2View file
scripts/checkpatch.plmodified+11−0View file
security/integrity/ima/ima_iint.cmodified+2−2View file

Only the first 600 diff lines are shown. Download the complete patch.

Documentation/filesystems/sysfs-tagging.txt

View file
diff --git a/Documentation/filesystems/sysfs-tagging.txt b/Documentation/filesystems/sysfs-tagging.txt
new file mode 100644
index 0000000..caaaf12
--- /dev/null
+++ b/Documentation/filesystems/sysfs-tagging.txt
@@ -0,0 +1,42 @@
+Sysfs tagging
+-------------
+
+(Taken almost verbatim from Eric Biederman's netns tagging patch
+commit msg)
+
+The problem. Network devices show up in sysfs and with the network
+namespace active multiple devices with the same name can show up in
+the same directory, ouch!
+
+To avoid that problem and allow existing applications in network
+namespaces to see the same interface that is currently presented in
+sysfs, sysfs now has tagging directory support.
+
+By using the network namespace pointers as tags to separate out the
+the sysfs directory entries we ensure that we don't have conflicts
+in the directories and applications only see a limited set of
+the network devices.
+
+Each sysfs directory entry may be tagged with zero or one
+namespaces. A sysfs_dirent is augmented with a void *s_ns. If a
+directory entry is tagged, then sysfs_dirent->s_flags will have a
+flag between KOBJ_NS_TYPE_NONE and KOBJ_NS_TYPES, and s_ns will
+point to the namespace to which it belongs.
+
+Each sysfs superblock's sysfs_super_info contains an array void
+*ns[KOBJ_NS_TYPES]. When a a task in a tagging namespace
+kobj_nstype first mounts sysfs, a new superblock is created. It
+will be differentiated from other sysfs mounts by having its
+s_fs_info->ns[kobj_nstype] set to the new namespace. Note that
+through bind mounting and mounts propagation, a task can easily view
+the contents of other namespaces' sysfs mounts. Therefore, when a
+namespace exits, it will call kobj_ns_exit() to invalidate any
+sysfs_dirent->s_ns pointers pointing to it.
+
+Users of this interface:
+- define a type in the kobj_ns_type enumeration.
+- call kobj_ns_type_register() with its kobj_ns_type_operations which has
+ - current_ns() which returns current's namespace
+ - netlink_ns() which returns a socket's namespace
+ - initial_ns() which returns the initial namesapce
+- call kobj_ns_exit() when an individual tag is no longer valid

arch/alpha/kernel/pci-sysfs.c

View file
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c
index d979e7c..a5fffc8 100644
--- a/arch/alpha/kernel/pci-sysfs.c
+++ b/arch/alpha/kernel/pci-sysfs.c
@@ -53,6 +53,7 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
/**
* pci_mmap_resource - map a PCI resource into user memory space
+ * @filp: open sysfs file
* @kobj: kobject for mapping
* @attr: struct bin_attribute for the file being mapped
* @vma: struct vm_area_struct passed into the mmap
@@ -60,7 +61,8 @@ static int __pci_mmap_fits(struct pci_dev *pdev, int num,
*
* Use the bus mapping routines to map a PCI resource into userspace.
*/
-static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
+static int pci_mmap_resource(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *attr,
struct vm_area_struct *vma, int sparse)
{
struct pci_dev *pdev = to_pci_dev(container_of(kobj,
@@ -89,14 +91,14 @@ static int pci_mmap_resource(struct kobject *kobj, struct bin_attribute *attr,
return hose_mmap_page_range(pdev->sysdata, vma, mmap_type, sparse);
}
-static int pci_mmap_resource_sparse(struct kobject *kobj,
+static int pci_mmap_resource_sparse(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
struct vm_area_struct *vma)
{
return pci_mmap_resource(kobj, attr, vma, 1);
}
-static int pci_mmap_resource_dense(struct kobject *kobj,
+static int pci_mmap_resource_dense(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
struct vm_area_struct *vma)
{

arch/mips/txx9/generic/setup.c

View file
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index adc6929..575d219 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -905,7 +905,7 @@ struct txx9_sramc_sysdev {
void __iomem *base;
};
-static ssize_t txx9_sram_read(struct kobject *kobj,
+static ssize_t txx9_sram_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{
@@ -920,7 +920,7 @@ static ssize_t txx9_sram_read(struct kobject *kobj,
return size;
}
-static ssize_t txx9_sram_write(struct kobject *kobj,
+static ssize_t txx9_sram_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t pos, size_t size)
{

arch/powerpc/sysdev/mv64x60_pci.c

View file
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 1456015..198f288 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -24,7 +24,7 @@
#define MV64X60_VAL_LEN_MAX 11
#define MV64X60_PCICFG_CPCI_HOTSWAP 0x68
-static ssize_t mv64x60_hs_reg_read(struct kobject *kobj,
+static ssize_t mv64x60_hs_reg_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{
@@ -45,7 +45,7 @@ static ssize_t mv64x60_hs_reg_read(struct kobject *kobj,
return sprintf(buf, "0x%08x\n", v);
}
-static ssize_t mv64x60_hs_reg_write(struct kobject *kobj,
+static ssize_t mv64x60_hs_reg_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{

arch/s390/kernel/ipl.c

View file
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c
index 72c8b0d..a689070 100644
--- a/arch/s390/kernel/ipl.c
+++ b/arch/s390/kernel/ipl.c
@@ -403,8 +403,9 @@ static ssize_t sys_ipl_device_show(struct kobject *kobj,
static struct kobj_attribute sys_ipl_device_attr =
__ATTR(device, S_IRUGO, sys_ipl_device_show, NULL);
-static ssize_t ipl_parameter_read(struct kobject *kobj, struct bin_attribute *attr,
- char *buf, loff_t off, size_t count)
+static ssize_t ipl_parameter_read(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *attr, char *buf,
+ loff_t off, size_t count)
{
return memory_read_from_buffer(buf, count, &off, IPL_PARMBLOCK_START,
IPL_PARMBLOCK_SIZE);
@@ -419,8 +420,9 @@ static struct bin_attribute ipl_parameter_attr = {
.read = &ipl_parameter_read,
};
-static ssize_t ipl_scp_data_read(struct kobject *kobj, struct bin_attribute *attr,
- char *buf, loff_t off, size_t count)
+static ssize_t ipl_scp_data_read(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *attr, char *buf,
+ loff_t off, size_t count)
{
unsigned int size = IPL_PARMBLOCK_START->ipl_info.fcp.scp_data_len;
void *scp_data = &IPL_PARMBLOCK_START->ipl_info.fcp.scp_data;
@@ -694,7 +696,7 @@ static struct kobj_attribute sys_reipl_ccw_vmparm_attr =
/* FCP reipl device attributes */
-static ssize_t reipl_fcp_scpdata_read(struct kobject *kobj,
+static ssize_t reipl_fcp_scpdata_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{
@@ -704,7 +706,7 @@ static ssize_t reipl_fcp_scpdata_read(struct kobject *kobj,
return memory_read_from_buffer(buf, count, &off, scp_data, size);
}
-static ssize_t reipl_fcp_scpdata_write(struct kobject *kobj,
+static ssize_t reipl_fcp_scpdata_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr,
char *buf, loff_t off, size_t count)
{

drivers/acpi/system.c

View file
diff --git a/drivers/acpi/system.c b/drivers/acpi/system.c
index e35525b..c79e789 100644
--- a/drivers/acpi/system.c
+++ b/drivers/acpi/system.c
@@ -71,7 +71,7 @@ struct acpi_table_attr {
struct list_head node;
};
-static ssize_t acpi_table_show(struct kobject *kobj,
+static ssize_t acpi_table_show(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, char *buf,
loff_t offset, size_t count)
{

drivers/base/Kconfig

View file
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index fd52c48..ef38aff 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -18,9 +18,9 @@ config UEVENT_HELPER_PATH
config DEVTMPFS
bool "Maintain a devtmpfs filesystem to mount at /dev"
- depends on HOTPLUG && SHMEM && TMPFS
+ depends on HOTPLUG
help
- This creates a tmpfs filesystem instance early at bootup.
+ This creates a tmpfs/ramfs filesystem instance early at bootup.
In this filesystem, the kernel driver core maintains device
nodes with their default names and permissions for all
registered devices with an assigned major/minor number.
@@ -33,6 +33,9 @@ config DEVTMPFS
functional /dev without any further help. It also allows simple
rescue systems, and reliably handles dynamic major/minor numbers.
+ Notice: if CONFIG_TMPFS isn't enabled, the simpler ramfs
+ file system will be used instead.
+
config DEVTMPFS_MOUNT
bool "Automount devtmpfs at /dev, after the kernel mounted the rootfs"
depends on DEVTMPFS

drivers/base/class.c

View file
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 9c6a0d6..8e231d0 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -63,6 +63,14 @@ static void class_release(struct kobject *kobj)
kfree(cp);
}
+static const struct kobj_ns_type_operations *class_child_ns_type(struct kobject *kobj)
+{
+ struct class_private *cp = to_class(kobj);
+ struct class *class = cp->class;
+
+ return class->ns_type;
+}
+
static const struct sysfs_ops class_sysfs_ops = {
.show = class_attr_show,
.store = class_attr_store,
@@ -71,6 +79,7 @@ static const struct sysfs_ops class_sysfs_ops = {
static struct kobj_type class_ktype = {
.sysfs_ops = &class_sysfs_ops,
.release = class_release,
+ .child_ns_type = class_child_ns_type,
};
/* Hotplug events for classes go to the class class_subsys */

drivers/base/core.c

View file
diff --git a/drivers/base/core.c b/drivers/base/core.c
index b56a0ba..9630fbd 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -20,7 +20,6 @@
#include <linux/notifier.h>
#include <linux/genhd.h>
#include <linux/kallsyms.h>
-#include <linux/semaphore.h>
#include <linux/mutex.h>
#include <linux/async.h>
@@ -132,9 +131,21 @@ static void device_release(struct kobject *kobj)
kfree(p);
}
+static const void *device_namespace(struct kobject *kobj)
+{
+ struct device *dev = to_dev(kobj);
+ const void *ns = NULL;
+
+ if (dev->class && dev->class->ns_type)
+ ns = dev->class->namespace(dev);
+
+ return ns;
+}
+
static struct kobj_type device_ktype = {
.release = device_release,
.sysfs_ops = &dev_sysfs_ops,
+ .namespace = device_namespace,
};
@@ -559,10 +570,10 @@ void device_initialize(struct device *dev)
dev->kobj.kset = devices_kset;
kobject_init(&dev->kobj, &device_ktype);
INIT_LIST_HEAD(&dev->dma_pools);
- init_MUTEX(&dev->sem);
+ mutex_init(&dev->mutex);
+ lockdep_set_novalidate_class(&dev->mutex);
spin_lock_init(&dev->devres_lock);
INIT_LIST_HEAD(&dev->devres_head);
- device_init_wakeup(dev, 0);
device_pm_init(dev);
set_dev_node(dev, -1);
}
@@ -596,11 +607,59 @@ static struct kobject *virtual_device_parent(struct device *dev)
return virtual_dir;
}
-static struct kobject *get_device_parent(struct device *dev,
- struct device *parent)
+struct class_dir {
+ struct kobject kobj;
+ struct class *class;
+};
+
+#define to_class_dir(obj) container_of(obj, struct class_dir, kobj)
+
+static void class_dir_release(struct kobject *kobj)
+{
+ struct class_dir *dir = to_class_dir(kobj);
+ kfree(dir);
+}
+
+static const
+struct kobj_ns_type_operations *class_dir_child_ns_type(struct kobject *kobj)
{
+ struct class_dir *dir = to_class_dir(kobj);
+ return dir->class->ns_type;
+}
+
+static struct kobj_type class_dir_ktype = {
+ .release = class_dir_release,
+ .sysfs_ops = &kobj_sysfs_ops,
+ .child_ns_type = class_dir_child_ns_type
+};
+
+static struct kobject *
+class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
+{
+ struct class_dir *dir;
int retval;
+ dir = kzalloc(sizeof(*dir), GFP_KERNEL);
+ if (!dir)
+ return NULL;
+
+ dir->class = class;
+ kobject_init(&dir->kobj, &class_dir_ktype);
+
+ dir->kobj.kset = &class->p->class_dirs;
+
+ retval = kobject_add(&dir->kobj, parent_kobj, "%s", class->name);
+ if (retval < 0) {
+ kobject_put(&dir->kobj);
+ return NULL;
+ }
+ return &dir->kobj;
+}
+
+
+static struct kobject *get_device_parent(struct device *dev,
+ struct device *parent)
+{
if (dev->class) {
static DEFINE_MUTEX(gdp_mutex);
struct kobject *kobj = NULL;
@@ -635,18 +694,7 @@ static struct kobject *get_device_parent(struct device *dev,
}
/* or create a new class-directory at the parent device */
- k = kobject_create();
- if (!k) {
- mutex_unlock(&gdp_mutex);
- return NULL;
- }
- k->kset = &dev->class->p->class_dirs;
- retval = kobject_add(k, parent_kobj, "%s", dev->class->name);
- if (retval < 0) {
- mutex_unlock(&gdp_mutex);
- kobject_put(k);
- return NULL;
- }
+ k = class_dir_create_and_add(dev->class, parent_kobj);
/* do not emit an uevent for this simple "glue" directory */
mutex_unlock(&gdp_mutex);
return k;
@@ -738,7 +786,7 @@ out_device:
out_busid:
if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
device_is_not_partition(dev))
- sysfs_remove_link(&dev->class->p->class_subsys.kobj,
+ sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj,
dev_name(dev));
#else
/* link in the class directory pointing to the device */
@@ -756,7 +804,7 @@ out_busid:
return 0;
out_busid:
- sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev));
+ sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
#endif
out_subsys:
@@ -784,13 +832,13 @@ static void device_remove_class_symlinks(struct device *dev)
if (dev->kobj.parent != &dev->class->p->class_subsys.kobj &&
device_is_not_partition(dev))
- sysfs_remove_link(&dev->class->p->class_subsys.kobj,
+ sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj,
dev_name(dev));
#else
if (dev->parent && device_is_not_partition(dev))
sysfs_remove_link(&dev->kobj, "device");
- sysfs_remove_link(&dev->class->p->class_subsys.kobj, dev_name(dev));
+ sysfs_delete_link(&dev->class->p->class_subsys.kobj, &dev->kobj, dev_name(dev));
#endif
sysfs_remove_link(&dev->kobj, "subsystem");
@@ -1372,7 +1420,7 @@ struct device *__root_device_register(const char *name, struct module *owner)
return ERR_PTR(err);
}
-#ifdef CONFIG_MODULE /* gotta find a "cleaner" way to do this */
+#ifdef CONFIG_MODULES /* gotta find a "cleaner" way to do this */
if (owner) {
struct module_kobject *mk = &owner->mkobj;
@@ -1576,6 +1624,14 @@ int device_rename(struct device *dev, char *new_name)
goto out;
}
+#ifndef CONFIG_SYSFS_DEPRECATED
+ if (dev->class) {
+ error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
+ &dev->kobj, old_device_name, new_name);
+ if (error)
+ goto out;
+ }
+#endif
error = kobject_rename(&dev->kobj, new_name);
if (error)
goto out;
@@ -1590,11 +1646,6 @@ int device_rename(struct device *dev, char *new_name)
new_class_name);
}
}
-#else
- if (dev->class) {
- error = sysfs_rename_link(&dev->class->p->class_subsys.kobj,
- &dev->kobj, old_device_name, new_name);
- }
#endif
out:
@@ -1735,10 +1786,25 @@ EXPORT_SYMBOL_GPL(device_move);
*/
void device_shutdown(void)
{
- struct device *dev, *devn;
+ struct device *dev;
+
+ spin_lock(&devices_kset->list_lock);
+ /*
+ * Walk the devices list backward, shutting down each in turn.
+ * Beware that device unplug events may also start pulling
+ * devices offline, even as the system is shutting down.
+ */
+ while (!list_empty(&devices_kset->list)) {
+ dev = list_entry(devices_kset->list.prev, struct device,
+ kobj.entry);
+ get_device(dev);
+ /*
+ * Make sure the device is off the kset list, in the
+ * event that dev->*->shutdown() doesn't remove it.
+ */
+ list_del_init(&dev->kobj.entry);
+ spin_unlock(&devices_kset->list_lock);
- list_for_each_entry_safe_reverse(dev, devn, &devices_kset->list,
- kobj.entry) {
if (dev->bus && dev->bus->shutdown) {
dev_dbg(dev, "shutdown\n");
dev->bus->shutdown(dev);
@@ -1746,6 +1812,10 @@ void device_shutdown(void)
dev_dbg(dev, "shutdown\n");
dev->driver->shutdown(dev);
}
+ put_device(dev);
+
+ spin_lock(&devices_kset->list_lock);
}
+ spin_unlock(&devices_kset->list_lock);
async_synchronize_full();
}

drivers/base/cpu.c

View file
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index f35719a..251acea 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -186,7 +186,7 @@ static ssize_t print_cpus_offline(struct sysdev_class *class,
/* display offline cpus < nr_cpu_ids */
if (!alloc_cpumask_var(&offline, GFP_KERNEL))
return -ENOMEM;
- cpumask_complement(offline, cpu_online_mask);
+ cpumask_andnot(offline, cpu_possible_mask, cpu_online_mask);
n = cpulist_scnprintf(buf, len, offline);
free_cpumask_var(offline);

drivers/base/dd.c

View file
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index c89291f..503c262 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -40,11 +40,11 @@ static void driver_bound(struct device *dev)
pr_debug("driver: '%s': %s: bound to device '%s'\n", dev_name(dev),
__func__, dev->driver->name);
+ klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
+
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_BOUND_DRIVER, dev);
-
- klist_add_tail(&dev->p->knode_driver, &dev->driver->p->klist_devices);
}
static int driver_sysfs_add(struct device *dev)

drivers/base/devtmpfs.c

View file
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 057cf11..af06001 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -20,6 +20,7 @@
#include <linux/namei.h>
#include <linux/fs.h>
#include <linux/shmem_fs.h>
+#include <linux/ramfs.h>
#include <linux/cred.h>
#include <linux/sched.h>
#include <linux/init_task.h>
@@ -45,7 +46,11 @@ __setup("devtmpfs.mount=", mount_param);
static int dev_get_sb(struct file_system_type *fs_type, int flags,
const char *dev_name, void *data, struct vfsmount *mnt)
{
+#ifdef CONFIG_TMPFS
return get_sb_single(fs_type, flags, data, shmem_fill_super, mnt);
+#else
+ return get_sb_single(fs_type, flags, data, ramfs_fill_super, mnt);
+#endif
}
static struct file_system_type dev_fs_type = {

drivers/base/firmware_class.c

View file
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 985da11..3f093b0 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -27,6 +27,52 @@ MODULE_AUTHOR("Manuel Estrada Sainz");
MODULE_DESCRIPTION("Multi purpose firmware loading support");
MODULE_LICENSE("GPL");
+/* Builtin firmware support */
+
+#ifdef CONFIG_FW_LOADER
+
+extern struct builtin_fw __start_builtin_fw[];
+extern struct builtin_fw __end_builtin_fw[];
+
+static bool fw_get_builtin_firmware(struct firmware *fw, const char *name)
+{
+ struct builtin_fw *b_fw;
+
+ for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++) {
+ if (strcmp(name, b_fw->name) == 0) {
+ fw->size = b_fw->size;
+ fw->data = b_fw->data;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+static bool fw_is_builtin_firmware(const struct firmware *fw)
+{
+ struct builtin_fw *b_fw;
+
+ for (b_fw = __start_builtin_fw; b_fw != __end_builtin_fw; b_fw++)
+ if (fw->data == b_fw->data)
+ return true;
+
+ return false;
+}
+
+#else /* Module case - no builtin firmware support */
+
+static inline bool fw_get_builtin_firmware(struct firmware *fw, const char *name)
+{
+ return false;
+}
+
+static inline bool fw_is_builtin_firmware(const struct firmware *fw)
+{
+ return false;
+}
+#endif
+
enum {
FW_STATUS_LOADING,
FW_STATUS_DONE,
@@ -40,7 +86,6 @@ static int loading_timeout = 60; /* In seconds */
static DEFINE_MUTEX(fw_lock);
struct firmware_priv {
- char *fw_id;
struct completion completion;

This diff is incomplete. Download the complete patch.

drivers/base/module.c

View file

This diff is incomplete. Download the complete patch.

drivers/base/platform.c

View file

This diff is incomplete. Download the complete patch.

drivers/block/loop.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/dcdbas.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/dell_rbu.c

View file

This diff is incomplete. Download the complete patch.

drivers/firmware/efivars.c

View file

This diff is incomplete. Download the complete patch.

drivers/gpio/gpiolib.c

View file

This diff is incomplete. Download the complete patch.

drivers/gpu/drm/drm_sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/bitmap.c

View file

This diff is incomplete. Download the complete patch.

drivers/md/md.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/c2port/core.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/ds1682.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/eeprom/at24.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/eeprom/at25.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/eeprom/eeprom.c

View file

This diff is incomplete. Download the complete patch.

drivers/misc/eeprom/max6875.c

View file

This diff is incomplete. Download the complete patch.

drivers/net/mlx4/mlx4.h

View file

This diff is incomplete. Download the complete patch.

drivers/net/netxen/netxen_nic_main.c

View file

This diff is incomplete. Download the complete patch.

drivers/net/qlcnic/qlcnic_main.c

View file

This diff is incomplete. Download the complete patch.

drivers/pci/hotplug/acpiphp_ibm.c

View file

This diff is incomplete. Download the complete patch.

drivers/pci/pci-sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/pcmcia/cistpl.c

View file

This diff is incomplete. Download the complete patch.

drivers/power/olpc_battery.c

View file

This diff is incomplete. Download the complete patch.

drivers/rapidio/rio-sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-cmos.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-ds1305.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-ds1307.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-ds1511.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-ds1553.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-ds1742.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-m48t59.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-stk17ta8.c

View file

This diff is incomplete. Download the complete patch.

drivers/rtc/rtc-tx4939.c

View file

This diff is incomplete. Download the complete patch.

drivers/s390/cio/chp.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/3w-sas.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/arcmsr/arcmsr_attr.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/ibmvscsi/ibmvfc.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/ipr.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/lpfc/lpfc_attr.c

View file

This diff is incomplete. Download the complete patch.

drivers/scsi/qla2xxx/qla_attr.c

View file

This diff is incomplete. Download the complete patch.

drivers/staging/comedi/drivers/quatech_daqp_cs.c

View file

This diff is incomplete. Download the complete patch.

drivers/staging/udlfb/udlfb.c

View file

This diff is incomplete. Download the complete patch.

drivers/usb/core/sysfs.c

View file

This diff is incomplete. Download the complete patch.

drivers/usb/core/usb.c

View file

This diff is incomplete. Download the complete patch.

drivers/video/aty/radeon_base.c

View file

This diff is incomplete. Download the complete patch.

drivers/w1/slaves/w1_ds2431.c

View file

This diff is incomplete. Download the complete patch.

drivers/w1/slaves/w1_ds2433.c

View file

This diff is incomplete. Download the complete patch.

drivers/w1/slaves/w1_ds2760.c

View file

This diff is incomplete. Download the complete patch.

drivers/w1/w1.c

View file

This diff is incomplete. Download the complete patch.

drivers/zorro/zorro-sysfs.c

View file

This diff is incomplete. Download the complete patch.

fs/ramfs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/bin.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/dir.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/file.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/group.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/inode.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/mount.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/symlink.c

View file

This diff is incomplete. Download the complete patch.

fs/sysfs/sysfs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/device.h

View file

This diff is incomplete. Download the complete patch.

include/linux/firmware.h

View file

This diff is incomplete. Download the complete patch.

include/linux/kobject.h

View file

This diff is incomplete. Download the complete patch.

include/linux/kref.h

View file

This diff is incomplete. Download the complete patch.

include/linux/lockdep.h

View file

This diff is incomplete. Download the complete patch.

include/linux/netlink.h

View file

This diff is incomplete. Download the complete patch.

include/linux/ramfs.h

View file

This diff is incomplete. Download the complete patch.

include/linux/sysfs.h

View file

This diff is incomplete. Download the complete patch.

kernel/ksysfs.c

View file

This diff is incomplete. Download the complete patch.

kernel/lockdep.c

View file

This diff is incomplete. Download the complete patch.

kernel/module.c

View file

This diff is incomplete. Download the complete patch.

kernel/user_namespace.c

View file

This diff is incomplete. Download the complete patch.

lib/kobject.c

View file

This diff is incomplete. Download the complete patch.

lib/kobject_uevent.c

View file

This diff is incomplete. Download the complete patch.

lib/kref.c

View file

This diff is incomplete. Download the complete patch.

net/bridge/br_sysfs_br.c

View file

This diff is incomplete. Download the complete patch.

net/core/dev.c

View file

This diff is incomplete. Download the complete patch.

net/core/net-sysfs.c

View file

This diff is incomplete. Download the complete patch.

net/core/net-sysfs.h

View file

This diff is incomplete. Download the complete patch.

net/netlink/af_netlink.c

View file

This diff is incomplete. Download the complete patch.

scripts/checkpatch.pl

View file

This diff is incomplete. Download the complete patch.

security/integrity/ima/ima_iint.c

View file

This diff is incomplete. Download the complete patch.