summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/spilib.h
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2016-07-21 14:45:06 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-07-21 19:03:05 -0700
commit92bcaddea3197e477bb37439805fcb5a2f9942d7 (patch)
treec38580b183820a61bd7f7579591116175d833157 /drivers/staging/greybus/spilib.h
parentadac4b95941189ca301759a67da4a132fc2804d5 (diff)
downloadlinux-92bcaddea3197e477bb37439805fcb5a2f9942d7.tar.bz2
greybus: spilib: make spilib independent of gbphy
spilib is used by multiple users currently (spi.c and fw-core.c) but commit aa52b62a0556 broke that hierarchy and introduced gbphy dependent code in spilib. This may have unreliable consequences as we are doing following operation unconditionally now: gbphy_dev = to_gbphy_dev(spi->parent); gbphy_runtime_get_sync(gbphy_dev); which may not go well when the parent is of type &bundle->dev (fw-core.c). This patch introduces spilib_ops and lets the users of the core register them. This shall have no functional change for the spi.c usecase and shall fix the unreliable results for the fw-core.c usecase. Tested by writing to mtd0 dev and verifying (with print messages) that the below routines are getting called for a gpbridge-test module. Fixes: aa52b62a0556 ("spi: Add runtime_pm support") Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/spilib.h')
-rw-r--r--drivers/staging/greybus/spilib.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/staging/greybus/spilib.h b/drivers/staging/greybus/spilib.h
index 9be1b3189834..566d0dde7f79 100644
--- a/drivers/staging/greybus/spilib.h
+++ b/drivers/staging/greybus/spilib.h
@@ -10,9 +10,15 @@
#ifndef __SPILIB_H
#define __SPILIB_H
+struct device;
struct gb_connection;
-int gb_spilib_master_init(struct gb_connection *connection, struct device *dev);
+struct spilib_ops {
+ int (*prepare_transfer_hardware)(struct device *dev);
+ void (*unprepare_transfer_hardware)(struct device *dev);
+};
+
+int gb_spilib_master_init(struct gb_connection *connection, struct device *dev, struct spilib_ops *ops);
void gb_spilib_master_exit(struct gb_connection *connection);
#endif /* __SPILIB_H */