diff options
| author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2025-04-17 18:24:46 +0300 | 
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2025-04-17 17:30:40 +0100 | 
| commit | 163ddf1fea590229c30a8dc4c29ff4febfb895c3 (patch) | |
| tree | bf1e034cd1c7bd46290a5f0a4097f79121e395db /scripts/lib/kdoc/kdoc_parser.py | |
| parent | 8ffd015db85fea3e15a77027fda6c02ced4d2444 (diff) | |
spi: Add spi_bpw_to_bytes() helper and use it
This helper converts the given bits per word to bytes. The result
will always be power-of-two, e.g.,
    ===============    =================
    Input (in bits)    Output (in bytes)
    ===============    =================
            5                   1
            9                   2
            21                  4
            37                  8
    ===============    =================
It will return 0 for the 0 input.
There are a couple of cases in SPI that are using the same approach
and at least one more (in IIO) would benefit of it. Add a helper
for everyone.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: David Lechner <dlechner@baylibre.com>
Link: https://patch.msgid.link/20250417152529.490582-2-andriy.shevchenko@linux.intel.com
Acked-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_parser.py')
0 files changed, 0 insertions, 0 deletions
