lkml.org 
[lkml]   [2023]   [Nov]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v7 1/2] spi: Unify error codes by replacing -ENOTSUPP with -EOPNOTSUPP
    Hello,

    acelan.kao@canonical.com wrote on Wed, 29 Nov 2023 14:43:10 +0800:

    > From: "Chia-Lin Kao (AceLan)" <acelan.kao@canonical.com>
    >
    > This commit updates the SPI subsystem, particularly affecting "SPI MEM"
    > drivers and core parts, by replacing the -ENOTSUPP error code with
    > -EOPNOTSUPP.
    >
    > The key motivations for this change are as follows:
    > 1. The spi-nor driver currently uses EOPNOTSUPP, whereas calls to spi-mem
    > might return ENOTSUPP. This update aims to unify the error reporting
    > within the SPI subsystem for clarity and consistency.
    >
    > 2. The use of ENOTSUPP has been flagged by checkpatch as inappropriate,
    > mainly being reserved for NFS-related errors. To align with kernel coding
    > standards and recommendations, this change is being made.
    >
    > 3. By using EOPNOTSUPP, we provide more specific context to the error,
    > indicating that a particular operation is not supported. This helps
    > differentiate from the more generic ENOTSUPP error, allowing drivers to
    > better handle and respond to different error scenarios.
    >
    > Risks and Considerations:
    > While this change is primarily intended as a code cleanup and error code
    > unification, there is a minor risk of breaking user-space applications
    > that rely on specific return codes for unsupported operations. However,
    > this risk is considered low, as such use-cases are unlikely to be common
    > or critical. Nevertheless, developers and users should be aware of this
    > change, especially if they have scripts or tools that specifically handle
    > SPI error codes.
    >
    > This commit does not introduce any functional changes to the SPI subsystem
    > or the affected drivers.
    >
    > Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
    >
    > ---
    > v5. distinguish -EOPNOTSUPP from -ENOTSUPP
    > v6. a. spi_nor_set_4byte_addr_mode() should check -EOPNOTSUPP, all
    > callbacks of set_4byte_addr_mode() will eventually return
    > -EOPNOTSUPP if the checking failed.
    > b. Update comment to describe the reason for the patch and the
    > affected parts.
    > c. Update the kernel-doc of exec_op() in struct spi_controller_mem_ops
    > v7. added comment for the return code changes may affect userspace, and
    > the risk after this change
    > ---

    Looks sensible to me, let's make the conversion.

    Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

    Thanks,
    Miquèl

    \
     
     \ /
      Last update: 2023-11-29 10:17    [W:6.843 / U:0.244 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site