aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 19:02:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-22 19:02:13 -0400
commit5d4e2d08e7fdf7339f84a1c670d296a77e02f881 (patch)
tree1c419660defa56191091dfdf50fdb57a72009173 /drivers/base
parentfb2123fad3b499f0898835b19dbb93b18d27ee98 (diff)
parent94ca629e40eb7e997be21d8065c25e4f3797b03f (diff)
Merge tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg Kroah-Hartman: "Here's the driver core, and other driver subsystems, pull request for the 3.5-rc1 merge window. Outside of a few minor driver core changes, we ended up with the following different subsystem and core changes as well, due to interdependancies on the driver core: - hyperv driver updates - drivers/memory being created and some drivers moved into it - extcon driver subsystem created out of the old Android staging switch driver code - dynamic debug updates - printk rework, and /dev/kmsg changes All of this has been tested in the linux-next releases for a few weeks with no reported problems. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fix up conflicts in drivers/extcon/extcon-max8997.c where git noticed that a patch to the deleted drivers/misc/max8997-muic.c driver needs to be applied to this one. * tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (90 commits) uio_pdrv_genirq: get irq through platform resource if not set otherwise memory: tegra{20,30}-mc: Remove empty *_remove() printk() - isolate KERN_CONT users from ordinary complete lines sysfs: get rid of some lockdep false positives Drivers: hv: util: Properly handle version negotiations. Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp() memory: tegra{20,30}-mc: Use dev_err_ratelimited() driver core: Add dev_*_ratelimited() family Driver Core: don't oops with unregistered driver in driver_find_device() printk() - restore prefix/timestamp printing for multi-newline strings printk: add stub for prepend_timestamp() ARM: tegra30: Make MC optional in Kconfig ARM: tegra20: Make MC optional in Kconfig ARM: tegra30: MC: Remove unnecessary BUG*() ARM: tegra20: MC: Remove unnecessary BUG*() printk: correctly align __log_buf ARM: tegra30: Add Tegra Memory Controller(MC) driver ARM: tegra20: Add Tegra Memory Controller(MC) driver printk() - restore timestamp printing at console output printk() - do not merge continuation lines of different threads ...
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/bus.c3
-rw-r--r--drivers/base/core.c58
-rw-r--r--drivers/base/devres.c35
-rw-r--r--drivers/base/devtmpfs.c6
-rw-r--r--drivers/base/dma-buf.c12
-rw-r--r--drivers/base/driver.c2
6 files changed, 98 insertions, 18 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 26a06b801b5b..2bcef657a60c 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -21,8 +21,7 @@
21#include "power/power.h" 21#include "power/power.h"
22 22
23/* /sys/devices/system */ 23/* /sys/devices/system */
24/* FIXME: make static after drivers/base/sys.c is deleted */ 24static struct kset *system_kset;
25struct kset *system_kset;
26 25
27#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) 26#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
28 27
diff --git a/drivers/base/core.c b/drivers/base/core.c
index e28ce9898af4..346be8b78b24 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -25,6 +25,7 @@
25#include <linux/mutex.h> 25#include <linux/mutex.h>
26#include <linux/async.h> 26#include <linux/async.h>
27#include <linux/pm_runtime.h> 27#include <linux/pm_runtime.h>
28#include <linux/netdevice.h>
28 29
29#include "base.h" 30#include "base.h"
30#include "power/power.h" 31#include "power/power.h"
@@ -65,7 +66,7 @@ static inline int device_is_not_partition(struct device *dev)
65 * @dev: struct device to get the name of 66 * @dev: struct device to get the name of
66 * 67 *
67 * Will return the device's driver's name if it is bound to a device. If 68 * Will return the device's driver's name if it is bound to a device. If
68 * the device is not bound to a device, it will return the name of the bus 69 * the device is not bound to a driver, it will return the name of the bus
69 * it is attached to. If it is not attached to a bus either, an empty 70 * it is attached to. If it is not attached to a bus either, an empty
70 * string will be returned. 71 * string will be returned.
71 */ 72 */
@@ -878,8 +879,8 @@ EXPORT_SYMBOL_GPL(dev_set_name);
878 * to NULL prevents an entry from being created. class->dev_kobj must 879 * to NULL prevents an entry from being created. class->dev_kobj must
879 * be set (or cleared) before any devices are registered to the class 880 * be set (or cleared) before any devices are registered to the class
880 * otherwise device_create_sys_dev_entry() and 881 * otherwise device_create_sys_dev_entry() and
881 * device_remove_sys_dev_entry() will disagree about the the presence 882 * device_remove_sys_dev_entry() will disagree about the presence of
882 * of the link. 883 * the link.
883 */ 884 */
884static struct kobject *device_to_dev_kobj(struct device *dev) 885static struct kobject *device_to_dev_kobj(struct device *dev)
885{ 886{
@@ -1843,15 +1844,60 @@ void device_shutdown(void)
1843 */ 1844 */
1844 1845
1845#ifdef CONFIG_PRINTK 1846#ifdef CONFIG_PRINTK
1846
1847int __dev_printk(const char *level, const struct device *dev, 1847int __dev_printk(const char *level, const struct device *dev,
1848 struct va_format *vaf) 1848 struct va_format *vaf)
1849{ 1849{
1850 char dict[128];
1851 size_t dictlen = 0;
1852 const char *subsys;
1853
1850 if (!dev) 1854 if (!dev)
1851 return printk("%s(NULL device *): %pV", level, vaf); 1855 return printk("%s(NULL device *): %pV", level, vaf);
1852 1856
1853 return printk("%s%s %s: %pV", 1857 if (dev->class)
1854 level, dev_driver_string(dev), dev_name(dev), vaf); 1858 subsys = dev->class->name;
1859 else if (dev->bus)
1860 subsys = dev->bus->name;
1861 else
1862 goto skip;
1863
1864 dictlen += snprintf(dict + dictlen, sizeof(dict) - dictlen,
1865 "SUBSYSTEM=%s", subsys);
1866
1867 /*
1868 * Add device identifier DEVICE=:
1869 * b12:8 block dev_t
1870 * c127:3 char dev_t
1871 * n8 netdev ifindex
1872 * +sound:card0 subsystem:devname
1873 */
1874 if (MAJOR(dev->devt)) {
1875 char c;
1876
1877 if (strcmp(subsys, "block") == 0)
1878 c = 'b';
1879 else
1880 c = 'c';
1881 dictlen++;
1882 dictlen += snprintf(dict + dictlen, sizeof(dict) - dictlen,
1883 "DEVICE=%c%u:%u",
1884 c, MAJOR(dev->devt), MINOR(dev->devt));
1885 } else if (strcmp(subsys, "net") == 0) {
1886 struct net_device *net = to_net_dev(dev);
1887
1888 dictlen++;
1889 dictlen += snprintf(dict + dictlen, sizeof(dict) - dictlen,
1890 "DEVICE=n%u", net->ifindex);
1891 } else {
1892 dictlen++;
1893 dictlen += snprintf(dict + dictlen, sizeof(dict) - dictlen,
1894 "DEVICE=+%s:%s", subsys, dev_name(dev));
1895 }
1896skip:
1897 return printk_emit(0, level[1] - '0',
1898 dictlen ? dict : NULL, dictlen,
1899 "%s %s: %pV",
1900 dev_driver_string(dev), dev_name(dev), vaf);
1855} 1901}
1856EXPORT_SYMBOL(__dev_printk); 1902EXPORT_SYMBOL(__dev_printk);
1857 1903
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 524bf96c289f..2360adb7a58f 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -309,6 +309,10 @@ EXPORT_SYMBOL_GPL(devres_remove);
309 * which @match returns 1. If @match is NULL, it's considered to 309 * which @match returns 1. If @match is NULL, it's considered to
310 * match all. If found, the resource is removed atomically and freed. 310 * match all. If found, the resource is removed atomically and freed.
311 * 311 *
312 * Note that the release function for the resource will not be called,
313 * only the devres-allocated data will be freed. The caller becomes
314 * responsible for freeing any other data.
315 *
312 * RETURNS: 316 * RETURNS:
313 * 0 if devres is found and freed, -ENOENT if not found. 317 * 0 if devres is found and freed, -ENOENT if not found.
314 */ 318 */
@@ -326,6 +330,37 @@ int devres_destroy(struct device *dev, dr_release_t release,
326} 330}
327EXPORT_SYMBOL_GPL(devres_destroy); 331EXPORT_SYMBOL_GPL(devres_destroy);
328 332
333
334/**
335 * devres_release - Find a device resource and destroy it, calling release
336 * @dev: Device to find resource from
337 * @release: Look for resources associated with this release function
338 * @match: Match function (optional)
339 * @match_data: Data for the match function
340 *
341 * Find the latest devres of @dev associated with @release and for
342 * which @match returns 1. If @match is NULL, it's considered to
343 * match all. If found, the resource is removed atomically, the
344 * release function called and the resource freed.
345 *
346 * RETURNS:
347 * 0 if devres is found and freed, -ENOENT if not found.
348 */
349int devres_release(struct device *dev, dr_release_t release,
350 dr_match_t match, void *match_data)
351{
352 void *res;
353
354 res = devres_remove(dev, release, match, match_data);
355 if (unlikely(!res))
356 return -ENOENT;
357
358 (*release)(dev, res);
359 devres_free(res);
360 return 0;
361}
362EXPORT_SYMBOL_GPL(devres_release);
363
329static int remove_nodes(struct device *dev, 364static int remove_nodes(struct device *dev,
330 struct list_head *first, struct list_head *end, 365 struct list_head *first, struct list_head *end,
331 struct list_head *todo) 366 struct list_head *todo)
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 8493536ea55b..765c3a28077a 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -7,9 +7,9 @@
7 * devtmpfs, a tmpfs-based filesystem is created. Every driver-core 7 * devtmpfs, a tmpfs-based filesystem is created. Every driver-core
8 * device which requests a device node, will add a node in this 8 * device which requests a device node, will add a node in this
9 * filesystem. 9 * filesystem.
10 * By default, all devices are named after the the name of the 10 * By default, all devices are named after the name of the device,
11 * device, owned by root and have a default mode of 0600. Subsystems 11 * owned by root and have a default mode of 0600. Subsystems can
12 * can overwrite the default setting if needed. 12 * overwrite the default setting if needed.
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
index 07cbbc6fddb4..05c64c11bad2 100644
--- a/drivers/base/dma-buf.c
+++ b/drivers/base/dma-buf.c
@@ -293,7 +293,7 @@ EXPORT_SYMBOL_GPL(dma_buf_unmap_attachment);
293 * cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific 293 * cpu in the kernel context. Calls begin_cpu_access to allow exporter-specific
294 * preparations. Coherency is only guaranteed in the specified range for the 294 * preparations. Coherency is only guaranteed in the specified range for the
295 * specified access direction. 295 * specified access direction.
296 * @dma_buf: [in] buffer to prepare cpu access for. 296 * @dmabuf: [in] buffer to prepare cpu access for.
297 * @start: [in] start of range for cpu access. 297 * @start: [in] start of range for cpu access.
298 * @len: [in] length of range for cpu access. 298 * @len: [in] length of range for cpu access.
299 * @direction: [in] length of range for cpu access. 299 * @direction: [in] length of range for cpu access.
@@ -320,7 +320,7 @@ EXPORT_SYMBOL_GPL(dma_buf_begin_cpu_access);
320 * cpu in the kernel context. Calls end_cpu_access to allow exporter-specific 320 * cpu in the kernel context. Calls end_cpu_access to allow exporter-specific
321 * actions. Coherency is only guaranteed in the specified range for the 321 * actions. Coherency is only guaranteed in the specified range for the
322 * specified access direction. 322 * specified access direction.
323 * @dma_buf: [in] buffer to complete cpu access for. 323 * @dmabuf: [in] buffer to complete cpu access for.
324 * @start: [in] start of range for cpu access. 324 * @start: [in] start of range for cpu access.
325 * @len: [in] length of range for cpu access. 325 * @len: [in] length of range for cpu access.
326 * @direction: [in] length of range for cpu access. 326 * @direction: [in] length of range for cpu access.
@@ -340,7 +340,7 @@ EXPORT_SYMBOL_GPL(dma_buf_end_cpu_access);
340/** 340/**
341 * dma_buf_kmap_atomic - Map a page of the buffer object into kernel address 341 * dma_buf_kmap_atomic - Map a page of the buffer object into kernel address
342 * space. The same restrictions as for kmap_atomic and friends apply. 342 * space. The same restrictions as for kmap_atomic and friends apply.
343 * @dma_buf: [in] buffer to map page from. 343 * @dmabuf: [in] buffer to map page from.
344 * @page_num: [in] page in PAGE_SIZE units to map. 344 * @page_num: [in] page in PAGE_SIZE units to map.
345 * 345 *
346 * This call must always succeed, any necessary preparations that might fail 346 * This call must always succeed, any necessary preparations that might fail
@@ -356,7 +356,7 @@ EXPORT_SYMBOL_GPL(dma_buf_kmap_atomic);
356 356
357/** 357/**
358 * dma_buf_kunmap_atomic - Unmap a page obtained by dma_buf_kmap_atomic. 358 * dma_buf_kunmap_atomic - Unmap a page obtained by dma_buf_kmap_atomic.
359 * @dma_buf: [in] buffer to unmap page from. 359 * @dmabuf: [in] buffer to unmap page from.
360 * @page_num: [in] page in PAGE_SIZE units to unmap. 360 * @page_num: [in] page in PAGE_SIZE units to unmap.
361 * @vaddr: [in] kernel space pointer obtained from dma_buf_kmap_atomic. 361 * @vaddr: [in] kernel space pointer obtained from dma_buf_kmap_atomic.
362 * 362 *
@@ -375,7 +375,7 @@ EXPORT_SYMBOL_GPL(dma_buf_kunmap_atomic);
375/** 375/**
376 * dma_buf_kmap - Map a page of the buffer object into kernel address space. The 376 * dma_buf_kmap - Map a page of the buffer object into kernel address space. The
377 * same restrictions as for kmap and friends apply. 377 * same restrictions as for kmap and friends apply.
378 * @dma_buf: [in] buffer to map page from. 378 * @dmabuf: [in] buffer to map page from.
379 * @page_num: [in] page in PAGE_SIZE units to map. 379 * @page_num: [in] page in PAGE_SIZE units to map.
380 * 380 *
381 * This call must always succeed, any necessary preparations that might fail 381 * This call must always succeed, any necessary preparations that might fail
@@ -391,7 +391,7 @@ EXPORT_SYMBOL_GPL(dma_buf_kmap);
391 391
392/** 392/**
393 * dma_buf_kunmap - Unmap a page obtained by dma_buf_kmap. 393 * dma_buf_kunmap - Unmap a page obtained by dma_buf_kmap.
394 * @dma_buf: [in] buffer to unmap page from. 394 * @dmabuf: [in] buffer to unmap page from.
395 * @page_num: [in] page in PAGE_SIZE units to unmap. 395 * @page_num: [in] page in PAGE_SIZE units to unmap.
396 * @vaddr: [in] kernel space pointer obtained from dma_buf_kmap. 396 * @vaddr: [in] kernel space pointer obtained from dma_buf_kmap.
397 * 397 *
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 3ec3896c83a6..207c27ddf828 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -80,7 +80,7 @@ struct device *driver_find_device(struct device_driver *drv,
80 struct klist_iter i; 80 struct klist_iter i;
81 struct device *dev; 81 struct device *dev;
82 82
83 if (!drv) 83 if (!drv || !drv->p)
84 return NULL; 84 return NULL;
85 85
86 klist_iter_init_node(&drv->p->klist_devices, &i, 86 klist_iter_init_node(&drv->p->klist_devices, &i,