17 Apr, 2014
2 commits
-
__w1_attach_slave_device calls device_add which calls w1_bus_notify
which calls the w1_bq27000 slave driver, which calls
platform_device_add and device_add and deadlocks on getting
&(&priv->bus_notifier)->rwsem as it is still held in the previous
device_add. This avoids the problem by processing the family
add/remove outside of the slave device_add call.Commit 47eba33a0997fc7362a introduced this deadlock and added
a KOBJ_ADD, as the add was already reported in device_register two add
events were being sent. This change suppresses the device_register
add so that any slave device sysfs entries are setup before the add
goes out.Belisko Marek reported this change fixed the deadlock he was seeing on
ARM device tree, while testing on my x86-64 system never saw the
deadlock.Reported-by: Belisko Marek
Signed-off-by: David Fries
Signed-off-by: Greg Kroah-Hartman -
If the message type is W1_MASTER_CMD or W1_SLAVE_CMD, then a reference
is taken when searching for the slave or master device. If there
isn't any following data m->len (mlen is a copy) is 0 and packing up
the message for later execution is skipped leaving nothing to
decrement the reference counts.Way back when, m->len was checked before the search that increments the
reference count, but W1_LIST_MASTERS has no additional data, the check
was moved in 9be62e0b2fadaf5ff causing this bug.This change reorders to put the check before the reference count is
incremented avoiding the problem.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman
01 Mar, 2014
4 commits
-
This helps increasing build testing coverage.
To do this, __raw_{read,write}b() functions was be replaced with
simple {read,write}b() variants.Signed-off-by: Alexander Shiyan
Signed-off-by: Greg Kroah-Hartman -
- Remove old and currently wrong address of the FSF from license
parts of the code.
- Remove unused #include and sort remaining headers alphabetically.
- Remove unised definitions.
- Add definitions for bit-fields.
- Add missing module owner field.Signed-off-by: Alexander Shiyan
Signed-off-by: Greg Kroah-Hartman -
This patch fix mxc_w1_ds2_reset_bus() return value.
According to i.MX reference manual, "presence status" reflected
in the bit 6 of control register.Signed-off-by: Alexander Shiyan
Signed-off-by: Greg Kroah-Hartman -
Configuration for masters and slaves is included only if W1 symbol
enabled, so no reason to check it once more.Signed-off-by: Alexander Shiyan
Signed-off-by: Greg Kroah-Hartman
16 Feb, 2014
2 commits
-
of_get_gpio() might return -EPROBE_DEFER meaning that the driver
providing the gpio isn't ready yet. If that happens for the first gpio
the resulting kernel output without this patch is:w1-gpio somename: Failed to parse DT
platform somename: Driver w1-gpio requests probe deferralThe first message is misleading and so is suppressed with this patch.
Further if determining the gpio to switch the external pullup yields
-EPROBE_DEFER this error should be passed back to the caller instead of
just continuing without pullup.Signed-off-by: Uwe Kleine-König
Signed-off-by: Greg Kroah-Hartman -
On 64 bit systems, a large value for "long tmp" is truncated when
assigning to "int md->max_slave_count" so we still end up with a value
less than one despite the "tmp < 1" check.This is more of a problem for static checkers than a real life issue,
but it's simple enough to fix.Acked-by: David Fries
Signed-off-by: Dan Carpenter
Signed-off-by: Greg Kroah-Hartman
09 Feb, 2014
1 commit
-
This reverts ds1wm.c from commit d3a8a9dbb903c73a7ec2deae4c9b7d74b6834f4c.
Of the three files changed ds1wm.c ds2490.c and w1_netlink.c, it turns out
ds1wm.c was locking bus_mutex, but inside the loop and I missed it.
Reverting ds1wm.c to the previous version.Reported-by: Dan Carpenter
Signed-off-by: David Fries
Signed-off-by: Greg Kroah-Hartman
08 Feb, 2014
15 commits
-
The bus_mutex needs to be taken to serialize access to a specific bus.
netlink wasn't updated when bus_mutex was added and was calling
without that lock held, and not all of the masters were holding the
bus_mutex in a search. This was causing the ds2490 hardware to stop
responding when both netlink and /sys slaves were executing bus
commands at the same time.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Switch the code documentation format style to DocBook format, enable
DocBook documentation generation, and fix some comments.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
The first line printed from w1_slave gives the context of the w1
device. So does the second line, but if the CRC check failed, the
second line contains the last successful result. It is confusing when
it prints the temperature next to the line that might be a previous
conversion and has nothing to do with that printed temperature value.
Modify the code to store the last good conversion in family_data,
which is designed for custom data structures.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
The hardware search was failing without the COMM_RST flag. Enabled
the flag and rewrote the function to handle more than one buffer of
results and to continuing where the search left off. Remove hardware
search note from the limitations now that it works. The "w1: ds2490
USB setup fixes" change went from 23.16 seconds to about 3 seconds,
this takes the time for the search down to .307346 seconds.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Calling usb_reset_configuration after usb_set_interface resets the
interface that was just selected, so call reset first.
Using alternative 3 greatly speeds the one wire search.
alt 0 or 1, 10ms int, 23.16 seconds
alt 2 or 3, 1ms int, 2.99 to 3.05 secondsUse usb_interrupt_msg not usb_bulk_msg as it is an interrupt pipe
(bulk worked, it was just technically the wrong call).Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Use a #define for the usb vendor request type, clear the status
byte and use that instead of a magic offset in checking if idle.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Unicast one wire replies back to the sender portid to avoid multiple
programs getting each other's messages, especially as the response
can't be uniquely identified with the sequence coming from the
requesting program when both programs generate the same id. Continue
to broadcast events such as add/remove master/slave devices.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
This allows replying only to the requestor portid while still
supporting broadcasting. Pass 0 to portid for the previous behavior.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Netlink is a socket interface and is expected to be asynchronous.
Clients can now make w1 requests without blocking by making use of the
w1_master thread to process netlink commands which was previously only
used for doing an automatic bus search.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Introduce new commands to add, remove, and list slave devices through
the netlink interface. This can be useful to skip the search on a
static network. They could previously only be added or removed
through automatic search or sysfs, and this allows a program to only
use netlink.Only allocate memory when needed, so move kzalloc into w1_get_slaves
where it was used.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Search will detect at most max_slave_count devices per run, if there
are more pick up the next search where the previous left off.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
w1_max_slave_count is only used to abort the search early
or take a fast search (when 1), so there isn't any reason to not allow
it to be updated through sysfs. Memory is not allocated based on
the current value and 10 is a rather low base number, increasing to
64, and printing a message the first time the count is reached and
there were more devices to discover to let the user know why not
all the devices were found.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
It's valid to set the search count to 0 to stop searching, so don't
wake up the search thread to not search.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Before 63706172f33 "rework kthread_stop()" kthread_should_stop()
always returned false when called from a non-kthread task, after it
would oops as a non-kthread didn't have that structure and netlink was
calling search from a thread which wasn't a kthread. 9d1817cab2f030
"w1: fix oops when w1_search is called from netlink connector",
modified the code to avoid calling kthread_stop from a netlink thread.Introduce a w1_master flag and bit W1_ABORT_SEARCH to identify abort
to cleanly support both kthread and netlink search abort. A search
can take seconds to run, so it is important to abort early if the
hardware is removed in the middle of a search.Signed-off-by: David Fries
Acked-by: Evgeniy Polyakov
Cc: Marcin Jurkowski
Cc: Josh Boyer
Cc: Sven Geggus
Signed-off-by: Greg Kroah-Hartman -
Previous logic,
if (avail > 8) {
store slave;
return;
}
send data; clear;The logic error is, if there isn't space send the buffer and clear,
but the slave wasn't added to the now empty buffer loosing that slave
id. It also should have been "if (avail >= 8)" because when it is 8,
there is space.Instead, if there isn't space send and clear the buffer, then there is
always space for the slave id.Signed-off-by: David Fries
Cc: stable@vger.kernel.org
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman
24 Jan, 2014
1 commit
-
Strong pullup is emulated by driving pin logic high after write command
when using tri-state push-pull GPIO.Signed-off-by: Evgeny Boger
Cc: Greg KH
Acked-by: David Fries
Acked-by: Evgeniy Polyakov
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
09 Dec, 2013
3 commits
-
Signed-off-by: Alexander Shiyan
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Base frequency should be as close as possible to 1 MHz. This patch
adds warnings when clock is unreliable, according to i.MX datasheet.Signed-off-by: Alexander Shiyan
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
Private field "clkdiv" is not used outside "probe", so there are
no reason to keep it in driver.Signed-off-by: Alexander Shiyan
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman
15 Nov, 2013
1 commit
-
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change to make
the code simpler and enhance the readability.Signed-off-by: Jingoo Han
Acked-by: Evgeniy Polyakov
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
13 Nov, 2013
2 commits
-
On architectures where long is more then 32 bits, modifying a 32-bit field
with set_bit (and other atomic bit operations) may cause bytes following
the field to by modified.Because the endianness of the bits within a field is the native endianness
of the CPU[1], on big-endian machines, bit number zero is in the last byte
of the field.Therefore, `set_bit(0, ptr)' on a 64-bit big-endian machine is roughly
equivalent to `((char *)ptr)[7] |= 1', and since w1 driver uses a 32-bit
field for holding the flags, this causes bytes beyond the field to be
modified.[1] From Documentation/atomic_ops.txt:
Native atomic bit operations are defined to operate on objects
aligned to the size of an "unsigned long" C data type, and are
least of that size. The endianness of the bits within each
"unsigned long" are the native endianness of the cpu.Signed-off-by: Michal Nazarewicz
Cc: Evgeniy Polyakov
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change to make
the code simpler and enhance the readability.Signed-off-by: Jingoo Han
Acked-by: Evgeniy Polyakov
Cc: Greg KH
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
30 Oct, 2013
2 commits
-
Signed-off-by: Markus Pargmann
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
The first DT gpio is necessary for this driver, but errors returned for
of_get_gpio are ignored.This patch adds a return value check for the first of_get_gpio.
Signed-off-by: Markus Pargmann
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman
20 Oct, 2013
1 commit
-
We want the fixes in here as well.
Signed-off-by: Greg Kroah-Hartman
17 Oct, 2013
2 commits
-
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.
Signed-off-by: Michael Opdenacker
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman -
This patch proposes to remove the use of the IRQF_DISABLED flag
It's a NOOP since 2.6.35 and it will be removed one day.
Signed-off-by: Michael Opdenacker
Acked-by: Evgeniy Polyakov
Signed-off-by: Greg Kroah-Hartman
07 Oct, 2013
2 commits
-
request_module for w1 slave modules needs to be called with the w1
master mutex unlocked. Because w1_attach_slave_device gets always(?)
called with mutex locked, we need to temporarily unlock the w1 master
mutex for the loading of the w1 slave module.Signed-off by: Hans-Frieder Vogt
Acked-by: Evgeniy Polyakov
Cc: stable # 3.11+Signed-off-by: Greg Kroah-Hartman
-
Introduce a check to make sure that fops are only called if they have
been defined by the slave module.Without this check modules like w1_smem cause a NULL pointer dereference
bug.Signed-off by: Hans-Frieder Vogt
Acked-by: Evgeniy Polyakov
Cc: stable # 3.11+Signed-off-by: Greg Kroah-Hartman
13 Sep, 2013
1 commit
-
After the last architecture switched to generic hard irqs the config
options HAVE_GENERIC_HARDIRQS & GENERIC_HARDIRQS and the related code
for !CONFIG_GENERIC_HARDIRQS can be removed.Signed-off-by: Martin Schwidefsky
12 Sep, 2013
1 commit
-
The driver core clears the driver data to NULL after device_release or on
probe failure. Thus, it is not needed to manually clear the device driver
data to NULL.Signed-off-by: Jingoo Han
Cc: Evgeniy Polyakov
Cc: Greg KH
Acked-by: Shawn Guo
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds