From ff6f46483f0e14b829cd5a71bafcbb1c136a84b6 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 10 Sep 2015 15:06:20 -0700 Subject: spmi: Auto-populate driver.owner in spmi_driver_register() Populate the owner field of the spmi driver when spmi_driver_register() is called in a similar fashion to how other *_driver_register() functions do it. This saves driver writers from having to do this themselves. Cc: Andy Gross Cc: Gilad Avidov Signed-off-by: Stephen Boyd Signed-off-by: Greg Kroah-Hartman --- drivers/spmi/spmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers/spmi') diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c index 11467e17bdd8..6b3da1bb0d63 100644 --- a/drivers/spmi/spmi.c +++ b/drivers/spmi/spmi.c @@ -560,12 +560,13 @@ EXPORT_SYMBOL_GPL(spmi_controller_remove); * This API will register the client driver with the SPMI framework. * It is typically called from the driver's module-init function. */ -int spmi_driver_register(struct spmi_driver *sdrv) +int __spmi_driver_register(struct spmi_driver *sdrv, struct module *owner) { sdrv->driver.bus = &spmi_bus_type; + sdrv->driver.owner = owner; return driver_register(&sdrv->driver); } -EXPORT_SYMBOL_GPL(spmi_driver_register); +EXPORT_SYMBOL_GPL(__spmi_driver_register); static void __exit spmi_exit(void) { -- cgit v1.2.3-55-g7522 From d5144796db928b1f7a074c4be3575c50951c9569 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Fri, 28 Aug 2015 12:21:42 -0700 Subject: spmi: pmic-arb: Don't byte swap when reading/writing FIFO We don't want to swap bytes that we're reading and writing to the FIFOs when we're running on a big-endian CPU. Doing so causes problems like where the qcom-spmi-iadc driver can't detect the type of device because the bytes are all mixed up. Use the raw IO accessors for these API instead, and collapse pmic_arb_base_read() into the byte reading API so that we aren't tempted to read non-FIFO data like commands with that function. Cc: Andy Gross Signed-off-by: Stephen Boyd Acked-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman --- drivers/spmi/spmi-pmic-arb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'drivers/spmi') diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index 4a3cf9ba152f..fce5c0d9e3bd 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -168,11 +168,6 @@ struct pmic_arb_ver_ops { u32 (*irq_clear)(u8 n); }; -static inline u32 pmic_arb_base_read(struct spmi_pmic_arb_dev *dev, u32 offset) -{ - return readl_relaxed(dev->rd_base + offset); -} - static inline void pmic_arb_base_write(struct spmi_pmic_arb_dev *dev, u32 offset, u32 val) { @@ -193,7 +188,7 @@ static inline void pmic_arb_set_rd_cmd(struct spmi_pmic_arb_dev *dev, */ static void pa_read_data(struct spmi_pmic_arb_dev *dev, u8 *buf, u32 reg, u8 bc) { - u32 data = pmic_arb_base_read(dev, reg); + u32 data = __raw_readl(dev->rd_base + reg); memcpy(buf, &data, (bc & 3) + 1); } @@ -208,7 +203,7 @@ pa_write_data(struct spmi_pmic_arb_dev *dev, const u8 *buf, u32 reg, u8 bc) { u32 data = 0; memcpy(&data, buf, (bc & 3) + 1); - pmic_arb_base_write(dev, reg, data); + __raw_writel(data, dev->wr_base + reg); } static int pmic_arb_wait_for_done(struct spmi_controller *ctrl, -- cgit v1.2.3-55-g7522 From 9b76968db6869666c9b30ea99894e9dd88a0ab13 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Fri, 28 Aug 2015 12:31:10 -0700 Subject: spmi: pmic-arb: u8 <= 0xff is always true Silences this static checker warning: drivers/spmi/spmi-pmic-arb.c:363 pmic_arb_write_cmd() warn: always true condition '(opc <= 255) => (0-255 <= 255)' Cc: Andy Gross Signed-off-by: Stephen Boyd Reviewed-by: Bjorn Andersson Signed-off-by: Greg Kroah-Hartman --- drivers/spmi/spmi-pmic-arb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/spmi') diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c index fce5c0d9e3bd..96615d807694 100644 --- a/drivers/spmi/spmi-pmic-arb.c +++ b/drivers/spmi/spmi-pmic-arb.c @@ -360,7 +360,7 @@ static int pmic_arb_write_cmd(struct spmi_controller *ctrl, u8 opc, u8 sid, opc = PMIC_ARB_OP_EXT_WRITE; else if (opc >= 0x30 && opc <= 0x37) opc = PMIC_ARB_OP_EXT_WRITEL; - else if (opc >= 0x80 && opc <= 0xFF) + else if (opc >= 0x80) opc = PMIC_ARB_OP_ZERO_WRITE; else return -EINVAL; -- cgit v1.2.3-55-g7522