From: Lukas Wunner <lukas@wunner.de>
To: Joe Burmeister <joe.burmeister@devtank.co.uk>
Cc: Mark Brown <broonie@kernel.org>,
linux-spi@vger.kernel.org, Phil Elwell <phil@raspberrypi.com>
Subject: Re: Multi driver SPI chip select count unenforced.
Date: Fri, 16 Apr 2021 17:30:19 +0200 [thread overview]
Message-ID: <20210416153019.GA26144@wunner.de> (raw)
In-Reply-To: <6a6c9d49-9064-4bbe-0330-87f92623d669@devtank.co.uk>
On Fri, Apr 16, 2021 at 11:55:45AM +0100, Joe Burmeister wrote:
> However, after I found the same broken pattern in a few places.
> You can find suspects by grep'ing in the SPI folder for "->chip_select]".
You need to cc the maintainers of the affected drivers.
You can retrieve them with "scripts/get_maintainer.pl drivers/spi/spi-...".
Please don't attach patches but rather submit each one separately.
Pass a commit range (abcdefg..0123456) to "git format-patch" to
get numbered patches, then submit them with msmtp or "git send-email".
> Subject: [PATCH] Handle SPI device setup callback failure.
Prepend the subsystem to the subject and drop the period, e.g.:
spi: Handle SPI device setup callback failure
Patch otherwise LGTM.
> Subject: [PATCH] Remove BCM2835 SPI chipselect limit.
Prepend "spi: bcm2835: " in this case and drop the period.
Use "git log --oneline <filename>" to see what the prefix should look
like for a particular file.
> The limit of 4 chipselects for the BCM2835 was not required and also was
> not inforced. Without inforcement it was possible to make a device tree
> over this limit which would trample memory.
>
> The chipselect count is now obtained from the device tree and expanded
> if more devices are added.
I'd prefer it if you could just raise BCM2835_SPI_NUM_CS to 6
(or 8 or whatever you need). Use commit 603e92ff10a8 as a template.
Then submit a separate patch to error out of bcm2835_spi_setup()
if bcm2835_spi_setup >= BCM2835_SPI_NUM_CS.
Honestly I think the additional code complexity isn't worth it to allow
for dynamic resizing. Raising BCM2835_SPI_NUM_CS results in just a
few additional bytes, that's probably smaller than the increase of the
text segment due to the additional resizing code.
Nit: I think the correct spelling is "enforce". (Not an English native
speaker but my dictionary says so.)
Thanks!
Lukas
next prev parent reply other threads:[~2021-04-16 15:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 10:55 Multi driver SPI chip select count unenforced Joe Burmeister
2021-04-16 15:30 ` Lukas Wunner [this message]
2021-04-19 12:56 ` Joe Burmeister
2021-04-16 15:54 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210416153019.GA26144@wunner.de \
--to=lukas@wunner.de \
--cc=broonie@kernel.org \
--cc=joe.burmeister@devtank.co.uk \
--cc=linux-spi@vger.kernel.org \
--cc=phil@raspberrypi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).