* [PATCH v1 0/3] spi: bitbang: Clean up the driver
@ 2024-05-17 19:40 Andy Shevchenko
2024-05-17 19:40 ` [PATCH v1 1/3] spi: bitbang: Use typedef for txrx_*() callbacks Andy Shevchenko
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Andy Shevchenko @ 2024-05-17 19:40 UTC (permalink / raw)
To: Andy Shevchenko, Mark Brown, linux-spi, linux-kernel
A few cleanups to the driver. No functional change intended.
Andy Shevchenko (3):
spi: bitbang: Use typedef for txrx_*() callbacks
spi: bitbang: Convert unsigned to unsigned int
spi: bitbang: Replace hard coded number of SPI modes
drivers/spi/spi-bitbang.c | 73 ++++++++++++---------------------
include/linux/spi/spi_bitbang.h | 7 ++--
2 files changed, 31 insertions(+), 49 deletions(-)
--
2.43.0.rc1.1336.g36b5255a03ac
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH v1 1/3] spi: bitbang: Use typedef for txrx_*() callbacks 2024-05-17 19:40 [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko @ 2024-05-17 19:40 ` Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 2/3] spi: bitbang: Convert unsigned to unsigned int Andy Shevchenko ` (2 subsequent siblings) 3 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2024-05-17 19:40 UTC (permalink / raw) To: Andy Shevchenko, Mark Brown, linux-spi, linux-kernel With a typedef for the txrx_*() callbacks the code looks neater. Note that typedef for a function is okay to have. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/spi/spi-bitbang.c | 31 +++++++++---------------------- include/linux/spi/spi_bitbang.h | 7 ++++--- 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index ca5cc67555c5..d88110acdc5f 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -38,26 +38,19 @@ * working quickly, or testing for differences that aren't speed related. */ +typedef unsigned int (*spi_bb_txrx_bufs_fn)(struct spi_device *, spi_bb_txrx_word_fn, + unsigned int, struct spi_transfer *, + unsigned int); + struct spi_bitbang_cs { unsigned nsecs; /* (clock cycle time)/2 */ - u32 (*txrx_word)(struct spi_device *spi, unsigned nsecs, - u32 word, u8 bits, unsigned flags); - unsigned (*txrx_bufs)(struct spi_device *, - u32 (*txrx_word)( - struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), - unsigned, struct spi_transfer *, - unsigned); + spi_bb_txrx_word_fn txrx_word; + spi_bb_txrx_bufs_fn txrx_bufs; }; static unsigned bitbang_txrx_8( struct spi_device *spi, - u32 (*txrx_word)(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), + spi_bb_txrx_word_fn txrx_word, unsigned ns, struct spi_transfer *t, unsigned flags @@ -83,10 +76,7 @@ static unsigned bitbang_txrx_8( static unsigned bitbang_txrx_16( struct spi_device *spi, - u32 (*txrx_word)(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), + spi_bb_txrx_word_fn txrx_word, unsigned ns, struct spi_transfer *t, unsigned flags @@ -112,10 +102,7 @@ static unsigned bitbang_txrx_16( static unsigned bitbang_txrx_32( struct spi_device *spi, - u32 (*txrx_word)(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, - unsigned flags), + spi_bb_txrx_word_fn txrx_word, unsigned ns, struct spi_transfer *t, unsigned flags diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index b930eca2ef7b..7ca08b430ed5 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h @@ -4,6 +4,8 @@ #include <linux/workqueue.h> +typedef u32 (*spi_bb_txrx_word_fn)(struct spi_device *, unsigned int, u32, u8, unsigned int); + struct spi_bitbang { struct mutex lock; u8 busy; @@ -28,9 +30,8 @@ struct spi_bitbang { int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t); /* txrx_word[SPI_MODE_*]() just looks like a shift register */ - u32 (*txrx_word[4])(struct spi_device *spi, - unsigned nsecs, - u32 word, u8 bits, unsigned flags); + spi_bb_txrx_word_fn txrx_word[4]; + int (*set_line_direction)(struct spi_device *spi, bool output); }; -- 2.43.0.rc1.1336.g36b5255a03ac ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v1 2/3] spi: bitbang: Convert unsigned to unsigned int 2024-05-17 19:40 [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 1/3] spi: bitbang: Use typedef for txrx_*() callbacks Andy Shevchenko @ 2024-05-17 19:40 ` Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 3/3] spi: bitbang: Replace hard coded number of SPI modes Andy Shevchenko 2024-06-05 21:07 ` [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko 3 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2024-05-17 19:40 UTC (permalink / raw) To: Andy Shevchenko, Mark Brown, linux-spi, linux-kernel Simple type conversion with no functional change implied. While at it, adjust indentation where it makes sense. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/spi/spi-bitbang.c | 42 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c index d88110acdc5f..afb1b1105ec2 100644 --- a/drivers/spi/spi-bitbang.c +++ b/drivers/spi/spi-bitbang.c @@ -43,21 +43,19 @@ typedef unsigned int (*spi_bb_txrx_bufs_fn)(struct spi_device *, spi_bb_txrx_wor unsigned int); struct spi_bitbang_cs { - unsigned nsecs; /* (clock cycle time)/2 */ + unsigned int nsecs; /* (clock cycle time) / 2 */ spi_bb_txrx_word_fn txrx_word; spi_bb_txrx_bufs_fn txrx_bufs; }; -static unsigned bitbang_txrx_8( - struct spi_device *spi, +static unsigned int bitbang_txrx_8(struct spi_device *spi, spi_bb_txrx_word_fn txrx_word, - unsigned ns, + unsigned int ns, struct spi_transfer *t, - unsigned flags -) + unsigned int flags) { - unsigned bits = t->bits_per_word; - unsigned count = t->len; + unsigned int bits = t->bits_per_word; + unsigned int count = t->len; const u8 *tx = t->tx_buf; u8 *rx = t->rx_buf; @@ -74,16 +72,14 @@ static unsigned bitbang_txrx_8( return t->len - count; } -static unsigned bitbang_txrx_16( - struct spi_device *spi, +static unsigned int bitbang_txrx_16(struct spi_device *spi, spi_bb_txrx_word_fn txrx_word, - unsigned ns, + unsigned int ns, struct spi_transfer *t, - unsigned flags -) + unsigned int flags) { - unsigned bits = t->bits_per_word; - unsigned count = t->len; + unsigned int bits = t->bits_per_word; + unsigned int count = t->len; const u16 *tx = t->tx_buf; u16 *rx = t->rx_buf; @@ -100,16 +96,14 @@ static unsigned bitbang_txrx_16( return t->len - count; } -static unsigned bitbang_txrx_32( - struct spi_device *spi, +static unsigned int bitbang_txrx_32(struct spi_device *spi, spi_bb_txrx_word_fn txrx_word, - unsigned ns, + unsigned int ns, struct spi_transfer *t, - unsigned flags -) + unsigned int flags) { - unsigned bits = t->bits_per_word; - unsigned count = t->len; + unsigned int bits = t->bits_per_word; + unsigned int count = t->len; const u32 *tx = t->tx_buf; u32 *rx = t->rx_buf; @@ -221,7 +215,7 @@ EXPORT_SYMBOL_GPL(spi_bitbang_cleanup); static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) { struct spi_bitbang_cs *cs = spi->controller_state; - unsigned nsecs = cs->nsecs; + unsigned int nsecs = cs->nsecs; struct spi_bitbang *bitbang; bitbang = spi_controller_get_devdata(spi->controller); @@ -234,7 +228,7 @@ static int spi_bitbang_bufs(struct spi_device *spi, struct spi_transfer *t) } if (spi->mode & SPI_3WIRE) { - unsigned flags; + unsigned int flags; flags = t->tx_buf ? SPI_CONTROLLER_NO_RX : SPI_CONTROLLER_NO_TX; return cs->txrx_bufs(spi, cs->txrx_word, nsecs, t, flags); -- 2.43.0.rc1.1336.g36b5255a03ac ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v1 3/3] spi: bitbang: Replace hard coded number of SPI modes 2024-05-17 19:40 [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 1/3] spi: bitbang: Use typedef for txrx_*() callbacks Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 2/3] spi: bitbang: Convert unsigned to unsigned int Andy Shevchenko @ 2024-05-17 19:40 ` Andy Shevchenko 2024-06-05 21:07 ` [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko 3 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2024-05-17 19:40 UTC (permalink / raw) To: Andy Shevchenko, Mark Brown, linux-spi, linux-kernel Instead of using hard coded number of modes, replace it with SPI_MODE_X_MASK + 1 to show relation to the SPI modes. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- include/linux/spi/spi_bitbang.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/spi/spi_bitbang.h b/include/linux/spi/spi_bitbang.h index 7ca08b430ed5..d4cb83195f7a 100644 --- a/include/linux/spi/spi_bitbang.h +++ b/include/linux/spi/spi_bitbang.h @@ -30,7 +30,7 @@ struct spi_bitbang { int (*txrx_bufs)(struct spi_device *spi, struct spi_transfer *t); /* txrx_word[SPI_MODE_*]() just looks like a shift register */ - spi_bb_txrx_word_fn txrx_word[4]; + spi_bb_txrx_word_fn txrx_word[SPI_MODE_X_MASK + 1]; int (*set_line_direction)(struct spi_device *spi, bool output); }; -- 2.43.0.rc1.1336.g36b5255a03ac ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v1 0/3] spi: bitbang: Clean up the driver 2024-05-17 19:40 [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko ` (2 preceding siblings ...) 2024-05-17 19:40 ` [PATCH v1 3/3] spi: bitbang: Replace hard coded number of SPI modes Andy Shevchenko @ 2024-06-05 21:07 ` Andy Shevchenko 2024-06-05 21:21 ` Mark Brown 3 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2024-06-05 21:07 UTC (permalink / raw) To: Mark Brown, linux-spi, linux-kernel On Fri, May 17, 2024 at 10:40:19PM +0300, Andy Shevchenko wrote: > A few cleanups to the driver. No functional change intended. > > Andy Shevchenko (3): > spi: bitbang: Use typedef for txrx_*() callbacks > spi: bitbang: Convert unsigned to unsigned int > spi: bitbang: Replace hard coded number of SPI modes Hmm... It's not the first time I noticed that the series (despite even appearing in the CI, but then disappearing) left abandoned without clear feedback, Should I do something here? -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 0/3] spi: bitbang: Clean up the driver 2024-06-05 21:07 ` [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko @ 2024-06-05 21:21 ` Mark Brown 2024-06-06 10:47 ` Andy Shevchenko 0 siblings, 1 reply; 7+ messages in thread From: Mark Brown @ 2024-06-05 21:21 UTC (permalink / raw) To: Andy Shevchenko; +Cc: linux-spi, linux-kernel [-- Attachment #1: Type: text/plain, Size: 1367 bytes --] On Thu, Jun 06, 2024 at 12:07:14AM +0300, Andy Shevchenko wrote: > On Fri, May 17, 2024 at 10:40:19PM +0300, Andy Shevchenko wrote: > > A few cleanups to the driver. No functional change intended. > > > > Andy Shevchenko (3): > > spi: bitbang: Use typedef for txrx_*() callbacks > > spi: bitbang: Convert unsigned to unsigned int > > spi: bitbang: Replace hard coded number of SPI modes > > Hmm... It's not the first time I noticed that the series > (despite even appearing in the CI, but then disappearing) > left abandoned without clear feedback, > Should I do something here? Please don't send content free pings and please allow a reasonable time for review. People get busy, go on holiday, attend conferences and so on so unless there is some reason for urgency (like critical bug fixes) please allow at least a couple of weeks for review. If there have been review comments then people may be waiting for those to be addressed. Sending content free pings adds to the mail volume (if they are seen at all) which is often the problem and since they can't be reviewed directly if something has gone wrong you'll have to resend the patches anyway, so sending again is generally a better approach though there are some other maintainers who like them - if in doubt look at how patches for the subsystem are normally handled. [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v1 0/3] spi: bitbang: Clean up the driver 2024-06-05 21:21 ` Mark Brown @ 2024-06-06 10:47 ` Andy Shevchenko 0 siblings, 0 replies; 7+ messages in thread From: Andy Shevchenko @ 2024-06-06 10:47 UTC (permalink / raw) To: Mark Brown; +Cc: linux-spi, linux-kernel On Wed, Jun 05, 2024 at 10:21:35PM +0100, Mark Brown wrote: > On Thu, Jun 06, 2024 at 12:07:14AM +0300, Andy Shevchenko wrote: > > On Fri, May 17, 2024 at 10:40:19PM +0300, Andy Shevchenko wrote: > > > A few cleanups to the driver. No functional change intended. > > > > > > Andy Shevchenko (3): > > > spi: bitbang: Use typedef for txrx_*() callbacks > > > spi: bitbang: Convert unsigned to unsigned int > > > spi: bitbang: Replace hard coded number of SPI modes > > > > Hmm... It's not the first time I noticed that the series > > (despite even appearing in the CI, but then disappearing) > > left abandoned without clear feedback, > > > Should I do something here? Okay, it's just an announce is missing. I found them in the repository. Thanks! -- With Best Regards, Andy Shevchenko ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-06-06 10:47 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-05-17 19:40 [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 1/3] spi: bitbang: Use typedef for txrx_*() callbacks Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 2/3] spi: bitbang: Convert unsigned to unsigned int Andy Shevchenko 2024-05-17 19:40 ` [PATCH v1 3/3] spi: bitbang: Replace hard coded number of SPI modes Andy Shevchenko 2024-06-05 21:07 ` [PATCH v1 0/3] spi: bitbang: Clean up the driver Andy Shevchenko 2024-06-05 21:21 ` Mark Brown 2024-06-06 10:47 ` Andy Shevchenko
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).