Skip to content

Commit

Permalink
Merge tag 'driver-core-3.18-rc1' of git://git.kernel.org/pub/scm/linu…
Browse files Browse the repository at this point in the history
…x/kernel/git/gregkh/driver-core

Pull driver core update from Greg KH:
 "Here's the driver core patches for 3.18-rc1.  Just a few small things,
  and the addition of a new interface to dump firmware "core dumps" to
  userspace through sysfs that the wireless and graphic drivers want to
  use.

  All of these have been in linux-next for a while"

* tag 'driver-core-3.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
  dynamic_debug: change __dynamic_<foo>_dbg return types to void
  driver/base/node: remove unnecessary kfree of node struct from unregister_one_node
  devres: Improve devm_kasprintf()/kvasprintf() support
  Documentation: devres: Add missing devm_kstrdup() managed interface
  Documentation: devres: Add missing IRQ functions
  firmware_class: make sure fw requests contain a name
  driver core: Remove kerneldoc from local function
  attribute_container: fix coding style issues
  attribute_container: fix whitespace errors
  drivers/base: Fix length checks in create_syslog_header()/dev_vprintk_emit()
  device coredump: add new device coredump class
  Documentation/sysfs-rules.txt: Add device attribute error code documentation
  • Loading branch information
Linus Torvalds committed Oct 8, 2014
2 parents 683a52a + 906d201 commit bca5165
Show file tree
Hide file tree
Showing 16 changed files with 411 additions and 54 deletions.
5 changes: 5 additions & 0 deletions Documentation/driver-model/devres.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ IOMAP

IRQ
devm_free_irq()
devm_request_any_context_irq()
devm_request_irq()
devm_request_threaded_irq()

MDIO
devm_mdiobus_alloc()
Expand All @@ -291,11 +293,14 @@ MDIO
MEM
devm_free_pages()
devm_get_free_pages()
devm_kasprintf()
devm_kcalloc()
devm_kfree()
devm_kmalloc()
devm_kmalloc_array()
devm_kmemdup()
devm_kstrdup()
devm_kvasprintf()
devm_kzalloc()

PCI
Expand Down
21 changes: 21 additions & 0 deletions Documentation/sysfs-rules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,24 @@ versions of the sysfs interface.
the device that matches the expected subsystem. Depending on a specific
position of a parent device or exposing relative paths using "../" to
access the chain of parents is a bug in the application.

- When reading and writing sysfs device attribute files, avoid dependency
on specific error codes wherever possible. This minimizes coupling to
the error handling implementation within the kernel.

In general, failures to read or write sysfs device attributes shall
propagate errors wherever possible. Common errors include, but are not
limited to:

-EIO: The read or store operation is not supported, typically returned by
the sysfs system itself if the read or store pointer is NULL.

-ENXIO: The read or store operation failed

Error codes will not be changed without good reason, and should a change
to error codes result in user-space breakage, it will be fixed, or the
the offending change will be reverted.

Userspace applications can, however, expect the format and contents of
the attribute files to remain consistent in the absence of a version
attribute change in the context of a given attribute.
7 changes: 7 additions & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2877,6 +2877,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
S: Maintained
F: drivers/usb/dwc3/

DEVICE COREDUMP (DEV_COREDUMP)
M: Johannes Berg <johannes@sipsolutions.net>
L: linux-kernel@vger.kernel.org
S: Maintained
F: drivers/base/devcoredump.c
F: include/linux/devcoredump.h

DEVICE FREQUENCY (DEVFREQ)
M: MyungJoo Ham <myungjoo.ham@samsung.com>
M: Kyungmin Park <kyungmin.park@samsung.com>
Expand Down
21 changes: 21 additions & 0 deletions drivers/base/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,27 @@ config FW_LOADER_USER_HELPER_FALLBACK

If you are unsure about this, say N here.

