27 Sep, 2020
1 commit
-
Fix missing 'kfree_const(cell->name)' when call to
nvmem_cell_info_to_nvmem_cell() in several places:* after nvmem_cell_info_to_nvmem_cell() failed during
nvmem_add_cells()* during nvmem_device_cell_{read,write} when cell->name is
kstrdup'ed() without calling kfree_const() at the end, but
really there is no reason to do that 'dup, because the cell
instance is allocated on the stack for some short period to be
read/write without exposing it to the caller.So the new nvmem_cell_info_to_nvmem_cell_nodup() helper is introduced
which is used to convert cell_info -> cell without name duplication as
a lighweight version of nvmem_cell_info_to_nvmem_cell().Fixes: e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.")
Reviewed-by: Srinivas Kandagatla
Acked-by: Srinivas Kandagatla
Signed-off-by: Vadym Kochan
Link: https://lore.kernel.org/r/20200923204456.14032-1-vadym.kochan@plvision.eu
Signed-off-by: Greg Kroah-Hartman
18 Sep, 2020
3 commits
-
of_parse_phandle() returns device_node with incremented ref count
which needs to be decremented by of_node_put() when device_node
is not used.Fixes: e2a5402ec7c6 ("nvmem: Add nvmem_device based consumer apis.")
Signed-off-by: Vadym Kochan
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200917134437.16637-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
We don't need to specify any ranges when allocating IDs so we can switch
to ida_alloc() and ida_free() instead of the ida_simple_ counterparts.ida_simple_get(ida, 0, 0, gfp) is equivalent to
ida_alloc_range(ida, 0, UINT_MAX, gfp) which is equivalent to
ida_alloc(ida, gfp). Note: IDR will never actually allocate an ID
larger than INT_MAX.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200917134437.16637-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Use kobj_to_dev() instead of container_of()
Signed-off-by: Tian Tao
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200917134437.16637-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
29 Jul, 2020
4 commits
-
For nvmem providers which have multiple instances, it is required
to suffix the provider name with proper id, so that they do not
confict for the same name. Currently the core does not handle
this case properly eventhough core already has logic to generate the id.This patch add new devid type NVMEM_DEVID_AUTO for providers to be
able to allow core to assign id and append it to provier name.Reported-by: Shawn Guo
Signed-off-by: Srinivas Kandagatla
Tested-by: Shawn Guo
Link: https://lore.kernel.org/r/20200722100705.7772-8-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Complement the u16, u32 and u64 helpers with a u8 variant to ease
accessing byte-sized values.This helper will be useful for Realtek Digital Home Center platforms,
which store some byte and sub-byte sized values in non-volatile memory.Signed-off-by: Andreas Färber
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200722100705.7772-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
It's "an unsigned" but "a U".
Similarly, "an entry" but "a binary entry".While at it, also drop superfluous articles for negative and zero.
Signed-off-by: Andreas Färber
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200722100705.7772-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
The 'struct nvmem_config' has a stride attribute that specifies the
needed alignment for accesses into the nvmem. This is used in
nvmem_cell_info_to_nvmem_cell() but not in the sysfs read/write
functions. If the alignment is important in one place it's important
everywhere, so let's add enforcement.For now we'll consider it totally invalid to access with the wrong
alignment. We could relax this in the read case where we could just
read some extra bytes and throw them away. Relaxing it in the write
case seems harder (and less safe?) since we'd have to read some data
first and then write it back. To keep it symmetric we'll just
disallow it in both cases.Reported-by: Ravi Kumar Bokka
Signed-off-by: Douglas Anderson
Reviewed-by: Ravi Kumar Bokka
Tested-by: Ravi Kumar Bokka
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200722100705.7772-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
15 May, 2020
1 commit
-
Commit 2a127da461a9 ("nvmem: add support for the write-protect pin")
added support for handling write-protect pins to the nvmem core, and
Commit 1c89074bf850 ("eeprom: at24: remove the write-protect pin support")
retrofitted the at24 driver to use this support.These changes broke write() on the nvmem sysfs attribute for eeproms
which utilize a write-protect pin, as the write callback invokes the
nvmem device's reg_write callback directly which no longer handles
changing the state of the write-protect pin.Change the read and write callbacks for the sysfs attribute to invoke
nvmme_reg_read/nvmem_reg_write helpers which handle this, rather than
calling reg_read/reg_write directly.Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
Signed-off-by: Michael Auchter
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200511145042.31223-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
28 Apr, 2020
1 commit
-
file permission are derived based on various configs for
default nvmem sysfs file, reuse it to create the eeprom
compat file too.Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200417121306.23121-1-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
26 Mar, 2020
3 commits
-
Now that we are using is_bin_visible callback, we do not need
nvmem_sysfs_get_groups() anymore so move all the relevant data-structures
and code to core.cSigned-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200325131951.31887-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
By using is_bin_visible callback to set permissions will remove a
large list of attribute groups. These group permissions can be
dynamically derived in the callback.Also add checks for read/write callbacks and set permissions accordingly.
Suggested-by: Greg KH
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200325131951.31887-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
use device_register/unregister instead of spliting them with no use.
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200324171600.15606-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
25 Mar, 2020
1 commit
-
As we are planning to move to use sysfs is_bin_visible callback,
having root_only as part of nvmem_device will help decide correct
permissions.Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200325122116.15096-2-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
19 Mar, 2020
7 commits
-
nvmem provider has to provide either reg_read/write, add a check
to enforce this.Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-9-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Put the write-protect GPIO descriptor in nvmem_release() so that it can
be automatically released when the associated device's reference count
drops to 0.Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
Reported-by: Geert Uytterhoeven
Signed-off-by: Khouloud Touil
Cc: stable
[Bartosz: tweak the commit message]
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-8-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
We need to free the ida mapping and nvmem struct if the write-protect
GPIO lookup fails.Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-7-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Visibly separate the GPIO request from the previous operation in the
code with a newline.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-6-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Two newlines are unnecessary - remove one.
Signed-off-by: Bartosz Golaszewski
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Add nvmem_cell_read_u64() helper to ease read of an u64 value on consumer
side. This helper is useful on some sunxi platform that has 64 bits data
cells stored in no volatile memory.Signed-off-by: Yangtao Li
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
Now there are nvmem_cell_read_u16 and nvmem_cell_read_u32.
They are very similar, let's strip out a common part.And use nvmem_cell_read_common to simplify their implementation.
Signed-off-by: Yangtao Li
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200310132257.23358-3-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman
08 Feb, 2020
1 commit
-
Pull i2c updates from Wolfram Sang:
"i2c core:- huge improvements and refactorizations of the Linux I2C
documentation (lots of thanks to Luca for doing it and Jean for the
careful review)- subsystem wide API conversion to i2c_new_client_device()
- remove obsolete parport-light driver
- smaller core updates (removal of 'extern', enabling more compile
testing, use more helper macros)- and quite a bunch of driver updates (new IDs, simplifications,
better PM, support of atomic transfers and other improvements)i2c-mux:
- The main feature is the idle-state rework of the pca954x driver
from Biwen Liat24 driver:
- minor maintenance: update the license tag, sort headers
- move support for the write-protect pin into nvmem core
- add a reference to the new wp-gpios property in nvmem to at25
bindings- add support for regulator and pm_runtime control"
* 'i2c/for-5.6' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (91 commits)
i2c: cros-ec-tunnel: Fix ACPI identifier
i2c: cros-ec-tunnel: Fix slave device enumeration
i2c: stm32f7: add PM_SLEEP suspend/resume support
i2c: cadence: Fix wording in i2c-cadence driver
i2c: cadence: Fix power management order of operations
i2c: cadence: Fix error printing in case of defer
i2c: cadence: Handle transfer_size rollover
i2c: i801: Add support for Intel Comet Lake PCH-V
docs: i2c: writing-clients: properly name the stop condition
docs: i2c: i2c-protocol: use same wording as smbus-protocol
docs: i2c: rename sections so the overall picture is clearer
docs: i2c: old-module-parameters: use monospace instead of ""
docs: i2c: old-module-parameters: clarify this is for obsolete kernels
docs: i2c: old-module-parameters: fix internal hyperlink
docs: i2c: instantiating-devices: use monospace for sysfs attributes
docs: i2c: instantiating-devices: rearrange static instatiation
docs: i2c: instantiating-devices: fix internal hyperlink
docs: i2c: smbus-protocol: improve I2C Block transactions description
docs: i2c: smbus-protocol: fix punctuation
docs: i2c: smbus-protocol: fix typo
...
10 Jan, 2020
2 commits
-
nvmem_cell_info_to_nvmem_cell implementation has static
allocation of name. nvmem_add_cells_from_of() call may
return error and kfree name results in memory abort. Use
kstrdup_const() and kfree_const calls for name alloc and free.Unable to handle kernel paging request at virtual address ffffffffffe44888
Mem abort info:
ESR = 0x96000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
swapper pgtable: 64k pages, 48-bit VAs, pgdp=00000000815d0000
[ffffffffffe44888] pgd=0000000081d30803, pud=0000000081d30803,
pmd=0000000000000000
Internal error: Oops: 96000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 2 PID: 43 Comm: kworker/2:1 Tainted
Hardware name: quill (DT)
Workqueue: events deferred_probe_work_func
pstate: a0000005 (NzCv daif -PAN -UAO)
pc : kfree+0x38/0x278
lr : nvmem_cell_drop+0x68/0x80
sp : ffff80001284f9d0
x29: ffff80001284f9d0 x28: ffff0001f677e830
x27: ffff800011b0b000 x26: ffff0001c36e1008
x25: ffff8000112ad000 x24: ffff8000112c9000
x23: ffffffffffffffea x22: ffff800010adc7f0
x21: ffffffffffe44880 x20: ffff800011b0b068
x19: ffff80001122d380 x18: ffffffffffffffff
x17: 00000000d5cb4756 x16: 0000000070b193b8
x15: ffff8000119538c8 x14: 0720072007200720
x13: 07200720076e0772 x12: 07750762072d0765
x11: 0773077507660765 x10: 072f073007300730
x9 : 0730073207380733 x8 : 0000000000000151
x7 : 07660765072f0720 x6 : ffff0001c00e0f00
x5 : 0000000000000000 x4 : ffff0001c0b43800
x3 : ffff800011b0b068 x2 : 0000000000000000
x1 : 0000000000000000 x0 : ffffffdfffe00000
Call trace:
kfree+0x38/0x278
nvmem_cell_drop+0x68/0x80
nvmem_device_remove_all_cells+0x2c/0x50
nvmem_register.part.9+0x520/0x628
devm_nvmem_register+0x48/0xa0
tegra_fuse_probe+0x140/0x1f0
platform_drv_probe+0x50/0xa0
really_probe+0x108/0x348
driver_probe_device+0x58/0x100
__device_attach_driver+0x90/0xb0
bus_for_each_drv+0x64/0xc8
__device_attach+0xd8/0x138
device_initial_probe+0x10/0x18
bus_probe_device+0x90/0x98
deferred_probe_work_func+0x74/0xb0
process_one_work+0x1e0/0x358
worker_thread+0x208/0x488
kthread+0x118/0x120
ret_from_fork+0x10/0x18
Code: d350feb5 f2dffbe0 aa1e03f6 8b151815 (f94006a0)
---[ end trace 49b1303c6b83198e ]---Fixes: badcdff107cbf ("nvmem: Convert to using %pOFn instead of device_node.name")
Signed-off-by: Bitan Biswas
Cc: stable
Signed-off-by: Srinivas Kandagatla
Link: https://lore.kernel.org/r/20200109104017.6249-5-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman -
nvmem_register() returns a pointer, not a long int. Use ERR_CAST() to
cast the struct gpio_desc pointer to struct nvmem_device.Reported-by: kbuild test robot
Fixes: 2a127da461a9 ("nvmem: add support for the write-protect pin")
Signed-off-by: Bartosz Golaszewski
Acked-by: Srinivas Kandagatla
09 Jan, 2020
1 commit
-
The write-protect pin handling looks like a standard property that
could benefit other users if available in the core nvmem framework.Instead of modifying all the memory drivers to check this pin, make
the NVMEM subsystem check if the write-protect GPIO being passed
through the nvmem_config or defined in the device tree and pull it
low whenever writing to the memory.There was a suggestion for introducing the gpiodesc from pdata, but
as pdata is already removed it could be replaced by adding it to
nvmem_config.Reference: https://lists.96boards.org/pipermail/dev/2018-August/001056.html
Signed-off-by: Khouloud Touil
Reviewed-by: Linus Walleij
Acked-by: Srinivas Kandagatla
Signed-off-by: Bartosz Golaszewski
08 Oct, 2019
1 commit
-
nvmem_device_find provides a way to search for nvmem devices with
the help of a match function simlair to bus_find_device.Reviewed-by: Srinivas Kandagatla
Acked-by: Srinivas Kandagatla
Signed-off-by: Thomas Bogendoerfer
Signed-off-by: Paul Burton
Cc: Jonathan Corbet
Cc: Ralf Baechle
Cc: James Hogan
Cc: Lee Jones
Cc: David S. Miller
Cc: Alessandro Zummo
Cc: Alexandre Belloni
Cc: Greg Kroah-Hartman
Cc: Jiri Slaby
Cc: linux-doc@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: linux-rtc@vger.kernel.org
Cc: linux-serial@vger.kernel.org
30 Jul, 2019
1 commit
-
Introduce wrappers for {bus/driver/class}_find_device() to
locate devices by its of_node.Cc: Maarten Lankhorst
Cc: Maxime Ripard
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie
Cc: Daniel Vetter
Cc: devicetree@vger.kernel.org
Cc: Florian Fainelli
Cc: Frank Rowand
Cc: Heiko Stuebner
Cc: Liam Girdwood
Cc: linux-i2c@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Cc: linux-spi@vger.kernel.org
Cc: Mathieu Poirier
Cc: Rob Herring
Cc: Srinivas Kandagatla
Cc: Takashi Iwai
Cc: Alan Tull
Cc: linux-fpga@vger.kernel.org
Cc: Peter Rosin
Cc: Florian Fainelli
Cc: Heiner Kallweit
Cc: "David S. Miller"
Cc: Andrew Lunn
Cc: Liam Girdwood
Cc: "Rafael J. Wysocki"
Cc: Thor Thayer
Cc: Jiri Slaby
Cc: Andrew Lunn
Cc: Peter Rosin
Signed-off-by: Suzuki K Poulose
Acked-by: Lee Jones
Acked-by: Wolfram Sang # I2C part
Acked-by: Moritz Fischer # For FPGA part
Acked-by: Mark Brown
Link: https://lore.kernel.org/r/20190723221838.12024-3-suzuki.poulose@arm.com
Signed-off-by: Greg Kroah-Hartman
24 Jun, 2019
1 commit
-
There is an arbitrary difference between the prototypes of
bus_find_device() and class_find_device() preventing their callers
from passing the same pair of data and match() arguments to both of
them, which is the const qualifier used in the prototype of
class_find_device(). If that qualifier is also used in the
bus_find_device() prototype, it will be possible to pass the same
match() callback function to both bus_find_device() and
class_find_device(), which will allow some optimizations to be made in
order to avoid code duplication going forward. Also with that, constify
the "data" parameter as it is passed as a const to the match function.For this reason, change the prototype of bus_find_device() to match
the prototype of class_find_device() and adjust its callers to use the
const qualifier in accordance with the new prototype of it.Cc: Alexander Shishkin
Cc: Andrew Lunn
Cc: Andreas Noever
Cc: Arnd Bergmann
Cc: Bjorn Helgaas
Cc: Corey Minyard
Cc: Christian Borntraeger
Cc: David Kershner
Cc: "David S. Miller"
Cc: David Airlie
Cc: Felipe Balbi
Cc: Frank Rowand
Cc: Grygorii Strashko
Cc: Harald Freudenberger
Cc: Hartmut Knaack
Cc: Heiko Stuebner
Cc: Jason Gunthorpe
Cc: Jonathan Cameron
Cc: "James E.J. Bottomley"
Cc: Len Brown
Cc: Mark Brown
Cc: Michael Ellerman
Cc: Michael Jamet
Cc: "Martin K. Petersen"
Cc: Peter Oberparleiter
Cc: Sebastian Ott
Cc: Srinivas Kandagatla
Cc: Yehezkel Bernat
Cc: rafael@kernel.org
Acked-by: Corey Minyard
Acked-by: David Kershner
Acked-by: Mark Brown
Acked-by: Rafael J. Wysocki
Acked-by: Srinivas Kandagatla
Acked-by: Wolfram Sang # for the I2C parts
Acked-by: Rob Herring
Signed-off-by: Suzuki K Poulose
Signed-off-by: Greg Kroah-Hartman
26 Apr, 2019
3 commits
-
Many nvmem providers are not very keen on having default sysfs
nvmem entry, as most of the usecases for them are inside kernel
itself. And in some cases read/writes to some areas in nvmem are
restricted and trapped at secure monitor level, so accessing them
from userspace would result in board reboots.This patch adds new NVMEM_SYSFS Kconfig to make binary sysfs entry
an optional one. This provision will give more flexibility to users.
This patch also moves existing sysfs code to a new file so that its
not compiled in when its not really required.Signed-off-by: Srinivas Kandagatla
Reviewed-by: Mika Westerberg
Reviewed-by: Gaurav Kohli
Tested-by: Gaurav Kohli
Signed-off-by: Greg Kroah-Hartman -
When the bit_offset in the cell is zero, the pointer to the msb will
not be properly initialized (ie, will still be pointing to the first
byte in the buffer).This being the case, if there are bits to clear in the msb, those will
be left untouched while the mask will incorrectly clear bit positions
on the first byte.This commit also makes sure that any byte unused in the cell is
cleared.Signed-off-by: Jorge Ramirez-Ortiz
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
Add nvmem_cell_read_u16() helper to ease read of an u16 value on consumer
side. This is inspired by nvmem_cell_read_u32() function.
This helper is useful on stm32 that has 16 bits data cells stored in non
volatile memory.Signed-off-by: Fabrice Gasnier
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman
19 Feb, 2019
1 commit
-
blocking_notifier_call_chain() returns the value returned by the last
registered callback. A positive return value doesn't indicate an error
and an nvmem device should correctly register irrespective of any
notifier callback failures. Drop the retval check.Fixes: bee1138bea15 ("nvmem: add a notifier chain")
Cc: stable@vger.kernel.org
Signed-off-by: Bartosz Golaszewski
Acked-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman
31 Jan, 2019
7 commits
-
Once the correct cell has been found there is no need to continue
iterating, just stop there. While at it replace the goto used to leave
the loop with simple break statements.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
__nvmem_device_get() make use of bus_find_device() to get the relevant
device and this function increase the reference count of the device
found, however this is not accounted for anywhere. Fix
__nvmem_device_get() and __nvmem_device_put() to properly release this
reference count.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
In nvmem_device_get(), when the device lookup fails with DT it
currently fallback on nvmem_find() which is wrong for two reasons.
First nvmem_find() return NULL when nothing is found instead of an
ERR_PTR. But nvmem_find() also just lookup the device, it doesn't
reference the module and increment the reference count like it is done
in the DT path.To fix this we replace the call to nvmem_find() with a call to
__nvmem_device_get() which does all the referencing and return a
proper ERR_PTR in case of error.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
of_nvmem_device_get() would crash if NULL was passed as a connection
ID. Rework this to use the usual sementic of assuming the first
connection when no connection ID is given.Furthermore of_nvmem_device_get() would return -EINVAL when it failed
to resolve the connection, making it impossible to properly implement
an optional connection. Return -ENOENT instead to let the caller know
that the connection doesn't exists.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
If the cell list is not empty and nvmem_find_cell_by_node/name() is
called for a cell that is not present in the list they will return an
invalid pointer instead of NULL. This happen because
list_for_each_entry() stop once it reach the list head again, but as
the list head is not contained in a struct nvmem_cell the iteration
variable then contains an invalid value.This is easily solved by using a variable to iterate over the list and
one to return the cell found.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
of_nvmem_cell_get() should return -ENOENT when a cell isn't defined,
otherwise callers can't distinguish between a missing cell and other
errors.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman -
If no write callback is given the device should be marked as read-only.
While at it also move from a bit or to a logical or as that is a logical
expression.Signed-off-by: Alban Bedel
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman
06 Dec, 2018
1 commit
-
We want to add nvmem support for MTD. TI DaVinci is the first platform
that will be using it, but only in non-DT mode. In order not to
introduce any new interface to supporting of which we would have to
commit - add a new config option that tells nvmem not to use the DT
node of the parent device.This way we won't be creating nvmem devices corresponding with MTD
partitions defined in device tree. By default MTD will set this new
field to true.Once a set of bindings for MTD nvmem cells is agreed upon, we'll be
able to remove this option.Signed-off-by: Bartosz Golaszewski
Signed-off-by: Srinivas Kandagatla
Signed-off-by: Greg Kroah-Hartman