diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 11:38:22 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 11:38:22 -0800 |
commit | e30aee9e10bb5168579e047f05c3d13d09e23356 (patch) | |
tree | 12371bdcd52d2427cad838201997479e31b6a9c9 /drivers/nvmem | |
parent | 8ff546b801e5cca0337c0f0a7234795d0a6309a1 (diff) | |
parent | 6cf18e6927c0b224f972e3042fb85770d63cb9f8 (diff) |
Merge tag 'char-misc-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH:
"Here is the big char/misc driver patchset for 4.11-rc1.
Lots of different driver subsystems updated here: rework for the
hyperv subsystem to handle new platforms better, mei and w1 and extcon
driver updates, as well as a number of other "minor" driver updates.
All of these have been in linux-next for a while with no reported
issues"
* tag 'char-misc-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (169 commits)
goldfish: Sanitize the broken interrupt handler
x86/platform/goldfish: Prevent unconditional loading
vmbus: replace modulus operation with subtraction
vmbus: constify parameters where possible
vmbus: expose hv_begin/end_read
vmbus: remove conditional locking of vmbus_write
vmbus: add direct isr callback mode
vmbus: change to per channel tasklet
vmbus: put related per-cpu variable together
vmbus: callback is in softirq not workqueue
binder: Add support for file-descriptor arrays
binder: Add support for scatter-gather
binder: Add extra size to allocator
binder: Refactor binder_transact()
binder: Support multiple /dev instances
binder: Deal with contexts in debugfs
binder: Support multiple context managers
binder: Split flat_binder_object
auxdisplay: ht16k33: remove private workqueue
auxdisplay: ht16k33: rework input device initialization
...
Diffstat (limited to 'drivers/nvmem')
-rw-r--r-- | drivers/nvmem/core.c | 45 | ||||
-rw-r--r-- | drivers/nvmem/imx-ocotp.c | 1 |
2 files changed, 28 insertions, 18 deletions
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 398ea7f54826..408b521ee520 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -608,7 +608,7 @@ static struct nvmem_device *nvmem_find(const char *name) /** * of_nvmem_device_get() - Get nvmem device from a given id * - * @dev node: Device tree node that uses the nvmem device + * @np: Device tree node that uses the nvmem device. * @id: nvmem name from nvmem-names property. * * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device @@ -634,8 +634,8 @@ EXPORT_SYMBOL_GPL(of_nvmem_device_get); /** * nvmem_device_get() - Get nvmem device from a given id * - * @dev : Device that uses the nvmem device - * @id: nvmem name from nvmem-names property. + * @dev: Device that uses the nvmem device. + * @dev_name: name of the requested nvmem device. * * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_device * on success. @@ -674,6 +674,7 @@ static void devm_nvmem_device_release(struct device *dev, void *res) /** * devm_nvmem_device_put() - put alredy got nvmem device * + * @dev: Device that uses the nvmem device. * @nvmem: pointer to nvmem device allocated by devm_nvmem_cell_get(), * that needs to be released. */ @@ -702,8 +703,8 @@ EXPORT_SYMBOL_GPL(nvmem_device_put); /** * devm_nvmem_device_get() - Get nvmem cell of device form a given id * - * @dev node: Device tree node that uses the nvmem cell - * @id: nvmem name in nvmems property. + * @dev: Device that requests the nvmem device. + * @id: name id for the requested nvmem device. * * Return: ERR_PTR() on error or a valid pointer to a struct nvmem_cell * on success. The nvmem_cell will be freed by the automatically once the @@ -745,8 +746,10 @@ static struct nvmem_cell *nvmem_cell_get_from_list(const char *cell_id) /** * of_nvmem_cell_get() - Get a nvmem cell from given device node and cell id * - * @dev node: Device tree node that uses the nvmem cell - * @id: nvmem cell name from nvmem-cell-names property. + * @np: Device tree node that uses the nvmem cell. + * @name: nvmem cell name from nvmem-cell-names property, or NULL + * for the cell at index 0 (the lone cell with no accompanying + * nvmem-cell-names property). * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the @@ -759,9 +762,12 @@ struct nvmem_cell *of_nvmem_cell_get(struct device_node *np, struct nvmem_cell *cell; struct nvmem_device *nvmem; const __be32 *addr; - int rval, len, index; + int rval, len; + int index = 0; - index = of_property_match_string(np, "nvmem-cell-names", name); + /* if cell name exists, find index to the name */ + if (name) + index = of_property_match_string(np, "nvmem-cell-names", name); cell_np = of_parse_phandle(np, "nvmem-cells", index); if (!cell_np) @@ -830,8 +836,8 @@ EXPORT_SYMBOL_GPL(of_nvmem_cell_get); /** * nvmem_cell_get() - Get nvmem cell of device form a given cell name * - * @dev node: Device tree node that uses the nvmem cell - * @id: nvmem cell name to get. + * @dev: Device that requests the nvmem cell. + * @cell_id: nvmem cell name to get. * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the @@ -859,8 +865,8 @@ static void devm_nvmem_cell_release(struct device *dev, void *res) /** * devm_nvmem_cell_get() - Get nvmem cell of device form a given id * - * @dev node: Device tree node that uses the nvmem cell - * @id: nvmem id in nvmem-names property. + * @dev: Device that requests the nvmem cell. + * @id: nvmem cell name id to get. * * Return: Will be an ERR_PTR() on error or a valid pointer * to a struct nvmem_cell. The nvmem_cell will be freed by the @@ -900,7 +906,8 @@ static int devm_nvmem_cell_match(struct device *dev, void *res, void *data) * devm_nvmem_cell_put() - Release previously allocated nvmem cell * from devm_nvmem_cell_get. * - * @cell: Previously allocated nvmem cell by devm_nvmem_cell_get() + * @dev: Device that requests the nvmem cell. + * @cell: Previously allocated nvmem cell by devm_nvmem_cell_get(). */ void devm_nvmem_cell_put(struct device *dev, struct nvmem_cell *cell) { @@ -916,7 +923,7 @@ EXPORT_SYMBOL(devm_nvmem_cell_put); /** * nvmem_cell_put() - Release previously allocated nvmem cell. * - * @cell: Previously allocated nvmem cell by nvmem_cell_get() + * @cell: Previously allocated nvmem cell by nvmem_cell_get(). */ void nvmem_cell_put(struct nvmem_cell *cell) { @@ -970,7 +977,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem, if (cell->bit_offset || cell->nbits) nvmem_shift_read_buffer_in_place(cell, buf); - *len = cell->bytes; + if (len) + *len = cell->bytes; return 0; } @@ -979,7 +987,8 @@ static int __nvmem_cell_read(struct nvmem_device *nvmem, * nvmem_cell_read() - Read a given nvmem cell * * @cell: nvmem cell to be read. - * @len: pointer to length of cell which will be populated on successful read. + * @len: pointer to length of cell which will be populated on successful read; + * can be NULL. * * Return: ERR_PTR() on error or a valid pointer to a buffer on success. The * buffer should be freed by the consumer with a kfree(). @@ -1126,7 +1135,7 @@ EXPORT_SYMBOL_GPL(nvmem_device_cell_read); * nvmem_device_cell_write() - Write cell to a given nvmem device * * @nvmem: nvmem device to be written to. - * @info: nvmem cell info to be written + * @info: nvmem cell info to be written. * @buf: buffer to be written to cell. * * Return: length of bytes written or negative error code on failure. diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c index 8e7b120696fa..b8ca1e677b01 100644 --- a/drivers/nvmem/imx-ocotp.c +++ b/drivers/nvmem/imx-ocotp.c @@ -73,6 +73,7 @@ static const struct of_device_id imx_ocotp_dt_ids[] = { { .compatible = "fsl,imx6q-ocotp", (void *)128 }, { .compatible = "fsl,imx6sl-ocotp", (void *)64 }, { .compatible = "fsl,imx6sx-ocotp", (void *)128 }, + { .compatible = "fsl,imx6ul-ocotp", (void *)128 }, { }, }; MODULE_DEVICE_TABLE(of, imx_ocotp_dt_ids); |