Commit fa93669a authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'driver-core-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core changes from Greg Kroah-Hartman:
 "Here's the big driver core pull request for 3.6-rc1.

  Unlike 3.5, this kernel should be a lot tamer, with the printk changes
  now settled down.  All we have here is some extcon driver updates, w1
  driver updates, a few printk cleanups that weren't needed for 3.5, but
  are good to have now, and some other minor fixes/changes in the driver
  core.

  All of these have been in the linux-next releases for a while now.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'driver-core-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (38 commits)
  printk: Export struct log size and member offsets through vmcoreinfo
  Drivers: hv: Change the hex constant to a decimal constant
  driver core: don't trigger uevent after failure
  extcon: MAX77693: Add extcon-max77693 driver to support Maxim MAX77693 MUIC device
  sysfs: fail dentry revalidation after namespace change fix
  sysfs: fail dentry revalidation after namespace change
  extcon: spelling of detach in function doc
  extcon: arizona: Stop microphone detection if we give up on it
  extcon: arizona: Update cable reporting calls and split headset
  PM / Runtime: Do not increment device usage counts before probing
  kmsg - do not flush partial lines when the console is busy
  kmsg - export "continuation record" flag to /dev/kmsg
  kmsg - avoid warning for CONFIG_PRINTK=n compilations
  kmsg - properly print over-long continuation lines
  driver-core: Use kobj_to_dev instead of re-implementing it
  driver-core: Move kobj_to_dev from genhd.h to device.h
  driver core: Move deferred devices to the end of dpm_list before probing
  driver core: move uevent call to driver_register
  driver core: fix shutdown races with probe/remove(v3)
  Extcon: Arizona: Add driver for Wolfson Arizona class devices
  ...
