summaryrefslogtreecommitdiff
path: root/drivers/spi/spi.c
AgeCommit message (Collapse)Author
2015-11-27spi: bugfix: spi_message.transfer_length does not get resetMartin Sperl
When submitting an identical spi_message multiple times via spi_sync the spi_message.frame_length does not get reset to 0 in __spi_validate before adding up all spi_transfer.len resulting in frame_length > actual_length on all but the first spi_sync call. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-10spi: Add missing kerneldoc description for parameterThierry Reding
Commit ca5d24854210 ("spi: Add THIS_MODULE to spi_driver in SPI core") adds the new __spi_register_driver() function, but keeps the kerneldoc for the spi_register_driver() function in place and forgets to add the description for the new owner parameter. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-11-04Merge remote-tracking branches 'spi/topic/omap-100k', ↵Mark Brown
'spi/topic/omap-uwire', 'spi/topic/owner', 'spi/topic/pxa' and 'spi/topic/pxa2xx' into spi-next
2015-11-04Merge remote-tracking branch 'spi/topic/doc' into spi-nextMark Brown
2015-11-04Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown
2015-11-04Merge remote-tracking branch 'spi/fix/core' into spi-linusMark Brown
2015-10-28spi: Add THIS_MODULE to spi_driver in SPI coreAndrew F. Davis
Add spi_register_driver helper macro that adds THIS_MODULE to spi_driver for the registering driver. We rename and modify the existing spi_register_driver to enable this. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-28spi: Setup the master controller driver before setting the chipselectFranklin S Cooper Jr
SPI controllers may need to be properly setup before chip selects can be used. Therefore, wait until the spi controller has a chance to perform their setup procedure before trying to use the chip select. This also insures that the chip selects pins are in a good state before asseting them which otherwise may cause confusion. Signed-off-by: Franklin S Cooper Jr <fcooper@ti.com> Tested-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-24spi: fix kernel-doc warnings about missing return desc in spi.cJavier Martinez Canillas
When building docs with make htmldocs, warnings about not having a description for the return value are reported, i.e: warning: No description found for return value of 'spi_register_driver' Fix these by following the kernel-doc conventions explained in Documentation/kernel-doc-nano-HOWTO.txt. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-24Merge branches 'topic/core' and 'topic/stats' of ↵Mark Brown
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-doc
2015-10-21spi: core: use gpio_is_valid() helperAndy Shevchenko
Check if GPIO pin is valid by API helper function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-16spi: core: propagate return code of __spi_validate_bits_per_word()Andy Shevchenko
Propagate the actual return code of __spi_validate_bits_per_word() in spi_setup(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-10-12spi: Map SPI OF client IRQ at probe timeJon Hunter
Currently the IRQs for SPI client devices, registered via device-tree, are mapped when the client devices are registered. If the corresponding irq-chip has not been probed yet, then the probing of the client device will fail and will not be retried. Resolve this by mapping the IRQ at probe time and allow the probe to be deferred if the IRQ is not yet available. If of_irq_get() returns an error that is not -EPROBE_DEFER, then assume that the SPI client does not have an IRQ and set the IRQ number to zero (which is equivalent to irq_of_parse_and_map()). This is based on some inputs from Thierry Reding <treding@nvidia.com>. Cc: Thierry Reding <treding@nvidia.com> Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-19spi: add transfer histogram statistics via sysfsMartin Sperl
report transfer sizes as a histogram via the following files: /sys/class/spi_master/spi*/statistics/transfer_bytes_histo_* /sys/class/spi_master/spi*/spi*.*/statistics/transfer_bytes_histo_* Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-09-16Merge tag 'v4.3-rc1' into spi-fix-docMark Brown
Linux 4.3-rc1
2015-09-06spi: Fix documentation of spi_alloc_master()Guenter Roeck
Actually, spi_master_put() after spi_alloc_master() must _not_ be followed by kfree(). The memory is already freed with the call to spi_master_put() through spi_master_class, which registers a release function. Calling both spi_master_put() and kfree() results in often nasty (and delayed) crashes elsewhere in the kernel, often in the networking stack. This reverts commit eb4af0f5349235df2e4a5057a72fc8962d00308a. Link to patch and concerns: https://lkml.org/lkml/2012/9/3/269 or http://lkml.iu.edu/hypermail/linux/kernel/1209.0/00790.html Alexey Klimov: This revert becomes valid after 94c69f765f1b4a658d96905ec59928e3e3e07e6a when spi-imx.c has been fixed and there is no need to call kfree() so comment for spi_alloc_master() should be fixed. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-08-31Merge remote-tracking branches 'spi/topic/s3c64xx', 'spi/topic/sg', ↵Mark Brown
'spi/topic/sh-msiof', 'spi/topic/spidev' and 'spi/topic/stats' into spi-next
2015-08-31Merge remote-tracking branch 'spi/topic/dma' into spi-nextMark Brown
2015-08-26spi: check bits_per_word in spi_setupStefan Brüns
This allows drivers for devices connected via SPI to check if the controller supports a given bits_per_word value during setup. Currently any BPW value is accepted durings setup, and transfers are rejected later. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-21spi: Fall back to master maximum speed if no slave speed specifiedMark Brown
If a slave appears with no maximum transfer speed specified fall back to using the maximum for the master instead. It's questionable if we should let slaves do this but let's be defensive. Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-24spi: support spi without dma channel to use can_dma()Leilk Liu
For spi without dma channel and use can_dma(), it can use master->dev for struct device. Signed-off-by: Leilk Liu <leilk.liu@mediatek.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07spi: expose spi_master and spi_device statistics via sysfsMartin Sperl
per spi-master statistics accessible as: /sys/class/spi_master/spi*/statistics/* per spi-device statistics accessible via: /sys/class/spi_master/spi*/spi*.*/statistics/* The following statistics are exposed as separate "files" inside these directories: * messages number of spi_messages * transfers number of spi_transfers * bytes number of bytes transferred * bytes_rx number of bytes transmitted * bytes_tx number of bytes received * errors number of errors encounterd * timedout number of messages that have timed out * spi_async number of spi_messages submitted using spi_async * spi_sync number of spi_messages submitted using spi_sync * spi_sync_immediate number of spi_messages submitted using spi_sync, that are handled immediately without a context switch to the spi_pump worker-thread Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07spi: Fix per-page mapping of unaligned vmalloc-ed bufferAndrew Gabbasov
spi_map_buf() processes mapping of vmalloc-ed buffers in a special way, making mapping of every page separately. However, if the buffer is not aligned to page boundary (e.g. sub-array in a vmalloc-ed array), it fills the scatter table with page-size unaligned pieces, that cross page boundaries. This is incorrect and can, for example, cause memory corruption and various crashes when working with ubifs on spi-nor chips (though those drivers are themselves buggy in that they should be providing DMAable memory to the SPI framework). Fix this by using proper scatter table size and intra-page buffer lengths, so that the whole buffer splits into separate scatter table entries on page boundaries. Signed-off-by: Andrew Gabbasov <andrew_gabbasov@mentor.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-02spi: restore rx/tx_buf in case of unset CONFIG_HAS_DMAMartin Sperl
The case where spi_master sets the flags SPI_MASTER_MUST_RX/TX while CONFIG_HAS_DMA is unset (which is unlikley) together with a driver that reuses spi_messages with rx/tx_buff set to NULL, can result in: * data disclosure over the SPI (for tx_buf == NULL) * memory corruption (for rx_buf == NULL) This happenes when dummy_rx/dummy_tx are changing address due to krealloc or free and an allocation of the memory by a different part of the kernel. Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-11spi: fix race freeing dummy_tx/rx before it is unmappedMartin Sperl
Fix a race (with some kernel configurations) where a queued master->pump_messages runs and frees dummy_tx/rx before spi_unmap_msg is running (or is finished). This results in the following messages: BUG: Bad page state in process page:db7ba030 count:0 mapcount:0 mapping: (null) index:0x0 flags: 0x200(arch_1) page dumped because: PAGE_FLAGS_CHECK_AT_PREP flag set ... Reported-by: Noralf Trønnes <noralf@tronnes.org> Suggested-by: Noralf Trønnes <noralf@tronnes.org> Tested-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-04-16spi: check tx_buf and rx_buf in spi_unmap_msgRobin Gong
Some spi device drivers use the same tx_buf and rx_buf repeatly for better performance such as driver/input/touchsreen/ads7846.c, but spi core grab tx_buf /rx_buf of transfer and set them as dummy_tx/dummy_rx once they are NULL. Thus, in the second time the tx_buf/rx_buf will be replaced by dummy_tx/dummy_rx and the data which produced by the last tx or rx may be wrongly sent to the device or handled by the upper level protocol. This patch just keep the orignal value of tx_buf/rx_buf if they are NULL after this transfer processed. Signed-off-by: Robin Gong <b38343@freescale.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-11Merge remote-tracking branches 'spi/topic/omap-100k', ↵Mark Brown
'spi/topic/omap-uwire', 'spi/topic/pl022', 'spi/topic/pm' and 'spi/topic/pxa2xx' into spi-next
2015-04-11Merge remote-tracking branches 'spi/topic/blackfin', 'spi/topic/cadence', ↵Mark Brown
'spi/topic/dw' and 'spi/topic/err' into spi-next
2015-04-11Merge remote-tracking branches 'spi/topic/atmel', 'spi/topic/bcm2385', ↵Mark Brown
'spi/topic/bcm2835', 'spi/topic/bcm53xx' and 'spi/topic/bitbang' into spi-next
2015-04-11Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown
2015-04-07spi: Make master->handle_err() callback optional to avoid crashesGeert Uytterhoeven
If a driver doesn't implement the master->handle_err() callback and an SPI transfer fails, the kernel will crash with a NULL pointer dereference: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = c0003000 [00000000] *pgd=80000040004003, *pmd=00000000 Internal error: Oops: 80000206 [#1] SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.0.0-rc7-koelsch-05861-g1fc9fdd4add4f783 #1046 Hardware name: Generic R8A7791 (Flattened Device Tree) task: eec359c0 ti: eec54000 task.ti: eec54000 PC is at 0x0 LR is at spi_transfer_one_message+0x1cc/0x1f0 Make the master->handle_err() callback optional to avoid the crash. Also fix a spelling mistake in the callback documentation while we're at it. Fixes: b716c4ffc6a2b0bf ("spi: introduce master->handle_err() callback") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-25spi: of: do explicitly request modules for of-registered devicesDmitry Torokhov
Trying to register an SPI device asynchronously (via async_schedule() call) results in an ugly complaint from request_module() warning about potential deadlock (because request_module tries to wait for async works to complete, the caller is also an async work in this case). While we could try to switch to using request_module_nowait(), other buses, as well as SPI itself when not using device tree, do not try to load modules explicitly, but rather rely on the standard infrastructure (such as udev) to execute module loading. There is no reason why SPI OF-described devices should be treated differently. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-18spi: trigger trace event for message-done before mesg->completeUwe Kleine-König
With spidev the mesg->complete callback points to spidev_complete. Calling this unblocks spidev_sync and so spidev_sync_write finishes. As the struct spi_message just read is a local variable in spidev_sync_write and recording the trace event accesses this message the recording is better done first. The same can happen for spidev_sync_read. This fixes an oops observed on a 3.14-rt system with spidev activity after echo 1 > /sys/kernel/debug/tracing/events/spi/enable . Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2015-03-16spi: Ensure that CS line is in non-active state after spi_setup()Ivan T. Ivanov
Some devices samples state of the chip select signal during power up and act differently based on this state, so SPI core should ensure that CS line is driven in non-active state after spi_setup(). Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-08spi: Remove support for legacy PMLars-Peter Clausen
All SPI drivers have been converted from legacy suspend/resume callbacks to dev_pm_ops. So we can finally remove support for legacy PM from the SPI core. Since there aren't any special bus specific things to do during suspend/resume and since the PM core will automatically fallback directly to using the device's PM ops if no bus PM ops are specified there is no need to have any special SPI bus PM ops. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-03-06spi: introduce master->handle_err() callbackAndy Shevchenko
This callback would be useful to handle an error that occurs in the generic implementation of transfer_one_message(). The good candidate for this is to drain FIFO and / or to terminate DMA transfers when timeout happened. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-02-08Merge remote-tracking branches 'spi/topic/img-spfi', 'spi/topic/imx', ↵Mark Brown
'spi/topic/inline', 'spi/topic/meson' and 'spi/topic/mxs' into spi-next
2015-02-08Merge remote-tracking branches 'spi/topic/falcon', 'spi/topic/fsf', ↵Mark Brown
'spi/topic/fsl', 'spi/topic/fsl-dspi' and 'spi/topic/gpio' into spi-next
2015-02-04spi: match var type to return type of wait_for_completionNicholas Mc Guire
return type of wait_for_completion_timeout is unsigned long not int, this patch changes the type of m from int to unsigned long. Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-22spi: Remove FSF mailing addressesJarkko Nikula
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-11Merge tag 'devicetree-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux Pull devicetree changes from Grant Likely: "Lots of activity in the devicetree code for v3.18. Most of it is related to getting all of the overlay support code in place, but there are other important things in there. Highlights: - OF_RECONFIG notifiers for SPI, I2C and Platform devices. Those subsystems can now respond to live changes to the device tree. - CONFIG_OF_OVERLAY method for applying live changes to the device tree - Removal of the of_allnodes list. This used to be used to iterate over all the nodes in the device tree, but it is unnecessary because the same thing can be done by iterating over the list of child pointers. Getting rid of of_allnodes saves some memory and avoids the possibility of of_allnodes being sorted differently from the child lists. - Support for retrieving original DTB blob via sysfs. Needed by kexec. - More unittests - Documentation and minor bug fixes" * tag 'devicetree-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/glikely/linux: (42 commits) of: Delete unnecessary check before calling "of_node_put()" of: Drop ->next pointer from struct device_node spi: Check for spi_of_notifier when CONFIG_OF_DYNAMIC=y of: support passing console options with stdout-path of: add optional options parameter to of_find_node_by_path() of: Add bindings for chosen node, stdout-path of: Remove unneeded and incorrect MODULE_DEVICE_TABLE ARM: dt: fix up PL011 device tree bindings of: base, fix of_property_read_string_helper kernel-doc of: remove select of non-existant OF_DEVICE config symbol spi/of: Add OF notifier handler spi/of: Create new device registration method and accessors i2c/of: Add OF_RECONFIG notifier handler i2c/of: Factor out Devicetree registration code of/overlay: Add overlay unittests of/overlay: Introduce DT overlay support of/reconfig: Add OF_DYNAMIC notifier for platform_bus_type of/reconfig: Always use the same structure for notifiers of/reconfig: Add debug output for OF_RECONFIG notifiers of/reconfig: Add empty stubs for the of_reconfig methods ...
2014-12-11spi: Only idle the message pump in the worker kthreadMark Brown
In order to avoid the situation where the kthread is waiting for another context to make the hardware idle let the message pump know if it's being called from the worker thread context and if it isn't then defer to the worker thread instead of idling the hardware immediately. This will ensure that if this situation happens we block rather than busy waiting. Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-11spi: Pump transfers inside calling context for spi_sync()Mark Brown
If we are using the standard SPI message pump (which all drivers should be transitioning over to) then special case the message enqueue and instead of starting the worker thread to push messages to the hardware do so in the context of the caller if the controller is idle. This avoids a context switch in the common case where the controller has a single user in a single thread, for short PIO transfers there may be no need to context switch away from the calling context to complete the transfer. The code is a bit more complex than is desirable in part due to the need to handle drivers not using the standard queue and in part due to handling the various combinations of bus locking and asynchronous submission in interrupt context. It is still suboptimal since it will still wake the message pump for each transfer in order to schedule idling of the hardware and if multiple contexts are using the controller simultaneously a caller may end up pumping a message for some random other thread rather than for itself, and if the thread ends up deferring due to another context idling the hardware then it will just busy wait. It can, however, have the benefit of aggregating power up and down of the hardware when a caller performs a series of transfers back to back without any need for the use of spi_async(). Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-11spi: Check to see if the device is processing a message before we idleMark Brown
cur_msg is updated under the queue lock and holds the message we are currently processing. Since currently we only ever do removals in the pump kthread it doesn't matter in what order we do things but we want to be able to push things out from the submitting thread so pull the check to see if we're currently handling a message before we check to see if the queue is idle. Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-11spi: Move queue data structure initialisation to main master initMark Brown
Since most devices now do use the standard queue and in order to avoid initialisation ordering issues being introduced by further refactorings to improve performance move the initialisation of the queue and the lock for it to the main master allocation. Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-08Merge remote-tracking branch 'spi/topic/core' into spi-nextMark Brown
2014-12-04spi: core: Do not mangle error code from kthread_run()Jarkko Nikula
kthread_run() could return ERR_PTR(-EINTR) from kthread_create_on_node(). Return the actual error code in spi_init_queue() instead of mangling it to -ENOMEM. Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-03spi: Check for spi_of_notifier when CONFIG_OF_DYNAMIC=yFabio Estevam
Since commit ce79d54ae447d651173 ("spi/of: Add OF notifier handler") the following warning is seen on a imx53 system that has CONFIG_OF_DYNAMIC=n: [ 0.048119] ------------[ cut here ]------------ [ 0.048146] WARNING: CPU: 0 PID: 1 at drivers/spi/spi.c:2419 spi_init+0x60/0xa8() [ 0.048158] Modules linked in: [ 0.048183] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.18.0-rc6-next-20141126-00003-g9388e85 #2080 [ 0.048193] Hardware name: Freescale i.MX53 (Device Tree Support) [ 0.048203] Backtrace: [ 0.048235] [<80011f74>] (dump_backtrace) from [<80012110>] (show_stack+0x18/0x1c) [ 0.048246] r6:00000973 r5:00000000 r4:00000000 r3:00000000 [ 0.048284] [<800120f8>] (show_stack) from [<806b3ad8>] (dump_stack+0x88/0xa4) [ 0.048312] [<806b3a50>] (dump_stack) from [<8002a55c>] (warn_slowpath_common+0x80/0xbc) [ 0.048320] r5:8096cfcc r4:00000000 [ 0.048343] [<8002a4dc>] (warn_slowpath_common) from [<8002a5bc>] (warn_slowpath_null+0x24/0x2c) [ 0.048354] r8:8096cf6c r7:809355ec r6:ddcd7c00 r5:812029e4 r4:00000000 [ 0.048389] [<8002a598>] (warn_slowpath_null) from [<8096cfcc>] (spi_init+0x60/0xa8) [ 0.048405] [<8096cf6c>] (spi_init) from [<80008a7c>] (do_one_initcall+0x88/0x1e0) [ 0.048415] r5:8099e018 r4:8099e018 [ 0.048438] [<800089f4>] (do_one_initcall) from [<80935e38>] (kernel_init_freeable+0x110/0x1e0) [ 0.048448] r10:80980700 r9:809806e4 r8:000000cc r7:809355ec r6:809f8940 r5:00000002 [ 0.048478] r4:8098d744 [ 0.048508] [<80935d28>] (kernel_init_freeable) from [<806ae574>] (kernel_init+0x10/0xf4) [ 0.048517] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:806ae564 [ 0.048547] r4:00000000 [ 0.048565] [<806ae564>] (kernel_init) from [<8000ed68>] (ret_from_fork+0x14/0x2c) [ 0.048574] r4:00000000 r3:00000000 [ 0.048616] ---[ end trace 405a65d177dae4fd ]--- Only check of_reconfig_notifier_register() in the CONFIG_OF_DYNAMIC=y case, as intended by commit ce79d54ae447d65. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>
2014-11-25spi/of: Add OF notifier handlerPantelis Antoniou
Add OF notifier handler needed for creating/destroying spi devices according to dynamic runtime changes in the DT live tree. This code is enabled when CONFIG_OF_DYNAMIC is selected. Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> Signed-off-by: Grant Likely <grant.likely@linaro.org> Reviewed-by: Mark Brown <broonie@kernel.org> Cc: <linux-spi@vger.kernel.org>
2014-11-25spi/of: Create new device registration method and accessorsPantelis Antoniou
Dynamically inserting spi device nodes requires the use of a single device registration method. Refactor the existing of_register_spi_devices() to split out the core functionality for a single device into a separate function; of_register_spi_device(). This function will be used by the OF_DYNAMIC overlay code to make live modifications to the tree. Methods to lookup a device/master using a device node are added as well, of_find_spi_master_by_node() & of_find_spi_device_by_node(). Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com> [grant.likely] Split patch into two pieces for clarity Signed-off-by: Grant Likely <grant.likely@linaro.org> Reviewed-by: Mark Brown <broonie@kernel.org> Cc: <linux-spi@vger.kernel.org>