Skip to content

Commit bca5165

Browse files
committed
Merge tag 'driver-core-3.18-rc1' of git://git.kernel.org/pub/scm/linux/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
2 parents 683a52a + 906d201 commit bca5165

16 files changed

Lines changed: 411 additions & 54 deletions

File tree

‎Documentation/driver-model/devres.txt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ IOMAP
281281

282282
IRQ
283283
devm_free_irq()
284+
devm_request_any_context_irq()
284285
devm_request_irq()
286+
devm_request_threaded_irq()
285287

286288
MDIO
287289
devm_mdiobus_alloc()
@@ -291,11 +293,14 @@ MDIO
291293
MEM
292294
devm_free_pages()
293295
devm_get_free_pages()
296+
devm_kasprintf()
294297
devm_kcalloc()
295298
devm_kfree()
296299
devm_kmalloc()
297300
devm_kmalloc_array()
298301
devm_kmemdup()
302+
devm_kstrdup()
303+
devm_kvasprintf()
299304
devm_kzalloc()
300305

301306
PCI

‎Documentation/sysfs-rules.txt‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,3 +161,24 @@ versions of the sysfs interface.
161161
the device that matches the expected subsystem. Depending on a specific
162162
position of a parent device or exposing relative paths using "../" to
163163
access the chain of parents is a bug in the application.
164+
165+
- When reading and writing sysfs device attribute files, avoid dependency
166+
on specific error codes wherever possible. This minimizes coupling to
167+
the error handling implementation within the kernel.
168+
169+
In general, failures to read or write sysfs device attributes shall
170+
propagate errors wherever possible. Common errors include, but are not
171+
limited to:
172+
173+
-EIO: The read or store operation is not supported, typically returned by
174+
the sysfs system itself if the read or store pointer is NULL.
175+
176+
-ENXIO: The read or store operation failed
177+
178+
Error codes will not be changed without good reason, and should a change
179+
to error codes result in user-space breakage, it will be fixed, or the
180+
the offending change will be reverted.
181+
182+
Userspace applications can, however, expect the format and contents of
183+
the attribute files to remain consistent in the absence of a version
184+
attribute change in the context of a given attribute.

‎MAINTAINERS‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,6 +2877,13 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git
28772877
S: Maintained
28782878
F: drivers/usb/dwc3/
28792879

2880+
DEVICE COREDUMP (DEV_COREDUMP)
2881+
M: Johannes Berg <johannes@sipsolutions.net>
2882+
L: linux-kernel@vger.kernel.org
2883+
S: Maintained
2884+
F: drivers/base/devcoredump.c
2885+
F: include/linux/devcoredump.h
2886+
28802887
DEVICE FREQUENCY (DEVFREQ)
28812888
M: MyungJoo Ham <myungjoo.ham@samsung.com>
28822889
M: Kyungmin Park <kyungmin.park@samsung.com>

‎drivers/base/Kconfig‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,27 @@ config FW_LOADER_USER_HELPER_FALLBACK
165165

166166
If you are unsure about this, say N here.
167167

168+
config WANT_DEV_COREDUMP
169+
bool
170+
help
171+
Drivers should "select" this option if they desire to use the
172+
device coredump mechanism.
173+
174+
config DISABLE_DEV_COREDUMP
175+
bool "Disable device coredump" if EXPERT
176+
help
177+
Disable the device coredump mechanism despite drivers wanting to
178+
use it; this allows for more sensitive systems or systems that
179+
don't want to ever access the information to not have the code,
180+
nor keep any data.
181+
182+
If unsure, say N.
183+
184+
config DEV_COREDUMP
185+
bool
186+
default y if WANT_DEV_COREDUMP
187+
depends on !DISABLE_DEV_COREDUMP
188+
168189
config DEBUG_DRIVER
169190
bool "Driver Core verbose debug messages"
170191
depends on DEBUG_KERNEL

‎drivers/base/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ obj-$(CONFIG_SYS_HYPERVISOR) += hypervisor.o
2121
obj-$(CONFIG_REGMAP) += regmap/
2222
obj-$(CONFIG_SOC_BUS) += soc.o
2323
obj-$(CONFIG_PINCTRL) += pinctrl.o
24+
obj-$(CONFIG_DEV_COREDUMP) += devcoredump.o
2425

2526
ccflags-$(CONFIG_DEBUG_DRIVER) := -DDEBUG
2627

‎drivers/base/attribute_container.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ int
7474
attribute_container_register(struct attribute_container *cont)
7575
{
7676
INIT_LIST_HEAD(&cont->node);
77-
klist_init(&cont->containers,internal_container_klist_get,
77+
klist_init(&cont->containers, internal_container_klist_get,
7878
internal_container_klist_put);
79-
79+
8080
mutex_lock(&attribute_container_mutex);
8181
list_add_tail(&cont->node, &attribute_container_list);
8282
mutex_unlock(&attribute_container_mutex);
@@ -104,14 +104,14 @@ attribute_container_unregister(struct attribute_container *cont)
104104
spin_unlock(&cont->containers.k_lock);
105105
mutex_unlock(&attribute_container_mutex);
106106
return retval;
107-
107+
108108
}
109109
EXPORT_SYMBOL_GPL(attribute_container_unregister);
110110

111111
/* private function used as class release */
112112
static void attribute_container_release(struct device *classdev)
113113
{
114-
struct internal_container *ic
114+
struct internal_container *ic
115115
= container_of(classdev, struct internal_container, classdev);
116116
struct device *dev = classdev->parent;
117117

@@ -184,8 +184,8 @@ attribute_container_add_device(struct device *dev,
184184
struct klist_node *n = klist_next(iter); \
185185
n ? container_of(n, typeof(*pos), member) : \
186186
({ klist_iter_exit(iter) ; NULL; }); \
187-
}) ) != NULL; )
188-
187+
})) != NULL;)
188+
189189

190190
/**
191191
* attribute_container_remove_device - make device eligible for removal.
@@ -247,7 +247,7 @@ attribute_container_remove_device(struct device *dev,
247247
* container, then use attribute_container_trigger() instead.
248248
*/
249249
void
250-
attribute_container_device_trigger(struct device *dev,
250+
attribute_container_device_trigger(struct device *dev,
251251
int (*fn)(struct attribute_container *,
252252
struct device *,
253253
struct device *))

‎drivers/base/core.c‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2007,6 +2007,8 @@ create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen)
20072007
return 0;
20082008

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

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

2043+
if (pos >= hdrlen)
2044+
goto overflow;
2045+
20412046
return pos;
2047+
2048+
overflow:
2049+
dev_WARN(dev, "device/subsystem name too long");
2050+
return 0;
20422051
}
20432052

20442053
int dev_vprintk_emit(int level, const struct device *dev,

‎drivers/base/dd.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static LIST_HEAD(deferred_probe_active_list);
5454
static struct workqueue_struct *deferred_wq;
5555
static atomic_t deferred_trigger_count = ATOMIC_INIT(0);
5656

57-
/**
57+
/*
5858
* deferred_probe_work_func() - Retry probing devices in the active list.
5959
*/
6060
static void deferred_probe_work_func(struct work_struct *work)

0 commit comments

Comments
 (0)