[PATCH v2 25/35] mtd: spi-nor: core: Move spi_nor_set_addr_width() in spi_nor_setup()

Tudor.Ambarus at microchip.com Tudor.Ambarus at microchip.com
Fri Oct 22 05:36:58 PDT 2021


On 10/22/21 3:12 PM, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Am 2021-07-27 06:52, schrieb Tudor Ambarus:
>> spi_nor_setup() configures the SPI NOR memory. Setting the addr width
>> is too a configuration, hence we can move the spi_nor_set_addr_width()
>> in spi_nor_setup().
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus at microchip.com>
> 
> ..
> 
>>  static int spi_nor_setup(struct spi_nor *nor,
>>                        const struct spi_nor_hwcaps *hwcaps)
>>  {
>> +     int ret;
>> +
>>       if (!nor->params->setup)
>> -             return 0;
>> +             return spi_nor_set_addr_width(nor);
>>
>> -     return nor->params->setup(nor, hwcaps);
>> +     ret = nor->params->setup(nor, hwcaps);
>> +     if (ret)
>> +             return ret;
>> +
>> +     return spi_nor_set_addr_width(nor);
>>  }
> 
> Why not
> 
> static int spi_nor_setup(struct spi_nor *nor,
>                         const struct spi_nor_hwcaps *hwcaps)
> {
>        int ret;
> 
>        if (nor->params->setup) {
>                ret = nor->params->setup(nor, hwcaps);
>                if (ret)
>                        return ret;
>        }
> 
>        return spi_nor_set_addr_width(nor)
> }
> 
> -michael

right, I'm reworking the series right now, that's how I updated it too.


More information about the linux-mtd mailing list