All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups
@ 2019-06-05  1:09 Geordan Neukum
  2019-06-05  1:09 ` [PATCH 1/6] staging: kpc2000: kpc_spi: remove unnecessary struct member phys Geordan Neukum
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

Primarily just a bunch of unused / unnecessarily used struct member
cleanup patches with the exception of one patch which removes an
unnecessary cast to a (void *) in a couple of functions.

Geordan Neukum (6):
  staging: kpc2000: kpc_spi: remove unnecessary struct member phys
  staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir
  staging: kpc2000: kpc_spi: remove unnecessary struct member word_len
  staging: kpc2000: kpc_spi: remove unnecessary struct member
    chip_select
  staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr
  staging: kpc2000: kpc_spi: remove unnecessary cast in
    [read|write]_reg()

 drivers/staging/kpc2000/kpc2000_spi.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/6] staging: kpc2000: kpc_spi: remove unnecessary struct member phys
  2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
@ 2019-06-05  1:09 ` Geordan Neukum
  2019-06-05  1:09 ` [PATCH 2/6] staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir Geordan Neukum
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

The structure kp_spi_controller_state, defined in the kpc2000_spi
driver, contains a member named phys which is never used after
initialization. Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 32d3ec532e26..20c396bcd904 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -110,7 +110,6 @@ struct kp_spi {
 
 struct kp_spi_controller_state {
 	void __iomem   *base;
-	unsigned long   phys;
 	unsigned char   chip_select;
 	int             word_len;
 	s64             conf_cache;
@@ -270,7 +269,6 @@ kp_spi_setup(struct spi_device *spidev)
 			return -ENOMEM;
 		}
 		cs->base = kpspi->base;
-		cs->phys = kpspi->phys;
 		cs->chip_select = spidev->chip_select;
 		cs->word_len = spidev->bits_per_word;
 		cs->conf_cache = -1;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/6] staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir
  2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
  2019-06-05  1:09 ` [PATCH 1/6] staging: kpc2000: kpc_spi: remove unnecessary struct member phys Geordan Neukum
@ 2019-06-05  1:09 ` Geordan Neukum
  2019-06-05  1:09 ` [PATCH 3/6] staging: kpc2000: kpc_spi: remove unnecessary struct member word_len Geordan Neukum
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

The structure kpc_spi, defined in in the kpc2000_spi driver, contains
a member named pin_dir which is never used after initialization.
Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 20c396bcd904..1d89cb3b861f 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -105,7 +105,6 @@ struct kp_spi {
 	u64 __iomem        *base;
 	unsigned long       phys;
 	struct device      *dev;
-	unsigned int        pin_dir:1;
 };
 
 struct kp_spi_controller_state {
@@ -460,7 +459,6 @@ kp_spi_probe(struct platform_device *pldev)
 	if (pldev->id != -1) {
 		master->bus_num = pldev->id;
 	}
-	kpspi->pin_dir = 0;
 
 	r = platform_get_resource(pldev, IORESOURCE_MEM, 0);
 	if (r == NULL) {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/6] staging: kpc2000: kpc_spi: remove unnecessary struct member word_len
  2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
  2019-06-05  1:09 ` [PATCH 1/6] staging: kpc2000: kpc_spi: remove unnecessary struct member phys Geordan Neukum
  2019-06-05  1:09 ` [PATCH 2/6] staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir Geordan Neukum
@ 2019-06-05  1:09 ` Geordan Neukum
  2019-06-05  1:09 ` [PATCH 4/6] staging: kpc2000: kpc_spi: remove unnecessary struct member chip_select Geordan Neukum
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

The structure kp_spi_controller_state, defined in the kpc2000_spi
driver, contains a member named word_len which is never used after
initialization. Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 1d89cb3b861f..61296335313b 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -110,7 +110,6 @@ struct kp_spi {
 struct kp_spi_controller_state {
 	void __iomem   *base;
 	unsigned char   chip_select;
-	int             word_len;
 	s64             conf_cache;
 };
 
@@ -269,7 +268,6 @@ kp_spi_setup(struct spi_device *spidev)
 		}
 		cs->base = kpspi->base;
 		cs->chip_select = spidev->chip_select;
-		cs->word_len = spidev->bits_per_word;
 		cs->conf_cache = -1;
 		spidev->controller_state = cs;
 	}
@@ -369,7 +367,6 @@ kp_spi_transfer_one_message(struct spi_master *master, struct spi_message *m)
 			if (transfer->bits_per_word) {
 				word_len = transfer->bits_per_word;
 			}
-			cs->word_len = word_len;
 			sc.bitfield.wl = word_len-1;
 
 			/* ...chip select */
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/6] staging: kpc2000: kpc_spi: remove unnecessary struct member chip_select
  2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
                   ` (2 preceding siblings ...)
  2019-06-05  1:09 ` [PATCH 3/6] staging: kpc2000: kpc_spi: remove unnecessary struct member word_len Geordan Neukum
@ 2019-06-05  1:09 ` Geordan Neukum
  2019-06-05  1:09 ` [PATCH 5/6] staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr Geordan Neukum
  2019-06-05  1:09 ` [PATCH 6/6] staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg() Geordan Neukum
  5 siblings, 0 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

The structure kp_spi_controller_state, defined in the kpc2000_spi
driver, contains a member named chip_select which is never used after
initialization. Therefore, it should be removed for simplicity's sake.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 61296335313b..07b0327d8bef 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -109,7 +109,6 @@ struct kp_spi {
 
 struct kp_spi_controller_state {
 	void __iomem   *base;
-	unsigned char   chip_select;
 	s64             conf_cache;
 };
 
@@ -267,7 +266,6 @@ kp_spi_setup(struct spi_device *spidev)
 			return -ENOMEM;
 		}
 		cs->base = kpspi->base;
-		cs->chip_select = spidev->chip_select;
 		cs->conf_cache = -1;
 		spidev->controller_state = cs;
 	}
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/6] staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr
  2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
                   ` (3 preceding siblings ...)
  2019-06-05  1:09 ` [PATCH 4/6] staging: kpc2000: kpc_spi: remove unnecessary struct member chip_select Geordan Neukum
@ 2019-06-05  1:09 ` Geordan Neukum
  2019-06-05  1:09 ` [PATCH 6/6] staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg() Geordan Neukum
  5 siblings, 0 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

The kpc_spi driver stashes off an unsigned long representation of the
i/o mapping returned by devm_ioremap_nocache(). This is unnecessary, as
the only use of the unsigned long repr is to eventually be re-cast to
an (u64 __iomem *). Instead of casting the (void __iomem *) to an
(unsigned long) then a (u64 __iomem *), just remove this intermediate
step. As this intermediary is no longer used, also remove it from its
structure.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 07b0327d8bef..4f517afc6239 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -103,7 +103,6 @@ static struct spi_board_info p2kr0_board_info[] = {
 struct kp_spi {
 	struct spi_master  *master;
 	u64 __iomem        *base;
-	unsigned long       phys;
 	struct device      *dev;
 };
 
@@ -462,9 +461,8 @@ kp_spi_probe(struct platform_device *pldev)
 		goto free_master;
 	}
 
-	kpspi->phys = (unsigned long)devm_ioremap_nocache(&pldev->dev, r->start,
-							  resource_size(r));
-	kpspi->base = (u64 __iomem *)kpspi->phys;
+	kpspi->base = devm_ioremap_nocache(&pldev->dev, r->start,
+					   resource_size(r));
 
 	status = spi_register_master(master);
 	if (status < 0) {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/6] staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg()
  2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
                   ` (4 preceding siblings ...)
  2019-06-05  1:09 ` [PATCH 5/6] staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr Geordan Neukum
@ 2019-06-05  1:09 ` Geordan Neukum
  5 siblings, 0 replies; 7+ messages in thread
From: Geordan Neukum @ 2019-06-05  1:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Geordan Neukum, Mao Wenan, Jeremy Sowden, devel, linux-kernel

The kpc_spi driver unnecessarily casts from a (u64 __iomem *) to a (void
*) when invoking readq and writeq which both take a (void __iomem *) arg.
There is no need for this cast, and it actually harms us by discarding
the sparse cookie, __iomem. Make the driver stop performing this casting
operation.

Signed-off-by: Geordan Neukum <gneukum1@gmail.com>
---
 drivers/staging/kpc2000/kpc2000_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000_spi.c b/drivers/staging/kpc2000/kpc2000_spi.c
index 4f517afc6239..28132e9e260d 100644
--- a/drivers/staging/kpc2000/kpc2000_spi.c
+++ b/drivers/staging/kpc2000/kpc2000_spi.c
@@ -167,7 +167,7 @@ kp_spi_read_reg(struct kp_spi_controller_state *cs, int idx)
 	if ((idx == KP_SPI_REG_CONFIG) && (cs->conf_cache >= 0)){
 		return cs->conf_cache;
 	}
-	val = readq((void*)addr);
+	val = readq(addr);
 	return val;
 }
 
@@ -176,7 +176,7 @@ kp_spi_write_reg(struct kp_spi_controller_state *cs, int idx, u64 val)
 {
 	u64 __iomem *addr = cs->base;
 	addr += idx;
-	writeq(val, (void*)addr);
+	writeq(val, addr);
 	if (idx == KP_SPI_REG_CONFIG)
 		cs->conf_cache = val;
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-06-05  1:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-05  1:09 [PATCH 0/6] staging: kpc2000: kpc_spi: Assorted minor fixups Geordan Neukum
2019-06-05  1:09 ` [PATCH 1/6] staging: kpc2000: kpc_spi: remove unnecessary struct member phys Geordan Neukum
2019-06-05  1:09 ` [PATCH 2/6] staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir Geordan Neukum
2019-06-05  1:09 ` [PATCH 3/6] staging: kpc2000: kpc_spi: remove unnecessary struct member word_len Geordan Neukum
2019-06-05  1:09 ` [PATCH 4/6] staging: kpc2000: kpc_spi: remove unnecessary struct member chip_select Geordan Neukum
2019-06-05  1:09 ` [PATCH 5/6] staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr Geordan Neukum
2019-06-05  1:09 ` [PATCH 6/6] staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg() Geordan Neukum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.