config WANT_DEV_COREDUMP
bool
help
Drivers should "select" this option if they desire to use the
device coredump mechanism.

config DISABLE_DEV_COREDUMP
bool "Disable device coredump" if EXPERT
help
Disable the device coredump mechanism despite drivers wanting to
use it; this allows for more sensitive systems or systems that
don't want to ever access the information to not have the code,
nor keep any data.

If unsure, say N.

config DEV_COREDUMP
bool
default y if WANT_DEV_COREDUMP
depends on !DISABLE_DEV_COREDUMP

config DEBUG_DRIVER
bool "Driver Core verbose debug messages"
depends on DEBUG_KERNEL
Expand Down
1 change: 1 addition & 0 deletions drivers/base/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o
obj-$(CONFIG_REGMAP) += regmap/
obj-$(CONFIG_SOC_BUS) += soc.o
obj-$(CONFIG_PINCTRL) += pinctrl.o
obj-$(CONFIG_DEV_COREDUMP) += devcoredump.o

ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG

14 changes: 7 additions & 7 deletions drivers/base/attribute_container.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ int
attribute_container_register(struct attribute_container *cont)
{
INIT_LIST_HEAD(&cont->node);
klist_init(&cont->containers,internal_container_klist_get,
klist_init(&cont->containers, internal_container_klist_get,
internal_container_klist_put);

mutex_lock(&attribute_container_mutex);
list_add_tail(&cont->node, &attribute_container_list);
mutex_unlock(&attribute_container_mutex);
Expand Down Expand Up @@ -104,14 +104,14 @@ attribute_container_unregister(struct attribute_container *cont)
spin_unlock(&cont->containers.k_lock);
mutex_unlock(&attribute_container_mutex);
return retval;

}
EXPORT_SYMBOL_GPL(attribute_container_unregister);

/* private function used as class release */
static void attribute_container_release(struct device *classdev)
{
struct internal_container *ic
struct internal_container *ic
= container_of(classdev, struct internal_container, classdev);
struct device *dev = classdev->parent;

Expand Down Expand Up @@ -184,8 +184,8 @@ attribute_container_add_device(struct device *dev,
struct klist_node *n = klist_next(iter); \
n ? container_of(n, typeof(*pos), member) : \
({ klist_iter_exit(iter) ; NULL; }); \
}) ) != NULL; )
})) != NULL;)


/**
* attribute_container_remove_device - make device eligible for removal.
Expand Down Expand Up @@ -247,7 +247,7 @@ attribute_container_remove_device(struct device *dev,
* container, then use attribute_container_trigger() instead.
*/
void
attribute_container_device_trigger(struct device *dev,
attribute_container_device_trigger(struct device *dev,
int (*fn)(struct attribute_container *,
struct device *,
struct device *))
Expand Down
9 changes: 9 additions & 0 deletions drivers/base/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2007,6 +2007,8 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen)
return 0;

pos += snprintf(hdr + pos, hdrlen - pos, "SUBSYSTEM=%s", subsys);
if (pos >= hdrlen)
goto overflow;

/*
* Add device identifier DEVICE=:
Expand Down Expand Up @@ -2038,7 +2040,14 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen)
"DEVICE=+%s:%s", subsys, dev_name(dev));
}

if (pos >= hdrlen)
goto overflow;

return pos;

overflow:
dev_WARN(dev, "device/subsystem name too long");
return 0;
}

int dev_vprintk_emit(int level, const struct device *dev,
Expand Down
2 changes: 1 addition & 1 deletion drivers/base/dd.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ static LIST_HEAD(deferred_probe_active_list);
static struct workqueue_struct *deferred_wq;
static atomic_t deferred_trigger_count = ATOMIC_INIT(0);

/**
/*
* deferred_probe_work_func() - Retry probing devices in the active list.
*/
static void deferred_probe_work_func(struct work_struct *work)
Expand Down
Loading

0 comments on commit bca5165

Please sign in to comment.