staging: kpc2000: kpc_spi: Assorted minor fixups
cover staging: kpc2000: kpc_spi: Assorted minor fixups
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(-)
Signature · 1 line
2.21.0
PATCH 1/6 staging: kpc2000: kpc_spi: remove unnecessary struct member phys
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.
--- drivers/staging/kpc2000/kpc2000_spi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/kpc2000/kpc2000_spi.c +0 -2
@@ -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 ;
Signature · 1 line
2.21.0
PATCH 2/6 staging: kpc2000: kpc_spi: remove unnecessary struct member pin_dir
In reply to Geordan NeukumThe 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.
--- drivers/staging/kpc2000/kpc2000_spi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/kpc2000/kpc2000_spi.c +0 -2
@@ -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 ) {
Signature · 1 line
2.21.0
PATCH 3/6 staging: kpc2000: kpc_spi: remove unnecessary struct member word_len
In reply to Geordan NeukumThe 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.
--- drivers/staging/kpc2000/kpc2000_spi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/staging/kpc2000/kpc2000_spi.c +0 -3
@@ -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 */
Signature · 1 line
2.21.0
PATCH 4/6 staging: kpc2000: kpc_spi: remove unnecessary struct member chip_select
In reply to Geordan NeukumThe 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.
--- drivers/staging/kpc2000/kpc2000_spi.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/kpc2000/kpc2000_spi.c +0 -2
@@ -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; }
Signature · 1 line
2.21.0
PATCH 5/6 staging: kpc2000: kpc_spi: remove unnecessary ulong repr of i/o addr
In reply to Geordan NeukumThe 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.
--- drivers/staging/kpc2000/kpc2000_spi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/kpc2000/kpc2000_spi.c +2 -4
@@ -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 ) {
Signature · 1 line
2.21.0
PATCH 6/6 staging: kpc2000: kpc_spi: remove unnecessary cast in [read|write]_reg()
In reply to Geordan NeukumThe 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.
--- drivers/staging/kpc2000/kpc2000_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/kpc2000/kpc2000_spi.c +2 -2
@@ -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; }
Signature · 1 line
2.21.0