parents b13bc8dd 6791457a
What: /sys/bus/w1/devices/.../pio
Date: May 2012
Contact: Markus Franke <franm@hrz.tu-chemnitz.de>
Description: read/write the contents of the two PIO's of the DS28E04-100
see Documentation/w1/slaves/w1_ds28e04 for detailed information
Users: any user space application which wants to communicate with DS28E04-100
What: /sys/bus/w1/devices/.../eeprom
Date: May 2012
Contact: Markus Franke <franm@hrz.tu-chemnitz.de>
Description: read/write the contents of the EEPROM memory of the DS28E04-100
see Documentation/w1/slaves/w1_ds28e04 for detailed information
Users: any user space application which wants to communicate with DS28E04-100
...@@ -58,16 +58,18 @@ Description: The /dev/kmsg character device node provides userspace access ...@@ -58,16 +58,18 @@ Description: The /dev/kmsg character device node provides userspace access
The output format consists of a prefix carrying the syslog The output format consists of a prefix carrying the syslog
prefix including priority and facility, the 64 bit message prefix including priority and facility, the 64 bit message
sequence number and the monotonic timestamp in microseconds. sequence number and the monotonic timestamp in microseconds,
The values are separated by a ','. Future extensions might and a flag field. All fields are separated by a ','.
add more comma separated values before the terminating ';'.
Unknown values should be gracefully ignored. Future extensions might add more comma separated values before
the terminating ';'. Unknown fields and values should be
gracefully ignored.
The human readable text string starts directly after the ';' The human readable text string starts directly after the ';'
and is terminated by a '\n'. Untrusted values derived from and is terminated by a '\n'. Untrusted values derived from
hardware or other facilities are printed, therefore hardware or other facilities are printed, therefore
all non-printable characters in the log message are escaped all non-printable characters and '\' itself in the log message
by "\x00" C-style hex encoding. are escaped by "\x00" C-style hex encoding.
A line starting with ' ', is a continuation line, adding A line starting with ' ', is a continuation line, adding
key/value pairs to the log message, which provide the machine key/value pairs to the log message, which provide the machine
...@@ -75,11 +77,11 @@ Description: The /dev/kmsg character device node provides userspace access ...@@ -75,11 +77,11 @@ Description: The /dev/kmsg character device node provides userspace access
userspace. userspace.
Example: Example:
7,160,424069;pci_root PNP0A03:00: host bridge window [io 0x0000-0x0cf7] (ignored) 7,160,424069,-;pci_root PNP0A03:00: host bridge window [io 0x0000-0x0cf7] (ignored)
SUBSYSTEM=acpi SUBSYSTEM=acpi
DEVICE=+acpi:PNP0A03:00 DEVICE=+acpi:PNP0A03:00
6,339,5140900;NET: Registered protocol family 10 6,339,5140900,-;NET: Registered protocol family 10
30,340,5690716;udevd[80]: starting version 181 30,340,5690716,-;udevd[80]: starting version 181
The DEVICE= key uniquely identifies devices the following way: The DEVICE= key uniquely identifies devices the following way:
b12:8 - block dev_t b12:8 - block dev_t
...@@ -87,4 +89,13 @@ Description: The /dev/kmsg character device node provides userspace access ...@@ -87,4 +89,13 @@ Description: The /dev/kmsg character device node provides userspace access
n8 - netdev ifindex n8 - netdev ifindex
+sound:card0 - subsystem:devname +sound:card0 - subsystem:devname
The flags field carries '-' by default. A 'c' indicates a
fragment of a line. All following fragments are flagged with
'+'. Note, that these hints about continuation lines are not
neccessarily correct, and the stream could be interleaved with
unrelated messages, but merging the lines in the output
usually produces better human readable results. A similar
logic is used internally when messages are printed to the
console, /proc/kmsg or the syslog() syscall.
Users: dmesg(1), userspace kernel log consumers Users: dmesg(1), userspace kernel log consumers
Everything you ever wanted to know about Linux 2.6 -stable releases. Everything you ever wanted to know about Linux -stable releases.
Rules on what kind of patches are accepted, and which ones are not, into the Rules on what kind of patches are accepted, and which ones are not, into the
"-stable" tree: "-stable" tree:
...@@ -42,10 +42,10 @@ Procedure for submitting patches to the -stable tree: ...@@ -42,10 +42,10 @@ Procedure for submitting patches to the -stable tree:
cherry-picked than this can be specified in the following format in cherry-picked than this can be specified in the following format in
the sign-off area: the sign-off area:
Cc: <stable@vger.kernel.org> # .32.x: a1f84a3: sched: Check for idle Cc: <stable@vger.kernel.org> # 3.3.x: a1f84a3: sched: Check for idle
Cc: <stable@vger.kernel.org> # .32.x: 1b9508f: sched: Rate-limit newidle Cc: <stable@vger.kernel.org> # 3.3.x: 1b9508f: sched: Rate-limit newidle
Cc: <stable@vger.kernel.org> # .32.x: fd21073: sched: Fix affinity logic Cc: <stable@vger.kernel.org> # 3.3.x: fd21073: sched: Fix affinity logic
Cc: <stable@vger.kernel.org> # .32.x Cc: <stable@vger.kernel.org> # 3.3.x
Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Ingo Molnar <mingo@elte.hu>
The tag sequence has the meaning of: The tag sequence has the meaning of:
...@@ -79,6 +79,15 @@ Review cycle: ...@@ -79,6 +79,15 @@ Review cycle:
security kernel team, and not go through the normal review cycle. security kernel team, and not go through the normal review cycle.
Contact the kernel security team for more details on this procedure. Contact the kernel security team for more details on this procedure.
Trees:
- The queues of patches, for both completed versions and in progress
versions can be found at:
http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git
- The finalized and tagged releases of all stable kernels can be found
in separate branches per version at:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git
Review committee: Review committee:
......
Kernel driver w1_ds28e04
========================
Supported chips:
* Maxim DS28E04-100 4096-Bit Addressable 1-Wire EEPROM with PIO
supported family codes:
W1_FAMILY_DS28E04 0x1C
Author: Markus Franke, <franke.m@sebakmt.com> <franm@hrz.tu-chemnitz.de>
Description
-----------
Support is provided through the sysfs files "eeprom" and "pio". CRC checking
during memory accesses can optionally be enabled/disabled via the device
attribute "crccheck". The strong pull-up can optionally be enabled/disabled
via the module parameter "w1_strong_pullup".
Memory Access
A read operation on the "eeprom" file reads the given amount of bytes
from the EEPROM of the DS28E04.
A write operation on the "eeprom" file writes the given byte sequence
to the EEPROM of the DS28E04. If CRC checking mode is enabled only
fully alligned blocks of 32 bytes with valid CRC16 values (in bytes 30
and 31) are allowed to be written.
PIO Access
The 2 PIOs of the DS28E04-100 are accessible via the "pio" sysfs file.
The current status of the PIO's is returned as an 8 bit value. Bit 0/1
represent the state of PIO_0/PIO_1. Bits 2..7 do not care. The PIO's are
driven low-active, i.e. the driver delivers/expects low-active values.
...@@ -2728,6 +2728,14 @@ M: Mimi Zohar <zohar@us.ibm.com> ...@@ -2728,6 +2728,14 @@ M: Mimi Zohar <zohar@us.ibm.com>
S: Supported S: Supported
F: security/integrity/evm/ F: security/integrity/evm/
EXTERNAL CONNECTOR SUBSYSTEM (EXTCON)
M: MyungJoo Ham <myungjoo.ham@samsung.com>
M: Chanwoo Choi <cw00.choi@samsung.com>
L: linux-kernel@vger.kernel.org
S: Maintained
F: drivers/extcon/
F: Documentation/extcon/
EXYNOS DP DRIVER EXYNOS DP DRIVER
M: Jingoo Han <jg1.han@samsung.com> M: Jingoo Han <jg1.han@samsung.com>
L: linux-fbdev@vger.kernel.org L: linux-fbdev@vger.kernel.org
......
...@@ -743,7 +743,6 @@ int bus_add_driver(struct device_driver *drv) ...@@ -743,7 +743,6 @@ int bus_add_driver(struct device_driver *drv)
} }
} }
kobject_uevent(&priv->kobj, KOBJ_ADD);
return 0; return 0;
out_unregister: out_unregister:
......
...@@ -85,14 +85,13 @@ const char *dev_driver_string(const struct device *dev) ...@@ -85,14 +85,13 @@ const char *dev_driver_string(const struct device *dev)
} }
EXPORT_SYMBOL(dev_driver_string); EXPORT_SYMBOL(dev_driver_string);
#define to_dev(obj) container_of(obj, struct device, kobj)
#define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr) #define to_dev_attr(_attr) container_of(_attr, struct device_attribute, attr)
static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr, static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
char *buf) char *buf)
{ {
struct device_attribute *dev_attr = to_dev_attr(attr); struct device_attribute *dev_attr = to_dev_attr(attr);
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
ssize_t ret = -EIO; ssize_t ret = -EIO;
if (dev_attr->show) if (dev_attr->show)
...@@ -108,7 +107,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr, ...@@ -108,7 +107,7 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct device_attribute *dev_attr = to_dev_attr(attr); struct device_attribute *dev_attr = to_dev_attr(attr);
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
ssize_t ret = -EIO; ssize_t ret = -EIO;
if (dev_attr->store) if (dev_attr->store)
...@@ -182,7 +181,7 @@ EXPORT_SYMBOL_GPL(device_show_int); ...@@ -182,7 +181,7 @@ EXPORT_SYMBOL_GPL(device_show_int);
*/ */
static void device_release(struct kobject *kobj) static void device_release(struct kobject *kobj)
{ {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
struct device_private *p = dev->p; struct device_private *p = dev->p;
if (dev->release) if (dev->release)
...@@ -200,7 +199,7 @@ static void device_release(struct kobject *kobj) ...@@ -200,7 +199,7 @@ static void device_release(struct kobject *kobj)
static const void *device_namespace(struct kobject *kobj) static const void *device_namespace(struct kobject *kobj)
{ {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
const void *ns = NULL; const void *ns = NULL;
if (dev->class && dev->class->ns_type) if (dev->class && dev->class->ns_type)
...@@ -221,7 +220,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj) ...@@ -221,7 +220,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
struct kobj_type *ktype = get_ktype(kobj); struct kobj_type *ktype = get_ktype(kobj);
if (ktype == &device_ktype) { if (ktype == &device_ktype) {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
if (dev->bus) if (dev->bus)
return 1; return 1;
if (dev->class) if (dev->class)
...@@ -232,7 +231,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj) ...@@ -232,7 +231,7 @@ static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj) static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)
{ {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
if (dev->bus) if (dev->bus)
return dev->bus->name; return dev->bus->name;
...@@ -244,7 +243,7 @@ static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj) ...@@ -244,7 +243,7 @@ static const char *dev_uevent_name(struct kset *kset, struct kobject *kobj)
static int dev_uevent(struct kset *kset, struct kobject *kobj, static int dev_uevent(struct kset *kset, struct kobject *kobj,
struct kobj_uevent_env *env) struct kobj_uevent_env *env)
{ {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
int retval = 0; int retval = 0;
/* add device node properties if present */ /* add device node properties if present */
...@@ -1132,7 +1131,7 @@ int device_register(struct device *dev) ...@@ -1132,7 +1131,7 @@ int device_register(struct device *dev)
*/ */
struct device *get_device(struct device *dev) struct device *get_device(struct device *dev)
{ {
return dev ? to_dev(kobject_get(&dev->kobj)) : NULL; return dev ? kobj_to_dev(kobject_get(&dev->kobj)) : NULL;
} }
/** /**
...@@ -1754,25 +1753,25 @@ int device_move(struct device *dev, struct device *new_parent, ...@@ -1754,25 +1753,25 @@ int device_move(struct device *dev, struct device *new_parent,
set_dev_node(dev, dev_to_node(new_parent)); set_dev_node(dev, dev_to_node(new_parent));
} }
if (!dev->class) if (dev->class) {
goto out_put; error = device_move_class_links(dev, old_parent, new_parent);
error = device_move_class_links(dev, old_parent, new_parent); if (error) {
if (error) { /* We ignore errors on cleanup since we're hosed anyway... */
/* We ignore errors on cleanup since we're hosed anyway... */ device_move_class_links(dev, new_parent, old_parent);
device_move_class_links(dev, new_parent, old_parent); if (!kobject_move(&dev->kobj, &old_parent->kobj)) {
if (!kobject_move(&dev->kobj, &old_parent->kobj)) { if (new_parent)
if (new_parent) klist_remove(&dev->p->knode_parent);
klist_remove(&dev->p->knode_parent); dev->parent = old_parent;
dev->parent = old_parent; if (old_parent) {
if (old_parent) { klist_add_tail(&dev->p->knode_parent,
klist_add_tail(&dev->p->knode_parent, &old_parent->p->klist_children);
&old_parent->p->klist_children); set_dev_node(dev, dev_to_node(old_parent));
set_dev_node(dev, dev_to_node(old_parent)); }
} }
cleanup_glue_dir(dev, new_parent_kobj);
put_device(new_parent);
goto out;
} }
cleanup_glue_dir(dev, new_parent_kobj);
put_device(new_parent);
goto out;
} }
switch (dpm_order) { switch (dpm_order) {
case DPM_ORDER_NONE: case DPM_ORDER_NONE:
...@@ -1787,7 +1786,7 @@ int device_move(struct device *dev, struct device *new_parent, ...@@ -1787,7 +1786,7 @@ int device_move(struct device *dev, struct device *new_parent,
device_pm_move_last(dev); device_pm_move_last(dev);
break; break;
} }
out_put:
put_device(old_parent); put_device(old_parent);
out: out:
device_pm_unlock(); device_pm_unlock();
...@@ -1812,6 +1811,13 @@ void device_shutdown(void) ...@@ -1812,6 +1811,13 @@ void device_shutdown(void)
while (!list_empty(&devices_kset->list)) { while (!list_empty(&devices_kset->list)) {
dev = list_entry(devices_kset->list.prev, struct device, dev = list_entry(devices_kset->list.prev, struct device,
kobj.entry); kobj.entry);
/*
* hold reference count of device's parent to
* prevent it from being freed because parent's
* lock is to be held
*/
get_device(dev->parent);
get_device(dev); get_device(dev);
/* /*
* Make sure the device is off the kset list, in the * Make sure the device is off the kset list, in the
...@@ -1820,6 +1826,11 @@ void device_shutdown(void) ...@@ -1820,6 +1826,11 @@ void device_shutdown(void)
list_del_init(&dev->kobj.entry); list_del_init(&dev->kobj.entry);
spin_unlock(&devices_kset->list_lock); spin_unlock(&devices_kset->list_lock);
/* hold lock to avoid race with probe/release */
if (dev->parent)
device_lock(dev->parent);
device_lock(dev);
/* Don't allow any more runtime suspends */ /* Don't allow any more runtime suspends */
pm_runtime_get_noresume(dev); pm_runtime_get_noresume(dev);
pm_runtime_barrier(dev); pm_runtime_barrier(dev);
...@@ -1831,7 +1842,13 @@ void device_shutdown(void) ...@@ -1831,7 +1842,13 @@ void device_shutdown(void)
dev_dbg(dev, "shutdown\n"); dev_dbg(dev, "shutdown\n");
dev->driver->shutdown(dev); dev->driver->shutdown(dev);
} }
device_unlock(dev);
if (dev->parent)
device_unlock(dev->parent);
put_device(dev); put_device(dev);
put_device(dev->parent);
spin_lock(&devices_kset->list_lock); spin_lock(&devices_kset->list_lock);
} }
......
...@@ -85,8 +85,20 @@ static void deferred_probe_work_func(struct work_struct *work) ...@@ -85,8 +85,20 @@ static void deferred_probe_work_func(struct work_struct *work)
* manipulate the deferred list * manipulate the deferred list
*/ */
mutex_unlock(&deferred_probe_mutex); mutex_unlock(&deferred_probe_mutex);
/*
* Force the device to the end of the dpm_list since
* the PM code assumes that the order we add things to
* the list is a good order for suspend but deferred
* probe makes that very unsafe.
*/
device_pm_lock();
device_pm_move_last(dev);
device_pm_unlock();
dev_dbg(dev, "Retrying from deferred list\n"); dev_dbg(dev, "Retrying from deferred list\n");
bus_probe_device(dev); bus_probe_device(dev);
mutex_lock(&deferred_probe_mutex); mutex_lock(&deferred_probe_mutex);
put_device(dev); put_device(dev);
...@@ -283,6 +295,7 @@ static int really_probe(struct device *dev, struct device_driver *drv) ...@@ -283,6 +295,7 @@ static int really_probe(struct device *dev, struct device_driver *drv)
devres_release_all(dev); devres_release_all(dev);
driver_sysfs_remove(dev); driver_sysfs_remove(dev);
dev->driver = NULL; dev->driver = NULL;
dev_set_drvdata(dev, NULL);
if (ret == -EPROBE_DEFER) { if (ret == -EPROBE_DEFER) {
/* Driver requested deferred probing */ /* Driver requested deferred probing */
...@@ -356,10 +369,9 @@ int driver_probe_device(struct device_driver *drv, struct device *dev) ...@@ -356,10 +369,9 @@ int driver_probe_device(struct device_driver *drv, struct device *dev)
pr_debug("bus: '%s': %s: matched device %s with driver %s\n", pr_debug("bus: '%s': %s: matched device %s with driver %s\n",
drv->bus->name, __func__, dev_name(dev), drv->name); drv->bus->name, __func__, dev_name(dev), drv->name);
pm_runtime_get_noresume(dev);
pm_runtime_barrier(dev); pm_runtime_barrier(dev);
ret = really_probe(dev, drv); ret = really_probe(dev, drv);
pm_runtime_put_sync(dev); pm_runtime_idle(dev);
return ret; return ret;
} }
...@@ -406,9 +418,8 @@ int device_attach(struct device *dev) ...@@ -406,9 +418,8 @@ int device_attach(struct device *dev)
ret = 0; ret = 0;
} }
} else { } else {
pm_runtime_get_noresume(dev);
ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach); ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
pm_runtime_put_sync(dev); pm_runtime_idle(dev);
} }
out_unlock: out_unlock:
device_unlock(dev); device_unlock(dev);
...@@ -487,6 +498,7 @@ static void __device_release_driver(struct device *dev) ...@@ -487,6 +498,7 @@ static void __device_release_driver(struct device *dev)
drv->remove(dev); drv->remove(dev);
devres_release_all(dev); devres_release_all(dev);
dev->driver = NULL; dev->driver = NULL;
dev_set_drvdata(dev, NULL);
klist_remove(&dev->p->knode_driver); klist_remove(&dev->p->knode_driver);
if (dev->bus) if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier, blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
......
...@@ -493,6 +493,7 @@ EXPORT_SYMBOL_GPL(dma_buf_vmap); ...@@ -493,6 +493,7 @@ EXPORT_SYMBOL_GPL(dma_buf_vmap);
/** /**
* dma_buf_vunmap - Unmap a vmap obtained by dma_buf_vmap. * dma_buf_vunmap - Unmap a vmap obtained by dma_buf_vmap.
* @dmabuf: [in] buffer to vunmap * @dmabuf: [in] buffer to vunmap
* @vaddr: [in] vmap to vunmap
*/ */
void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr) void dma_buf_vunmap(struct dma_buf *dmabuf, void *vaddr)
{ {
......
...@@ -186,6 +186,7 @@ EXPORT_SYMBOL(dma_release_from_coherent); ...@@ -186,6 +186,7 @@ EXPORT_SYMBOL(dma_release_from_coherent);
* @vma: vm_area for the userspace memory * @vma: vm_area for the userspace memory
* @vaddr: cpu address returned by dma_alloc_from_coherent * @vaddr: cpu address returned by dma_alloc_from_coherent
* @size: size of the memory buffer allocated by dma_alloc_from_coherent * @size: size of the memory buffer allocated by dma_alloc_from_coherent
* @ret: result from remap_pfn_range()
* *
* This checks whether the memory was allocated from the per-device * This checks whether the memory was allocated from the per-device
* coherent memory pool and if so, maps that memory to the provided vma. * coherent memory pool and if so, maps that memory to the provided vma.
......
...@@ -185,8 +185,12 @@ int driver_register(struct device_driver *drv) ...@@ -185,8 +185,12 @@ int driver_register(struct device_driver *drv)
if (ret) if (ret)
return ret; return ret;
ret = driver_add_groups(drv, drv->groups); ret = driver_add_groups(drv, drv->groups);
if (ret) if (ret) {
bus_remove_driver(drv); bus_remove_driver(drv);
return ret;
}
kobject_uevent(&drv->p->kobj, KOBJ_ADD);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(driver_register); EXPORT_SYMBOL_GPL(driver_register);
......
...@@ -22,8 +22,6 @@ ...@@ -22,8 +22,6 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/sched.h> #include <linux/sched.h>
#define to_dev(obj) container_of(obj, struct device, kobj)
MODULE_AUTHOR("Manuel Estrada Sainz"); MODULE_AUTHOR("Manuel Estrada Sainz");
MODULE_DESCRIPTION("Multi purpose firmware loading support"); MODULE_DESCRIPTION("Multi purpose firmware loading support");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -290,7 +288,7 @@ static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj, ...@@ -290,7 +288,7 @@ static ssize_t firmware_data_read(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, struct bin_attribute *bin_attr,
char *buffer, loff_t offset, size_t count) char *buffer, loff_t offset, size_t count)
{ {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
struct firmware_priv *fw_priv = to_firmware_priv(dev); struct firmware_priv *fw_priv = to_firmware_priv(dev);
struct firmware *fw; struct firmware *fw;
ssize_t ret_count; ssize_t ret_count;
...@@ -384,7 +382,7 @@ static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj, ...@@ -384,7 +382,7 @@ static ssize_t firmware_data_write(struct file *filp, struct kobject *kobj,
struct bin_attribute *bin_attr, struct bin_attribute *bin_attr,
char *buffer, loff_t offset, size_t count) char *buffer, loff_t offset, size_t count)
{ {
struct device *dev = to_dev(kobj); struct device *dev = kobj_to_dev(kobj);
struct firmware_priv *fw_priv = to_firmware_priv(dev); struct firmware_priv *fw_priv = to_firmware_priv(dev);
struct firmware *fw; struct firmware *fw;
ssize_t retval; ssize_t retval;
......
...@@ -21,6 +21,16 @@ config EXTCON_GPIO ...@@ -21,6 +21,16 @@ config EXTCON_GPIO
Say Y here to enable GPIO based extcon support. Note that GPIO Say Y here to enable GPIO based extcon support. Note that GPIO
extcon supports single state per extcon instance. extcon supports single state per extcon instance.
config EXTCON_MAX77693
tristate "MAX77693 EXTCON Support"
depends on MFD_MAX77693
select IRQ_DOMAIN
select REGMAP_I2C
help
If you say yes here you get support for the MUIC device of
Maxim MAX77693 PMIC. The MAX77693 MUIC is a USB port accessory
detector and switch.
config EXTCON_MAX8997 config EXTCON_MAX8997
tristate "MAX8997 EXTCON Support" tristate "MAX8997 EXTCON Support"
depends on MFD_MAX8997 depends on MFD_MAX8997
...@@ -29,4 +39,12 @@ config EXTCON_MAX8997 ...@@ -29,4 +39,12 @@ config EXTCON_MAX8997
Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
detector and switch. detector and switch.
config EXTCON_ARIZONA
tristate "Wolfson Arizona EXTCON support"
depends on MFD_ARIZONA
help
Say Y here to enable support for external accessory detection
with Wolfson Arizona devices. These are audio CODECs with
advanced audio accessory detection support.
endif # MULTISTATE_SWITCH endif # MULTISTATE_SWITCH
...@@ -4,4 +4,6 @@ ...@@ -4,4 +4,6 @@
obj-$(CONFIG_EXTCON) += extcon_class.o obj-$(CONFIG_EXTCON) += extcon_class.o
obj-$(CONFIG_EXTCON_GPIO) += extcon_gpio.o obj-$(CONFIG_EXTCON_GPIO) += extcon_gpio.o
obj-$(CONFIG_EXTCON_MAX77693) += extcon-max77693.o
obj-$(CONFIG_EXTCON_MAX8997) += extcon-max8997.o obj-$(CONFIG_EXTCON_MAX8997) += extcon-max8997.o
obj-$(CONFIG_EXTCON_ARIZONA) += extcon-arizona.o
This diff is collapsed.
This diff is collapsed.
...@@ -65,7 +65,7 @@ const char *extcon_cable_name[] = { ...@@ -65,7 +65,7 @@ const char *extcon_cable_name[] = {
NULL, NULL,
}; };
struct class *extcon_class; static struct class *extcon_class;
#if defined(CONFIG_ANDROID) #if defined(CONFIG_ANDROID)
static struct class_compat *switch_class; static struct class_compat *switch_class;
#endif /* CONFIG_ANDROID */ #endif /* CONFIG_ANDROID */
......
...@@ -105,25 +105,25 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev) ...@@ -105,25 +105,25 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev)
ret = extcon_dev_register(&extcon_data->edev, &pdev->dev); ret = extcon_dev_register(&extcon_data->edev, &pdev->dev);
if (ret < 0) if (ret < 0)
goto err_extcon_dev_register; return ret;
ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name); ret = gpio_request_one(extcon_data->gpio, GPIOF_DIR_IN, pdev->name);
if (ret < 0) if (ret < 0)
goto err_request_gpio; goto err;
INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
extcon_data->irq = gpio_to_irq(extcon_data->gpio); extcon_data->irq = gpio_to_irq(extcon_data->gpio);
if (extcon_data->irq < 0) { if (extcon_data->irq < 0) {
ret = extcon_data->irq; ret = extcon_data->irq;
goto err_detect_irq_num_failed; goto err;
} }
ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler, ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler,
pdata->irq_flags, pdev->name, pdata->irq_flags, pdev->name,
extcon_data); extcon_data);
if (ret < 0) if (ret < 0)
goto err_request_irq; goto err;
platform_set_drvdata(pdev, extcon_data); platform_set_drvdata(pdev, extcon_data);
/* Perform initial detection */ /* Perform initial detection */
...@@ -131,13 +131,8 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev) ...@@ -131,13 +131,8 @@ static int __devinit gpio_extcon_probe(struct platform_device *pdev)
return 0; return 0;
err_request_irq: err:
err_detect_irq_num_failed:
gpio_free(extcon_data->gpio);
err_request_gpio:
extcon_dev_unregister(&extcon_data->edev); extcon_dev_unregister(&extcon_data->edev);
err_extcon_dev_register:
devm_kfree(&pdev->dev, extcon_data);
return ret; return ret;
} }
...@@ -148,9 +143,7 @@ static int __devexit gpio_extcon_remove(struct platform_device *pdev) ...@@ -148,9 +143,7 @@ static int __devexit gpio_extcon_remove(struct platform_device *pdev)
cancel_delayed_work_sync(&extcon_data->work); cancel_delayed_work_sync(&extcon_data->work);
free_irq(extcon_data->irq, extcon_data); free_irq(extcon_data->irq, extcon_data);
gpio_free(extcon_data->gpio);
extcon_dev_unregister(&extcon_data->edev); extcon_dev_unregister(&extcon_data->edev);
devm_kfree(&pdev->dev, extcon_data);
return 0; return 0;
} }
......
...@@ -411,7 +411,7 @@ enum { ...@@ -411,7 +411,7 @@ enum {
#define HV_PRESENT_BIT 0x80000000 #define HV_PRESENT_BIT 0x80000000
#define HV_LINUX_GUEST_ID_LO 0x00000000 #define HV_LINUX_GUEST_ID_LO 0x00000000
#define HV_LINUX_GUEST_ID_HI 0xB16B00B5 #define HV_LINUX_GUEST_ID_HI 2976579765
#define HV_LINUX_GUEST_ID (((u64)HV_LINUX_GUEST_ID_HI << 32) | \ #define HV_LINUX_GUEST_ID (((u64)HV_LINUX_GUEST_ID_HI << 32) | \
HV_LINUX_GUEST_ID_LO) HV_LINUX_GUEST_ID_LO)
......
...@@ -39,7 +39,6 @@ struct ds2780_device_info { ...@@ -39,7 +39,6 @@ struct ds2780_device_info {
struct device *dev; struct device *dev;
struct power_supply bat; struct power_supply bat;
struct device *w1_dev; struct device *w1_dev;
struct task_struct *mutex_holder;
}; };
enum current_types { enum current_types {
...@@ -64,10 +63,7 @@ static inline struct power_supply *to_power_supply(struct device *dev) ...@@ -64,10 +63,7 @@ static inline struct power_supply *to_power_supply(struct device *dev)
static inline int ds2780_battery_io(struct ds2780_device_info *dev_info, static inline int ds2780_battery_io(struct ds2780_device_info *dev_info,
char *buf, int addr, size_t count, int io) char *buf, int addr, size_t count, int io)
{ {
if (dev_info->mutex_holder == current) return w1_ds2780_io(dev_info->w1_dev, buf, addr, count, io);
return w1_ds2780_io_nolock(dev_info->w1_dev, buf, addr, count, io);
else
return w1_ds2780_io(dev_info->w1_dev, buf, addr, count, io);
} }
static inline int ds2780_read8(struct ds2780_device_info *dev_info, u8 *val, static inline int ds2780_read8(struct ds2780_device_info *dev_info, u8 *val,
...@@ -779,7 +775,6 @@ static int __devinit ds2780_battery_probe(struct platform_device *pdev) ...@@ -779,7 +775,6 @@ static int __devinit ds2780_battery_probe(struct platform_device *pdev)
dev_info->bat.properties = ds2780_battery_props; dev_info->bat.properties = ds2780_battery_props;
dev_info->bat.num_properties = ARRAY_SIZE(ds2780_battery_props); dev_info->bat.num_properties = ARRAY_SIZE(ds2780_battery_props);
dev_info->bat.get_property = ds2780_battery_get_property; dev_info->bat.get_property = ds2780_battery_get_property;
dev_info->mutex_holder = current;
ret = power_supply_register(&pdev->dev, &dev_info->bat); ret = power_supply_register(&pdev->dev, &dev_info->bat);
if (ret) { if (ret) {
...@@ -809,8 +804,6 @@ static int __devinit ds2780_battery_probe(struct platform_device *pdev) ...@@ -809,8 +804,6 @@ static int __devinit ds2780_battery_probe(struct platform_device *pdev)
goto fail_remove_bin_file; goto fail_remove_bin_file;
} }
dev_info->mutex_holder = NULL;
return 0; return 0;
fail_remove_bin_file: fail_remove_bin_file:
...@@ -830,8 +823,6 @@ static int __devexit ds2780_battery_remove(struct platform_device *pdev) ...@@ -830,8 +823,6 @@ static int __devexit ds2780_battery_remove(struct platform_device *pdev)
{ {
struct ds2780_device_info *dev_info = platform_get_drvdata(pdev); struct ds2780_device_info *dev_info = platform_get_drvdata(pdev);
dev_info->mutex_holder = current;
/* remove attributes */ /* remove attributes */
sysfs_remove_group(&dev_info->bat.dev->kobj, &ds2780_attr_group); sysfs_remove_group(&dev_info->bat.dev->kobj, &ds2780_attr_group);
......
...@@ -37,7 +37,6 @@ struct ds2781_device_info { ...@@ -37,7 +37,6 @@ struct ds2781_device_info {
struct device *dev; struct device *dev;
struct power_supply bat; struct power_supply bat;
struct device *w1_dev; struct device *w1_dev;
struct task_struct *mutex_holder;
}; };
enum current_types { enum current_types {
...@@ -62,11 +61,7 @@ static inline struct power_supply *to_power_supply(struct device *dev) ...@@ -62,11 +61,7 @@ static inline struct power_supply *to_power_supply(struct device *dev)
static inline int ds2781_battery_io(struct ds2781_device_info *dev_info, static inline int ds2781_battery_io(struct ds2781_device_info *dev_info,
char *buf, int addr, size_t count, int io) char *buf, int addr, size_t count, int io)
{ {
if (dev_info->mutex_holder == current) return w1_ds2781_io(dev_info->w1_dev, buf, addr, count, io);
return w1_ds2781_io_nolock(dev_info->w1_dev, buf, addr,
count, io);
else
return w1_ds2781_io(dev_info->w1_dev, buf, addr, count, io);
} }
int w1_ds2781_read(struct ds2781_device_info *dev_info, char *buf, int w1_ds2781_read(struct ds2781_device_info *dev_info, char *buf,
...@@ -775,7 +770,6 @@ static int __devinit ds2781_battery_probe(struct platform_device *pdev) ...@@ -775,7 +770,6 @@ static int __devinit ds2781_battery_probe(struct platform_device *pdev)
dev_info->bat.properties = ds2781_battery_props; dev_info->bat.properties = ds2781_battery_props;
dev_info->bat.num_properties = ARRAY_SIZE(ds2781_battery_props); dev_info->bat.num_properties = ARRAY_SIZE(ds2781_battery_props);
dev_info->bat.get_property = ds2781_battery_get_property; dev_info->bat.get_property = ds2781_battery_get_property;
dev_info->mutex_holder = current;
ret = power_supply_register(&pdev->dev, &dev_info->bat); ret = power_supply_register(&pdev->dev, &dev_info->bat);
if (ret) { if (ret) {
...@@ -805,8 +799,6 @@ static int __devinit ds2781_battery_probe(struct platform_device *pdev) ...@@ -805,8 +799,6 @@ static int __devinit ds2781_battery_probe(struct platform_device *pdev)
goto fail_remove_bin_file; goto fail_remove_bin_file;
} }
dev_info->mutex_holder = NULL;
return 0; return 0;
fail_remove_bin_file: fail_remove_bin_file:
...@@ -826,8 +818,6 @@ static int __devexit ds2781_battery_remove(struct platform_device *pdev) ...@@ -826,8 +818,6 @@ static int __devexit ds2781_battery_remove(struct platform_device *pdev)
{ {
struct ds2781_device_info *dev_info = platform_get_drvdata(pdev); struct ds2781_device_info *dev_info = platform_get_drvdata(pdev);
dev_info->mutex_holder = current;
/* remove attributes */ /* remove attributes */
sysfs_remove_group(&dev_info->bat.dev->kobj, &ds2781_attr_group); sysfs_remove_group(&dev_info->bat.dev->kobj, &ds2781_attr_group);
......
...@@ -334,7 +334,9 @@ static void ds1wm_search(void *data, struct w1_master *master_dev, ...@@ -334,7 +334,9 @@ static void ds1wm_search(void *data, struct w1_master *master_dev,
return; return;
} }
mutex_lock(&master_dev->bus_mutex);
if (ds1wm_reset(ds1wm_data)) { if (ds1wm_reset(ds1wm_data)) {
mutex_unlock(&master_dev->bus_mutex);
dev_dbg(&ds1wm_data->pdev->dev, dev_dbg(&ds1wm_data->pdev->dev,
"pass: %d reset error (or no slaves)\n", pass); "pass: %d reset error (or no slaves)\n", pass);
break; break;
...@@ -387,6 +389,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev, ...@@ -387,6 +389,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev,
} }
if (ds1wm_data->read_error) { if (ds1wm_data->read_error) {
mutex_unlock(&master_dev->bus_mutex);
dev_err(&ds1wm_data->pdev->dev, dev_err(&ds1wm_data->pdev->dev,
"pass: %d read error, retrying\n", pass); "pass: %d read error, retrying\n", pass);
break; break;
...@@ -400,6 +403,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev, ...@@ -400,6 +403,7 @@ static void ds1wm_search(void *data, struct w1_master *master_dev,
dev_dbg(&ds1wm_data->pdev->dev, dev_dbg(&ds1wm_data->pdev->dev,
"pass: %d resetting bus\n", pass); "pass: %d resetting bus\n", pass);
ds1wm_reset(ds1wm_data); ds1wm_reset(ds1wm_data);
mutex_unlock(&master_dev->bus_mutex);
if ((r_prime & ((u64)1 << 63)) && (d & ((u64)1 << 63))) { if ((r_prime & ((u64)1 << 63)) && (d & ((u64)1 << 63))) {
dev_err(&ds1wm_data->pdev->dev, dev_err(&ds1wm_data->pdev->dev,
"pass: %d bus error, retrying\n", pass); "pass: %d bus error, retrying\n", pass);
......
...@@ -178,6 +178,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) ...@@ -178,6 +178,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT); hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT);
if (ret == 0) { if (ret == 0) {
dev_dbg(hdq_data->dev, "TX wait elapsed\n"); dev_dbg(hdq_data->dev, "TX wait elapsed\n");
ret = -ETIMEDOUT;
goto out; goto out;
} }
...@@ -185,7 +186,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) ...@@ -185,7 +186,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
/* check irqstatus */ /* check irqstatus */
if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) { if (!(*status & OMAP_HDQ_INT_STATUS_TXCOMPLETE)) {
dev_dbg(hdq_data->dev, "timeout waiting for" dev_dbg(hdq_data->dev, "timeout waiting for"
"TXCOMPLETE/RXCOMPLETE, %x", *status); " TXCOMPLETE/RXCOMPLETE, %x", *status);
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
goto out; goto out;
} }
...@@ -196,7 +197,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status) ...@@ -196,7 +197,7 @@ static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
OMAP_HDQ_FLAG_CLEAR, &tmp_status); OMAP_HDQ_FLAG_CLEAR, &tmp_status);
if (ret) { if (ret) {
dev_dbg(hdq_data->dev, "timeout waiting GO bit" dev_dbg(hdq_data->dev, "timeout waiting GO bit"
"return to zero, %x", tmp_status); " return to zero, %x", tmp_status);
} }
out: out:
...@@ -339,7 +340,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data) ...@@ -339,7 +340,7 @@ static int omap_hdq_break(struct hdq_data *hdq_data)
&tmp_status); &tmp_status);
if (ret) if (ret)
dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits" dev_dbg(hdq_data->dev, "timeout waiting INIT&GO bits"
"return to zero, %x", tmp_status); " return to zero, %x", tmp_status);
out: out:
mutex_unlock(&hdq_data->hdq_mutex); mutex_unlock(&hdq_data->hdq_mutex);
...@@ -351,7 +352,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) ...@@ -351,7 +352,6 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
{ {
int ret = 0; int ret = 0;
u8 status; u8 status;
unsigned long timeout = jiffies + OMAP_HDQ_TIMEOUT;
ret = mutex_lock_interruptible(&hdq_data->hdq_mutex); ret = mutex_lock_interruptible(&hdq_data->hdq_mutex);
if (ret < 0) { if (ret < 0) {
...@@ -369,22 +369,20 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) ...@@ -369,22 +369,20 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO, OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO,
OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO); OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO);
/* /*
* The RX comes immediately after TX. It * The RX comes immediately after TX.
* triggers another interrupt before we
* sleep. So we have to wait for RXCOMPLETE bit.
*/ */
while (!(hdq_data->hdq_irqstatus wait_event_timeout(hdq_wait_queue,
& OMAP_HDQ_INT_STATUS_RXCOMPLETE) (hdq_data->hdq_irqstatus
&& time_before(jiffies, timeout)) { & OMAP_HDQ_INT_STATUS_RXCOMPLETE),
schedule_timeout_uninterruptible(1); OMAP_HDQ_TIMEOUT);
}
hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0, hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, 0,
OMAP_HDQ_CTRL_STATUS_DIR); OMAP_HDQ_CTRL_STATUS_DIR);
status = hdq_data->hdq_irqstatus; status = hdq_data->hdq_irqstatus;
/* check irqstatus */ /* check irqstatus */
if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) { if (!(status & OMAP_HDQ_INT_STATUS_RXCOMPLETE)) {
dev_dbg(hdq_data->dev, "timeout waiting for" dev_dbg(hdq_data->dev, "timeout waiting for"
"RXCOMPLETE, %x", status); " RXCOMPLETE, %x", status);
ret = -ETIMEDOUT; ret = -ETIMEDOUT;
goto out; goto out;
} }
...@@ -394,7 +392,7 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val) ...@@ -394,7 +392,7 @@ static int hdq_read_byte(struct hdq_data *hdq_data, u8 *val)
out: out:
mutex_unlock(&hdq_data->hdq_mutex); mutex_unlock(&hdq_data->hdq_mutex);
rtn: rtn:
return 0; return ret;
} }
...@@ -456,7 +454,7 @@ static int omap_hdq_put(struct hdq_data *hdq_data) ...@@ -456,7 +454,7 @@ static int omap_hdq_put(struct hdq_data *hdq_data)
if (0 == hdq_data->hdq_usecount) { if (0 == hdq_data->hdq_usecount) {
dev_dbg(hdq_data->dev, "attempt to decrement use count" dev_dbg(hdq_data->dev, "attempt to decrement use count"
"when it is zero"); " when it is zero");
ret = -EINVAL; ret = -EINVAL;
} else { } else {
hdq_data->hdq_usecount--; hdq_data->hdq_usecount--;
...@@ -524,7 +522,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte) ...@@ -524,7 +522,7 @@ static void omap_w1_write_byte(void *_hdq, u8 byte)
mutex_unlock(&hdq_data->hdq_mutex); mutex_unlock(&hdq_data->hdq_mutex);
ret = hdq_write_byte(hdq_data, byte, &status); ret = hdq_write_byte(hdq_data, byte, &status);
if (ret == 0) { if (ret < 0) {
dev_dbg(hdq_data->dev, "TX failure:Ctrl status %x\n", status); dev_dbg(hdq_data->dev, "TX failure:Ctrl status %x\n", status);
return; return;
} }
......
...@@ -94,6 +94,19 @@ config W1_SLAVE_DS2781 ...@@ -94,6 +94,19 @@ config W1_SLAVE_DS2781
If you are unsure, say N. If you are unsure, say N.
config W1_SLAVE_DS28E04
tristate "4096-Bit Addressable 1-Wire EEPROM with PIO (DS28E04-100)"
depends on W1
select CRC16
help
If you enable this you will have the DS28E04-100
chip support.
Say Y here if you want to use a 1-wire
4kb EEPROM with PIO family device (DS28E04).
If you are unsure, say N.
config W1_SLAVE_BQ27000 config W1_SLAVE_BQ27000
tristate "BQ27000 slave support" tristate "BQ27000 slave support"
depends on W1 depends on W1
......
...@@ -12,3 +12,4 @@ obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o ...@@ -12,3 +12,4 @@ obj-$(CONFIG_W1_SLAVE_DS2760) += w1_ds2760.o
obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o obj-$(CONFIG_W1_SLAVE_DS2780) += w1_ds2780.o
obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o obj-$(CONFIG_W1_SLAVE_DS2781) += w1_ds2781.o
obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o obj-$(CONFIG_W1_SLAVE_BQ27000) += w1_bq27000.o
obj-$(CONFIG_W1_SLAVE_DS28E04) += w1_ds28e04.o
...@@ -31,10 +31,10 @@ static int w1_bq27000_read(struct device *dev, unsigned int reg) ...@@ -31,10 +31,10 @@ static int w1_bq27000_read(struct device *dev, unsigned int reg)
u8 val; u8 val;
struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev); struct w1_slave *sl = container_of(dev->parent, struct w1_slave, dev);
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
w1_write_8(sl->master, HDQ_CMD_READ | reg); w1_write_8(sl->master, HDQ_CMD_READ | reg);
val = w1_read_8(sl->master); val = w1_read_8(sl->master);
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return val; return val;
} }
......
...@@ -52,11 +52,11 @@ static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf) ...@@ -52,11 +52,11 @@ static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf)
if (!buf) if (!buf)
return -EINVAL; return -EINVAL;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
dev_dbg(&sl->dev, "mutex locked"); dev_dbg(&sl->dev, "mutex locked");
if (w1_reset_select_slave(sl)) { if (w1_reset_select_slave(sl)) {
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return -EIO; return -EIO;
} }
...@@ -66,7 +66,7 @@ static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf) ...@@ -66,7 +66,7 @@ static int _read_reg(struct w1_slave *sl, u8 address, unsigned char* buf)
w1_write_block(sl->master, wrbuf, 3); w1_write_block(sl->master, wrbuf, 3);
*buf = w1_read_8(sl->master); *buf = w1_read_8(sl->master);
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
dev_dbg(&sl->dev, "mutex unlocked"); dev_dbg(&sl->dev, "mutex unlocked");
return 1; return 1;
} }
...@@ -165,7 +165,7 @@ static ssize_t w1_f29_write_output( ...@@ -165,7 +165,7 @@ static ssize_t w1_f29_write_output(
return -EFAULT; return -EFAULT;
dev_dbg(&sl->dev, "locking mutex for write_output"); dev_dbg(&sl->dev, "locking mutex for write_output");
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
dev_dbg(&sl->dev, "mutex locked"); dev_dbg(&sl->dev, "mutex locked");
if (w1_reset_select_slave(sl)) if (w1_reset_select_slave(sl))
...@@ -200,14 +200,14 @@ static ssize_t w1_f29_write_output( ...@@ -200,14 +200,14 @@ static ssize_t w1_f29_write_output(
/* read the result of the READ_PIO_REGS command */ /* read the result of the READ_PIO_REGS command */
if (w1_read_8(sl->master) == *buf) { if (w1_read_8(sl->master) == *buf) {
/* success! */ /* success! */
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
dev_dbg(&sl->dev, dev_dbg(&sl->dev,
"mutex unlocked, retries:%d", retries); "mutex unlocked, retries:%d", retries);
return 1; return 1;
} }
} }
error: error:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
dev_dbg(&sl->dev, "mutex unlocked in error, retries:%d", retries); dev_dbg(&sl->dev, "mutex unlocked in error, retries:%d", retries);
return -EIO; return -EIO;
...@@ -228,7 +228,7 @@ static ssize_t w1_f29_write_activity( ...@@ -228,7 +228,7 @@ static ssize_t w1_f29_write_activity(
if (count != 1 || off != 0) if (count != 1 || off != 0)
return -EFAULT; return -EFAULT;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
if (w1_reset_select_slave(sl)) if (w1_reset_select_slave(sl))
goto error; goto error;
...@@ -236,7 +236,7 @@ static ssize_t w1_f29_write_activity( ...@@ -236,7 +236,7 @@ static ssize_t w1_f29_write_activity(
while (retries--) { while (retries--) {
w1_write_8(sl->master, W1_F29_FUNC_RESET_ACTIVITY_LATCHES); w1_write_8(sl->master, W1_F29_FUNC_RESET_ACTIVITY_LATCHES);
if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE) { if (w1_read_8(sl->master) == W1_F29_SUCCESS_CONFIRM_BYTE) {
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return 1; return 1;
} }
if (w1_reset_resume_command(sl->master)) if (w1_reset_resume_command(sl->master))
...@@ -244,7 +244,7 @@ static ssize_t w1_f29_write_activity( ...@@ -244,7 +244,7 @@ static ssize_t w1_f29_write_activity(
} }
error: error:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return -EIO; return -EIO;
} }
...@@ -263,7 +263,7 @@ static ssize_t w1_f29_write_status_control( ...@@ -263,7 +263,7 @@ static ssize_t w1_f29_write_status_control(
if (count != 1 || off != 0) if (count != 1 || off != 0)
return -EFAULT; return -EFAULT;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
if (w1_reset_select_slave(sl)) if (w1_reset_select_slave(sl))
goto error; goto error;
...@@ -285,12 +285,12 @@ static ssize_t w1_f29_write_status_control( ...@@ -285,12 +285,12 @@ static ssize_t w1_f29_write_status_control(
w1_write_block(sl->master, w1_buf, 3); w1_write_block(sl->master, w1_buf, 3);
if (w1_read_8(sl->master) == *buf) { if (w1_read_8(sl->master) == *buf) {
/* success! */ /* success! */
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return 1; return 1;
} }
} }
error: error:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return -EIO; return -EIO;
} }
......
...@@ -66,7 +66,7 @@ static ssize_t w1_counter_read(struct device *device, ...@@ -66,7 +66,7 @@ static ssize_t w1_counter_read(struct device *device,
wrbuf[0] = 0xA5; wrbuf[0] = 0xA5;
wrbuf[1] = rom_addr & 0xFF; wrbuf[1] = rom_addr & 0xFF;
wrbuf[2] = rom_addr >> 8; wrbuf[2] = rom_addr >> 8;
mutex_lock(&dev->mutex); mutex_lock(&dev->bus_mutex);
if (!w1_reset_select_slave(sl)) { if (!w1_reset_select_slave(sl)) {
w1_write_block(dev, wrbuf, 3); w1_write_block(dev, wrbuf, 3);
read_byte_count = 0; read_byte_count = 0;
...@@ -124,7 +124,7 @@ static ssize_t w1_counter_read(struct device *device, ...@@ -124,7 +124,7 @@ static ssize_t w1_counter_read(struct device *device,
} else { } else {
c -= snprintf(out_buf + PAGE_SIZE - c, c, "Connection error"); c -= snprintf(out_buf + PAGE_SIZE - c, c, "Connection error");
} }
mutex_unlock(&dev->mutex); mutex_unlock(&dev->bus_mutex);
return PAGE_SIZE - c; return PAGE_SIZE - c;
} }
......
...@@ -107,7 +107,7 @@ static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj, ...@@ -107,7 +107,7 @@ static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj,
if (count == 0) if (count == 0)
return 0; return 0;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
/* read directly from the EEPROM in chunks of W1_F2D_READ_MAXLEN */ /* read directly from the EEPROM in chunks of W1_F2D_READ_MAXLEN */
while (todo > 0) { while (todo > 0) {
...@@ -126,7 +126,7 @@ static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj, ...@@ -126,7 +126,7 @@ static ssize_t w1_f2d_read_bin(struct file *filp, struct kobject *kobj,
off += W1_F2D_READ_MAXLEN; off += W1_F2D_READ_MAXLEN;
} }
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return count; return count;
} }
...@@ -214,7 +214,7 @@ static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj, ...@@ -214,7 +214,7 @@ static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj,
if (count == 0) if (count == 0)
return 0; return 0;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
/* Can only write data in blocks of the size of the scratchpad */ /* Can only write data in blocks of the size of the scratchpad */
addr = off; addr = off;
...@@ -259,7 +259,7 @@ static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj, ...@@ -259,7 +259,7 @@ static ssize_t w1_f2d_write_bin(struct file *filp, struct kobject *kobj,
} }
out_up: out_up:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return count; return count;
} }
......
...@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj, ...@@ -107,7 +107,7 @@ static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj,
if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0) if ((count = w1_f23_fix_count(off, count, W1_EEPROM_SIZE)) == 0)
return 0; return 0;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
#ifdef CONFIG_W1_SLAVE_DS2433_CRC #ifdef CONFIG_W1_SLAVE_DS2433_CRC
...@@ -138,7 +138,7 @@ static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj, ...@@ -138,7 +138,7 @@ static ssize_t w1_f23_read_bin(struct file *filp, struct kobject *kobj,
#endif /* CONFIG_W1_SLAVE_DS2433_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
out_up: out_up:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return count; return count;
} }
...@@ -233,7 +233,7 @@ static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj, ...@@ -233,7 +233,7 @@ static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj,
} }
#endif /* CONFIG_W1_SLAVE_DS2433_CRC */ #endif /* CONFIG_W1_SLAVE_DS2433_CRC */
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
/* Can only write data to one page at a time */ /* Can only write data to one page at a time */
idx = 0; idx = 0;
...@@ -251,7 +251,7 @@ static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj, ...@@ -251,7 +251,7 @@ static ssize_t w1_f23_write_bin(struct file *filp, struct kobject *kobj,
} }
out_up: out_up:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return count; return count;
} }
......
...@@ -31,7 +31,7 @@ static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, ...@@ -31,7 +31,7 @@ static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count,
if (!dev) if (!dev)
return 0; return 0;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
if (addr > DS2760_DATA_SIZE || addr < 0) { if (addr > DS2760_DATA_SIZE || addr < 0) {
count = 0; count = 0;
...@@ -54,7 +54,7 @@ static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count, ...@@ -54,7 +54,7 @@ static int w1_ds2760_io(struct device *dev, char *buf, int addr, size_t count,
} }
out: out:
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return count; return count;
} }
...@@ -76,14 +76,14 @@ static int w1_ds2760_eeprom_cmd(struct device *dev, int addr, int cmd) ...@@ -76,14 +76,14 @@ static int w1_ds2760_eeprom_cmd(struct device *dev, int addr, int cmd)
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
if (w1_reset_select_slave(sl) == 0) { if (w1_reset_select_slave(sl) == 0) {
w1_write_8(sl->master, cmd); w1_write_8(sl->master, cmd);
w1_write_8(sl->master, addr); w1_write_8(sl->master, addr);
} }
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return 0; return 0;
} }
......
...@@ -60,30 +60,16 @@ int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count, ...@@ -60,30 +60,16 @@ int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count,
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
ret = w1_ds2780_do_io(dev, buf, addr, count, io); ret = w1_ds2780_do_io(dev, buf, addr, count, io);
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(w1_ds2780_io); EXPORT_SYMBOL(w1_ds2780_io);
int w1_ds2780_io_nolock(struct device *dev, char *buf, int addr, size_t count,
int io)
{
int ret;
if (!dev)
return -ENODEV;
ret = w1_ds2780_do_io(dev, buf, addr, count, io);
return ret;
}
EXPORT_SYMBOL(w1_ds2780_io_nolock);
int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd) int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd)
{ {
struct w1_slave *sl = container_of(dev, struct w1_slave, dev); struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
...@@ -91,14 +77,14 @@ int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd) ...@@ -91,14 +77,14 @@ int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd)
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
if (w1_reset_select_slave(sl) == 0) { if (w1_reset_select_slave(sl) == 0) {
w1_write_8(sl->master, cmd); w1_write_8(sl->master, cmd);
w1_write_8(sl->master, addr); w1_write_8(sl->master, addr);
} }
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return 0; return 0;
} }
EXPORT_SYMBOL(w1_ds2780_eeprom_cmd); EXPORT_SYMBOL(w1_ds2780_eeprom_cmd);
......
...@@ -124,8 +124,6 @@ ...@@ -124,8 +124,6 @@
extern int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count, extern int w1_ds2780_io(struct device *dev, char *buf, int addr, size_t count,
int io); int io);
extern int w1_ds2780_io_nolock(struct device *dev, char *buf, int addr,
size_t count, int io);
extern int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd); extern int w1_ds2780_eeprom_cmd(struct device *dev, int addr, int cmd);
#endif /* !_W1_DS2780_H */ #endif /* !_W1_DS2780_H */
...@@ -58,30 +58,16 @@ int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count, ...@@ -58,30 +58,16 @@ int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count,
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
ret = w1_ds2781_do_io(dev, buf, addr, count, io); ret = w1_ds2781_do_io(dev, buf, addr, count, io);
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return ret; return ret;
} }
EXPORT_SYMBOL(w1_ds2781_io); EXPORT_SYMBOL(w1_ds2781_io);
int w1_ds2781_io_nolock(struct device *dev, char *buf, int addr, size_t count,
int io)
{
int ret;
if (!dev)
return -ENODEV;
ret = w1_ds2781_do_io(dev, buf, addr, count, io);
return ret;
}
EXPORT_SYMBOL(w1_ds2781_io_nolock);
int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd) int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd)
{ {
struct w1_slave *sl = container_of(dev, struct w1_slave, dev); struct w1_slave *sl = container_of(dev, struct w1_slave, dev);
...@@ -89,14 +75,14 @@ int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd) ...@@ -89,14 +75,14 @@ int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd)
if (!dev) if (!dev)
return -EINVAL; return -EINVAL;
mutex_lock(&sl->master->mutex); mutex_lock(&sl->master->bus_mutex);
if (w1_reset_select_slave(sl) == 0) { if (w1_reset_select_slave(sl) == 0) {
w1_write_8(sl->master, cmd); w1_write_8(sl->master, cmd);
w1_write_8(sl->master, addr); w1_write_8(sl->master, addr);
} }
mutex_unlock(&sl->master->mutex); mutex_unlock(&sl->master->bus_mutex);
return 0; return 0;
} }
EXPORT_SYMBOL(w1_ds2781_eeprom_cmd); EXPORT_SYMBOL(w1_ds2781_eeprom_cmd);
......
...@@ -129,8 +129,6 @@ ...@@ -129,8 +129,6 @@
extern int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count, extern int w1_ds2781_io(struct device *dev, char *buf, int addr, size_t count,
int io); int io);
extern int w1_ds2781_io_nolock(struct device *dev, char *buf, int addr,
size_t count, int io);
extern int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd); extern int w1_ds2781_eeprom_cmd(struct device *dev, int addr, int cmd);
#endif /* !_W1_DS2781_H */ #endif /* !_W1_DS2781_H */
This diff is collapsed.
...@@ -179,7 +179,7 @@ static ssize_t w1_therm_read(struct device *device, ...@@ -179,7 +179,7 @@ static ssize_t w1_therm_read(struct device *device,
int i, max_trying = 10; int i, max_trying = 10;
ssize_t c = PAGE_SIZE; ssize_t c = PAGE_SIZE;
i = mutex_lock_interruptible(&dev->mutex); i = mutex_lock_interruptible(&dev->bus_mutex);
if (i != 0) if (i != 0)
return i; return i;
...@@ -207,19 +207,19 @@ static ssize_t w1_therm_read(struct device *device, ...@@ -207,19 +207,19 @@ static ssize_t w1_therm_read(struct device *device,
w1_write_8(dev, W1_CONVERT_TEMP); w1_write_8(dev, W1_CONVERT_TEMP);
if (external_power) { if (external_power) {
mutex_unlock(&dev->mutex); mutex_unlock(&dev->bus_mutex);
sleep_rem = msleep_interruptible(tm); sleep_rem = msleep_interruptible(tm);
if (sleep_rem != 0) if (sleep_rem != 0)
return -EINTR; return -EINTR;
i = mutex_lock_interruptible(&dev->mutex); i = mutex_lock_interruptible(&dev->bus_mutex);
if (i != 0) if (i != 0)
return i; return i;
} else if (!w1_strong_pullup) { } else if (!w1_strong_pullup) {
sleep_rem = msleep_interruptible(tm); sleep_rem = msleep_interruptible(tm);
if (sleep_rem != 0) { if (sleep_rem != 0) {
mutex_unlock(&dev->mutex); mutex_unlock(&dev->bus_mutex);
return -EINTR; return -EINTR;
} }
} }
...@@ -258,7 +258,7 @@ static ssize_t w1_therm_read(struct device *device, ...@@ -258,7 +258,7 @@ static ssize_t w1_therm_read(struct device *device,
c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n", c -= snprintf(buf + PAGE_SIZE - c, c, "t=%d\n",
w1_convert_temp(rom, sl->family->fid)); w1_convert_temp(rom, sl->family->fid));
mutex_unlock(&dev->mutex); mutex_unlock(&dev->bus_mutex);
return PAGE_SIZE - c; return PAGE_SIZE - c;
} }
......
...@@ -557,7 +557,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -557,7 +557,7 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
struct w1_master *md = NULL; struct w1_master *md = NULL;
struct w1_slave *sl = NULL; struct w1_slave *sl = NULL;
char *event_owner, *name; char *event_owner, *name;
int err; int err = 0;
if (dev->driver == &w1_master_driver) { if (dev->driver == &w1_master_driver) {
md = container_of(dev, struct w1_master, dev); md = container_of(dev, struct w1_master, dev);
...@@ -576,19 +576,17 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) ...@@ -576,19 +576,17 @@ static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
event_owner, name, dev_name(dev)); event_owner, name, dev_name(dev));
if (dev->driver != &w1_slave_driver || !sl) if (dev->driver != &w1_slave_driver || !sl)
return 0; goto end;
err = add_uevent_var(env, "W1_FID=%02X", sl->reg_num.family); err = add_uevent_var(env, "W1_FID=%02X", sl->reg_num.family);
if (err) if (err)
return err; goto end;
err = add_uevent_var(env, "W1_SLAVE_ID=%024LX", err = add_uevent_var(env, "W1_SLAVE_ID=%024LX",
(unsigned long long)sl->reg_num.id); (unsigned long long)sl->reg_num.id);
if (err) end:
return err; return err;
}
return 0;
};
#else #else
static int w1_uevent(struct device *dev, struct kobj_uevent_env *env) static int w1_uevent(struct device *dev, struct kobj_uevent_env *env)
{ {
...@@ -887,16 +885,21 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb ...@@ -887,16 +885,21 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
* *
* Return 0 - device(s) present, 1 - no devices present. * Return 0 - device(s) present, 1 - no devices present.
*/ */
mutex_lock(&dev->bus_mutex);
if (w1_reset_bus(dev)) { if (w1_reset_bus(dev)) {
mutex_unlock(&dev->bus_mutex);
dev_dbg(&dev->dev, "No devices present on the wire.\n"); dev_dbg(&dev->dev, "No devices present on the wire.\n");
break; break;
} }
/* Do fast search on single slave bus */ /* Do fast search on single slave bus */
if (dev->max_slave_count == 1) { if (dev->max_slave_count == 1) {
int rv;
w1_write_8(dev, W1_READ_ROM); w1_write_8(dev, W1_READ_ROM);
rv = w1_read_block(dev, (u8 *)&rn, 8);
mutex_unlock(&dev->bus_mutex);
if (w1_read_block(dev, (u8 *)&rn, 8) == 8 && rn) if (rv == 8 && rn)
cb(dev, rn); cb(dev, rn);
break; break;
...@@ -929,10 +932,12 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb ...@@ -929,10 +932,12 @@ void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb
rn |= (tmp64 << i); rn |= (tmp64 << i);
if (kthread_should_stop()) { if (kthread_should_stop()) {
mutex_unlock(&dev->bus_mutex);
dev_dbg(&dev->dev, "Abort w1_search\n"); dev_dbg(&dev->dev, "Abort w1_search\n");
return; return;
} }
} }
mutex_unlock(&dev->bus_mutex);
if ( (triplet_ret & 0x03) != 0x03 ) { if ( (triplet_ret & 0x03) != 0x03 ) {
if ( (desc_bit == last_zero) || (last_zero < 0)) if ( (desc_bit == last_zero) || (last_zero < 0))
......
...@@ -180,6 +180,7 @@ struct w1_master ...@@ -180,6 +180,7 @@ struct w1_master
struct task_struct *thread; struct task_struct *thread;
struct mutex mutex; struct mutex mutex;
struct mutex bus_mutex;
struct device_driver *driver; struct device_driver *driver;
struct device dev; struct device dev;
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#define W1_FAMILY_SMEM_01 0x01 #define W1_FAMILY_SMEM_01 0x01
#define W1_FAMILY_SMEM_81 0x81 #define W1_FAMILY_SMEM_81 0x81
#define W1_THERM_DS18S20 0x10 #define W1_THERM_DS18S20 0x10
#define W1_FAMILY_DS28E04 0x1C
#define W1_COUNTER_DS2423 0x1D #define W1_COUNTER_DS2423 0x1D
#define W1_THERM_DS1822 0x22 #define W1_THERM_DS1822 0x22
#define W1_EEPROM_DS2433 0x23 #define W1_EEPROM_DS2433 0x23
......
...@@ -76,6 +76,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl, ...@@ -76,6 +76,7 @@ static struct w1_master * w1_alloc_dev(u32 id, int slave_count, int slave_ttl,
INIT_LIST_HEAD(&dev->slist); INIT_LIST_HEAD(&dev->slist);
mutex_init(&dev->mutex); mutex_init(&dev->mutex);
mutex_init(&dev->bus_mutex);
memcpy(&dev->dev, device, sizeof(struct device)); memcpy(&dev->dev, device, sizeof(struct device));
dev_set_name(&dev->dev, "w1_bus_master%u", dev->id); dev_set_name(&dev->dev, "w1_bus_master%u", dev->id);
...@@ -117,7 +118,7 @@ int w1_add_master_device(struct w1_bus_master *master) ...@@ -117,7 +118,7 @@ int w1_add_master_device(struct w1_bus_master *master)
return(-EINVAL); return(-EINVAL);
} }
/* While it would be electrically possible to make a device that /* While it would be electrically possible to make a device that
* generated a strong pullup in bit bang mode, only hardare that * generated a strong pullup in bit bang mode, only hardware that
* controls 1-wire time frames are even expected to support a strong * controls 1-wire time frames are even expected to support a strong
* pullup. w1_io.c would need to support calling set_pullup before * pullup. w1_io.c would need to support calling set_pullup before
* the last write_bit operation of a w1_write_8 which it currently * the last write_bit operation of a w1_write_8 which it currently
......
...@@ -495,7 +495,7 @@ void debugfs_remove(struct dentry *dentry) ...@@ -495,7 +495,7 @@ void debugfs_remove(struct dentry *dentry)
struct dentry *parent; struct dentry *parent;
int ret; int ret;
if (!dentry) if (IS_ERR_OR_NULL(dentry))
return; return;
parent = dentry->d_parent; parent = dentry->d_parent;
...@@ -527,7 +527,7 @@ void debugfs_remove_recursive(struct dentry *dentry) ...@@ -527,7 +527,7 @@ void debugfs_remove_recursive(struct dentry *dentry)
struct dentry *child; struct dentry *child;
struct dentry *parent; struct dentry *parent;
if (!dentry) if (IS_ERR_OR_NULL(dentry))
return; return;
parent = dentry->d_parent; parent = dentry->d_parent;
......
...@@ -307,6 +307,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -307,6 +307,7 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
{ {
struct sysfs_dirent *sd; struct sysfs_dirent *sd;
int is_dir; int is_dir;
int type;
if (flags & LOOKUP_RCU) if (flags & LOOKUP_RCU)
return -ECHILD; return -ECHILD;
...@@ -326,6 +327,15 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags) ...@@ -326,6 +327,15 @@ static int sysfs_dentry_revalidate(struct dentry *dentry, unsigned int flags)
if (strcmp(dentry->d_name.name, sd->s_name) != 0) if (strcmp(dentry->d_name.name, sd->s_name) != 0)
goto out_bad; goto out_bad;
/* The sysfs dirent has been moved to a different namespace */
type = KOBJ_NS_TYPE_NONE;
if (sd->s_parent) {
type = sysfs_ns_type(sd->s_parent);
if (type != KOBJ_NS_TYPE_NONE &&
sysfs_info(dentry->d_sb)->ns[type] != sd->s_ns)
goto out_bad;
}
mutex_unlock(&sysfs_mutex); mutex_unlock(&sysfs_mutex);
out_valid: out_valid:
return 1; return 1;
......
...@@ -691,6 +691,11 @@ struct device { ...@@ -691,6 +691,11 @@ struct device {
struct iommu_group *iommu_group; struct iommu_group *iommu_group;
}; };
static inline struct device *kobj_to_dev(struct kobject *kobj)
{
return container_of(kobj, struct device, kobj);
}
/* Get the wakeup routines, which depend on struct device */ /* Get the wakeup routines, which depend on struct device */
#include <linux/pm_wakeup.h> #include <linux/pm_wakeup.h>
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW). * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW).
* @state_on print_state is overriden with state_on if attached. If Null, * @state_on print_state is overriden with state_on if attached. If Null,
* default method of extcon class is used. * default method of extcon class is used.
* @state_off print_state is overriden with state_on if dettached. If Null, * @state_off print_state is overriden with state_on if detached. If Null,
* default method of extcon class is used. * default method of extcon class is used.
* *
* Note that in order for state_on or state_off to be valid, both state_on * Note that in order for state_on or state_off to be valid, both state_on
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#ifdef CONFIG_BLOCK #ifdef CONFIG_BLOCK
#define kobj_to_dev(k) container_of((k), struct device, kobj)
#define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev) #define dev_to_disk(device) container_of((device), struct gendisk, part0.__dev)
#define dev_to_part(device) container_of((device), struct hd_struct, __dev) #define dev_to_part(device) container_of((device), struct hd_struct, __dev)
#define disk_to_dev(disk) (&(disk)->part0.__dev) #define disk_to_dev(disk) (&(disk)->part0.__dev)
......
...@@ -216,6 +216,7 @@ struct log { ...@@ -216,6 +216,7 @@ struct log {
*/ */
static DEFINE_RAW_SPINLOCK(logbuf_lock); static DEFINE_RAW_SPINLOCK(logbuf_lock);
#ifdef CONFIG_PRINTK
/* the next printk record to read by syslog(READ) or /proc/kmsg */ /* the next printk record to read by syslog(READ) or /proc/kmsg */
static u64 syslog_seq; static u64 syslog_seq;
static u32 syslog_idx; static u32 syslog_idx;
...@@ -228,14 +229,19 @@ static u32 log_first_idx; ...@@ -228,14 +229,19 @@ static u32 log_first_idx;
/* index and sequence number of the next record to store in the buffer */ /* index and sequence number of the next record to store in the buffer */
static u64 log_next_seq; static u64 log_next_seq;
#ifdef CONFIG_PRINTK
static u32 log_next_idx; static u32 log_next_idx;
/* the next printk record to write to the console */
static u64 console_seq;
static u32 console_idx;
static enum log_flags console_prev;
/* the next printk record to read after the last 'clear' command */ /* the next printk record to read after the last 'clear' command */
static u64 clear_seq; static u64 clear_seq;
static u32 clear_idx; static u32 clear_idx;
#define LOG_LINE_MAX 1024 #define PREFIX_MAX 32
#define LOG_LINE_MAX 1024 - PREFIX_MAX
/* record buffer */ /* record buffer */
#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
...@@ -360,6 +366,7 @@ static void log_store(int facility, int level, ...@@ -360,6 +366,7 @@ static void log_store(int facility, int level,
struct devkmsg_user { struct devkmsg_user {
u64 seq; u64 seq;
u32 idx; u32 idx;
enum log_flags prev;
struct mutex lock; struct mutex lock;
char buf[8192]; char buf[8192];
}; };
...@@ -425,6 +432,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, ...@@ -425,6 +432,7 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
struct log *msg; struct log *msg;
u64 ts_usec; u64 ts_usec;
size_t i; size_t i;
char cont = '-';
size_t len; size_t len;
ssize_t ret; ssize_t ret;
...@@ -462,8 +470,25 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf, ...@@ -462,8 +470,25 @@ static ssize_t devkmsg_read(struct file *file, char __user *buf,
msg = log_from_idx(user->idx); msg = log_from_idx(user->idx);
ts_usec = msg->ts_nsec; ts_usec = msg->ts_nsec;
do_div(ts_usec, 1000); do_div(ts_usec, 1000);
len = sprintf(user->buf, "%u,%llu,%llu;",
(msg->facility << 3) | msg->level, user->seq, ts_usec); /*
* If we couldn't merge continuation line fragments during the print,
* export the stored flags to allow an optional external merge of the
* records. Merging the records isn't always neccessarily correct, like
* when we hit a race during printing. In most cases though, it produces
* better readable output. 'c' in the record flags mark the first
* fragment of a line, '+' the following.
*/
if (msg->flags & LOG_CONT && !(user->prev & LOG_CONT))
cont = 'c';
else if ((msg->flags & LOG_CONT) ||
((user->prev & LOG_CONT) && !(msg->flags & LOG_PREFIX)))
cont = '+';
len = sprintf(user->buf, "%u,%llu,%llu,%c;",
(msg->facility << 3) | msg->level,
user->seq, ts_usec, cont);
user->prev = msg->flags;
/* escape non-printable characters */ /* escape non-printable characters */
for (i = 0; i < msg->text_len; i++) { for (i = 0; i < msg->text_len; i++) {
...@@ -646,6 +671,15 @@ void log_buf_kexec_setup(void) ...@@ -646,6 +671,15 @@ void log_buf_kexec_setup(void)
VMCOREINFO_SYMBOL(log_buf_len); VMCOREINFO_SYMBOL(log_buf_len);
VMCOREINFO_SYMBOL(log_first_idx); VMCOREINFO_SYMBOL(log_first_idx);
VMCOREINFO_SYMBOL(log_next_idx); VMCOREINFO_SYMBOL(log_next_idx);
/*
* Export struct log size and field offsets. User space tools can
* parse it and detect any changes to structure down the line.
*/
VMCOREINFO_STRUCT_SIZE(log);
VMCOREINFO_OFFSET(log, ts_nsec);
VMCOREINFO_OFFSET(log, len);
VMCOREINFO_OFFSET(log, text_len);
VMCOREINFO_OFFSET(log, dict_len);
} }
#endif #endif
...@@ -876,7 +910,7 @@ static size_t msg_print_text(const struct log *msg, enum log_flags prev, ...@@ -876,7 +910,7 @@ static size_t msg_print_text(const struct log *msg, enum log_flags prev,
if (buf) { if (buf) {
if (print_prefix(msg, syslog, NULL) + if (print_prefix(msg, syslog, NULL) +
text_len + 1>= size - len) text_len + 1 >= size - len)
break; break;
if (prefix) if (prefix)
...@@ -907,7 +941,7 @@ static int syslog_print(char __user *buf, int size) ...@@ -907,7 +941,7 @@ static int syslog_print(char __user *buf, int size)
struct log *msg; struct log *msg;
int len = 0; int len = 0;
text = kmalloc(LOG_LINE_MAX, GFP_KERNEL); text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
if (!text) if (!text)
return -ENOMEM; return -ENOMEM;
...@@ -930,7 +964,8 @@ static int syslog_print(char __user *buf, int size) ...@@ -930,7 +964,8 @@ static int syslog_print(char __user *buf, int size)
skip = syslog_partial; skip = syslog_partial;
msg = log_from_idx(syslog_idx); msg = log_from_idx(syslog_idx);
n = msg_print_text(msg, syslog_prev, true, text, LOG_LINE_MAX); n = msg_print_text(msg, syslog_prev, true, text,
LOG_LINE_MAX + PREFIX_MAX);
if (n - syslog_partial <= size) { if (n - syslog_partial <= size) {
/* message fits into buffer, move forward */ /* message fits into buffer, move forward */
syslog_idx = log_next(syslog_idx); syslog_idx = log_next(syslog_idx);
...@@ -969,7 +1004,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear) ...@@ -969,7 +1004,7 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
char *text; char *text;
int len = 0; int len = 0;
text = kmalloc(LOG_LINE_MAX, GFP_KERNEL); text = kmalloc(LOG_LINE_MAX + PREFIX_MAX, GFP_KERNEL);
if (!text) if (!text)
return -ENOMEM; return -ENOMEM;
...@@ -1022,7 +1057,8 @@ static int syslog_print_all(char __user *buf, int size, bool clear) ...@@ -1022,7 +1057,8 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
struct log *msg = log_from_idx(idx); struct log *msg = log_from_idx(idx);
int textlen; int textlen;
textlen = msg_print_text(msg, prev, true, text, LOG_LINE_MAX); textlen = msg_print_text(msg, prev, true, text,
LOG_LINE_MAX + PREFIX_MAX);
if (textlen < 0) { if (textlen < 0) {
len = textlen; len = textlen;
break; break;
...@@ -1349,20 +1385,36 @@ static struct cont { ...@@ -1349,20 +1385,36 @@ static struct cont {
u64 ts_nsec; /* time of first print */ u64 ts_nsec; /* time of first print */
u8 level; /* log level of first message */ u8 level; /* log level of first message */
u8 facility; /* log level of first message */ u8 facility; /* log level of first message */
enum log_flags flags; /* prefix, newline flags */
bool flushed:1; /* buffer sealed and committed */ bool flushed:1; /* buffer sealed and committed */
} cont; } cont;
static void cont_flush(void) static void cont_flush(enum log_flags flags)
{ {
if (cont.flushed) if (cont.flushed)
return; return;
if (cont.len == 0) if (cont.len == 0)
return; return;
log_store(cont.facility, cont.level, LOG_NOCONS, cont.ts_nsec, if (cont.cons) {
NULL, 0, cont.buf, cont.len); /*
* If a fragment of this line was directly flushed to the
cont.flushed = true; * console; wait for the console to pick up the rest of the
* line. LOG_NOCONS suppresses a duplicated output.
*/
log_store(cont.facility, cont.level, flags | LOG_NOCONS,
cont.ts_nsec, NULL, 0, cont.buf, cont.len);
cont.flags = flags;
cont.flushed = true;
} else {
/*
* If no fragment of this line ever reached the console,
* just submit it to the store and free the buffer.
*/
log_store(cont.facility, cont.level, flags, 0,
NULL, 0, cont.buf, cont.len);
cont.len = 0;
}
} }
static bool cont_add(int facility, int level, const char *text, size_t len) static bool cont_add(int facility, int level, const char *text, size_t len)
...@@ -1371,7 +1423,8 @@ static bool cont_add(int facility, int level, const char *text, size_t len) ...@@ -1371,7 +1423,8 @@ static bool cont_add(int facility, int level, const char *text, size_t len)
return false; return false;
if (cont.len + len > sizeof(cont.buf)) { if (cont.len + len > sizeof(cont.buf)) {
cont_flush(); /* the line gets too long, split it up in separate records */
cont_flush(LOG_CONT);
return false; return false;
} }
...@@ -1380,12 +1433,17 @@ static bool cont_add(int facility, int level, const char *text, size_t len) ...@@ -1380,12 +1433,17 @@ static bool cont_add(int facility, int level, const char *text, size_t len)
cont.level = level; cont.level = level;
cont.owner = current; cont.owner = current;
cont.ts_nsec = local_clock(); cont.ts_nsec = local_clock();
cont.flags = 0;
cont.cons = 0; cont.cons = 0;
cont.flushed = false; cont.flushed = false;
} }
memcpy(cont.buf + cont.len, text, len); memcpy(cont.buf + cont.len, text, len);
cont.len += len; cont.len += len;
if (cont.len > (sizeof(cont.buf) * 80) / 100)
cont_flush(LOG_CONT);
return true; return true;
} }
...@@ -1394,7 +1452,7 @@ static size_t cont_print_text(char *text, size_t size) ...@@ -1394,7 +1452,7 @@ static size_t cont_print_text(char *text, size_t size)
size_t textlen = 0; size_t textlen = 0;
size_t len; size_t len;
if (cont.cons == 0) { if (cont.cons == 0 && (console_prev & LOG_NEWLINE)) {
textlen += print_time(cont.ts_nsec, text); textlen += print_time(cont.ts_nsec, text);
size -= textlen; size -= textlen;
} }
...@@ -1409,7 +1467,8 @@ static size_t cont_print_text(char *text, size_t size) ...@@ -1409,7 +1467,8 @@ static size_t cont_print_text(char *text, size_t size)
} }
if (cont.flushed) { if (cont.flushed) {
text[textlen++] = '\n'; if (cont.flags & LOG_NEWLINE)
text[textlen++] = '\n';
/* got everything, release buffer */ /* got everything, release buffer */
cont.len = 0; cont.len = 0;
} }
...@@ -1507,7 +1566,7 @@ asmlinkage int vprintk_emit(int facility, int level, ...@@ -1507,7 +1566,7 @@ asmlinkage int vprintk_emit(int facility, int level,
* or another task also prints continuation lines. * or another task also prints continuation lines.
*/ */
if (cont.len && (lflags & LOG_PREFIX || cont.owner != current)) if (cont.len && (lflags & LOG_PREFIX || cont.owner != current))
cont_flush(); cont_flush(LOG_NEWLINE);
/* buffer line if possible, otherwise store it right away */ /* buffer line if possible, otherwise store it right away */
if (!cont_add(facility, level, text, text_len)) if (!cont_add(facility, level, text, text_len))
...@@ -1525,7 +1584,7 @@ asmlinkage int vprintk_emit(int facility, int level, ...@@ -1525,7 +1584,7 @@ asmlinkage int vprintk_emit(int facility, int level,
if (cont.len && cont.owner == current) { if (cont.len && cont.owner == current) {
if (!(lflags & LOG_PREFIX)) if (!(lflags & LOG_PREFIX))
stored = cont_add(facility, level, text, text_len); stored = cont_add(facility, level, text, text_len);
cont_flush(); cont_flush(LOG_NEWLINE);
} }
if (!stored) if (!stored)
...@@ -1616,9 +1675,20 @@ asmlinkage int printk(const char *fmt, ...) ...@@ -1616,9 +1675,20 @@ asmlinkage int printk(const char *fmt, ...)
} }
EXPORT_SYMBOL(printk); EXPORT_SYMBOL(printk);
#else #else /* CONFIG_PRINTK */
#define LOG_LINE_MAX 0
#define PREFIX_MAX 0
#define LOG_LINE_MAX 0 #define LOG_LINE_MAX 0
static u64 syslog_seq;
static u32 syslog_idx;
static u64 console_seq;
static u32 console_idx;
static enum log_flags syslog_prev;
static u64 log_first_seq;
static u32 log_first_idx;
static u64 log_next_seq;
static enum log_flags console_prev;
static struct cont { static struct cont {
size_t len; size_t len;
size_t cons; size_t cons;
...@@ -1902,10 +1972,34 @@ void wake_up_klogd(void) ...@@ -1902,10 +1972,34 @@ void wake_up_klogd(void)
this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP);
} }
/* the next printk record to write to the console */ static void console_cont_flush(char *text, size_t size)
static u64 console_seq; {
static u32 console_idx; unsigned long flags;
static enum log_flags console_prev; size_t len;
raw_spin_lock_irqsave(&logbuf_lock, flags);
if (!cont.len)
goto out;
/*
* We still queue earlier records, likely because the console was
* busy. The earlier ones need to be printed before this one, we
* did not flush any fragment so far, so just let it queue up.
*/
if (console_seq < log_next_seq && !cont.cons)
goto out;
len = cont_print_text(text, size);
raw_spin_unlock(&logbuf_lock);
stop_critical_timings();
call_console_drivers(cont.level, text, len);
start_critical_timings();
local_irq_restore(flags);
return;
out:
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
}
/** /**
* console_unlock - unlock the console system * console_unlock - unlock the console system
...@@ -1923,7 +2017,7 @@ static enum log_flags console_prev; ...@@ -1923,7 +2017,7 @@ static enum log_flags console_prev;
*/ */
void console_unlock(void) void console_unlock(void)
{ {
static char text[LOG_LINE_MAX]; static char text[LOG_LINE_MAX + PREFIX_MAX];
static u64 seen_seq; static u64 seen_seq;
unsigned long flags; unsigned long flags;
bool wake_klogd = false; bool wake_klogd = false;
...@@ -1937,19 +2031,7 @@ void console_unlock(void) ...@@ -1937,19 +2031,7 @@ void console_unlock(void)
console_may_schedule = 0; console_may_schedule = 0;
/* flush buffered message fragment immediately to console */ /* flush buffered message fragment immediately to console */
raw_spin_lock_irqsave(&logbuf_lock, flags); console_cont_flush(text, sizeof(text));
if (cont.len && (cont.cons < cont.len || cont.flushed)) {
size_t len;
len = cont_print_text(text, sizeof(text));
raw_spin_unlock(&logbuf_lock);
stop_critical_timings();
call_console_drivers(cont.level, text, len);
start_critical_timings();
local_irq_restore(flags);
} else
raw_spin_unlock_irqrestore(&logbuf_lock, flags);
again: again:
for (;;) { for (;;) {
struct log *msg; struct log *msg;
...@@ -1986,6 +2068,7 @@ void console_unlock(void) ...@@ -1986,6 +2068,7 @@ void console_unlock(void)
* will properly dump everything later. * will properly dump everything later.
*/ */
msg->flags &= ~LOG_NOCONS; msg->flags &= ~LOG_NOCONS;
console_prev = msg->flags;
goto skip; goto skip;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment