[PATCH v2 0/2] dt-bindings: mtd: partitions: Export special values

Edward Chow posted 2 patches 2 years, 1 month ago
.../mtd/partitions/fixed-partitions.yaml      | 30 +++++++++++++++++++
MAINTAINERS                                   |  2 ++
include/dt-bindings/mtd/partitions.h          | 15 ++++++++++
3 files changed, 47 insertions(+)
create mode 100644 include/dt-bindings/mtd/partitions.h
[PATCH v2 0/2] dt-bindings: mtd: partitions: Export special values
Posted by Edward Chow 2 years, 1 month ago
There are special "offset" and "size" values defined and documented in
linux/mtd/partitions.h:

/* consume as much as possible, leaving size after the end of partition. */
 #define MTDPART_OFS_RETAIN (uint64_t)(-3)

/* the partition will start at the next erase block. */
 #define MTDPART_OFS_NXTBLK (uint64_t)(-2)

/* the partition will start where the previous one ended. */
 #define MTDPART_OFS_APPEND (uint64_t)(-1)

(Though not explicitly, they are compared against variables in uint64_t
in drivers/mtd/mtdpart.c, so they had better be considered as such.)

/* the partition will extend to the end of the master MTD device. */
 #define MTDPART_SIZ_FULL (0)

These special values could be used to define partitions automatically
fitting to the size of the master MTD device at runtime.

However, these values used not to be exported to dt-bindings, thus
seldom used before, since they might have been only used in numeric form,
such as "(-1) (-3)" for MTDPART_OFS_RETAIN.

Now, they are exported in dt-bindings/mtd/partitions.h as 32-bit cell
values, so 2-cell addressed should be defined to use special offset values,
such as "MTDPART_OFS_SPECIAL MTDPART_OFS_RETAIN" for MTDPART_OFS_RETAIN in
linux/mtd/partitions.h. An example is added to fixed-partitions.yaml.

Edward Chow (2):
  dt-bindings: mtd: partitions: Export special values
  dt-bindings: mtd: partitions: Document special values

 .../mtd/partitions/fixed-partitions.yaml      | 30 +++++++++++++++++++
 MAINTAINERS                                   |  2 ++
 include/dt-bindings/mtd/partitions.h          | 15 ++++++++++
 3 files changed, 47 insertions(+)
 create mode 100644 include/dt-bindings/mtd/partitions.h

--
2.42.0
Re: [PATCH v2 0/2] dt-bindings: mtd: partitions: Export special values
Posted by Miquel Raynal 2 years, 1 month ago
Hi Edward,

equu@openmail.cc wrote on Fri, 27 Oct 2023 17:46:08 +0800:

> There are special "offset" and "size" values defined and documented in
> linux/mtd/partitions.h:
> 
> /* consume as much as possible, leaving size after the end of partition. */
>  #define MTDPART_OFS_RETAIN (uint64_t)(-3)
> 
> /* the partition will start at the next erase block. */
>  #define MTDPART_OFS_NXTBLK (uint64_t)(-2)
> 
> /* the partition will start where the previous one ended. */
>  #define MTDPART_OFS_APPEND (uint64_t)(-1)
> 
> (Though not explicitly, they are compared against variables in uint64_t
> in drivers/mtd/mtdpart.c, so they had better be considered as such.)
> 
> /* the partition will extend to the end of the master MTD device. */
>  #define MTDPART_SIZ_FULL (0)
> 
> These special values could be used to define partitions automatically
> fitting to the size of the master MTD device at runtime.
> 
> However, these values used not to be exported to dt-bindings, thus
> seldom used before, since they might have been only used in numeric form,
> such as "(-1) (-3)" for MTDPART_OFS_RETAIN.
> 
> Now, they are exported in dt-bindings/mtd/partitions.h as 32-bit cell
> values, so 2-cell addressed should be defined to use special offset values,
> such as "MTDPART_OFS_SPECIAL MTDPART_OFS_RETAIN" for MTDPART_OFS_RETAIN in
> linux/mtd/partitions.h. An example is added to fixed-partitions.yaml.
> 
> Edward Chow (2):
>   dt-bindings: mtd: partitions: Export special values
>   dt-bindings: mtd: partitions: Document special values
> 
>  .../mtd/partitions/fixed-partitions.yaml      | 30 +++++++++++++++++++
>  MAINTAINERS                                   |  2 ++
>  include/dt-bindings/mtd/partitions.h          | 15 ++++++++++
>  3 files changed, 47 insertions(+)
>  create mode 100644 include/dt-bindings/mtd/partitions.h
> 
> --
> 2.42.0

I've expressed my feelings regarding this series in your v1 but it
feels like you are completely ignoring them. As a reminder, I am
opposed to exporting these flags. They are outdated, legacy, have
never been used in DT and were never meant to be.

Thanks, Miquèl
Re: [PATCH v2 0/2] dt-bindings: mtd: partitions: Export special values
Posted by Krzysztof Kozlowski 2 years, 1 month ago
On 27/10/2023 11:46, Edward Chow wrote:
> There are special "offset" and "size" values defined and documented in
> linux/mtd/partitions.h:
> 
> /* consume as much as possible, leaving size after the end of partition. */
>  #define MTDPART_OFS_RETAIN (uint64_t)(-3)
> 

Also:

Do not attach (thread) your patchsets to some other threads (unrelated
or older versions). This buries them deep in the mailbox and might
interfere with applying entire sets.

Best regards,
Krzysztof
Re: [PATCH v2 0/2] dt-bindings: mtd: partitions: Export special values
Posted by Krzysztof Kozlowski 2 years, 1 month ago
On 27/10/2023 11:46, Edward Chow wrote:
> There are special "offset" and "size" values defined and documented in
> linux/mtd/partitions.h:
> 


Missing changelog. I already see you ignored my comments :/

Best regards,
Krzysztof