[PATCH 10/18] cdev: have devfs_add_partition return existing identical partition, not NULL

Sascha Hauer sha at pengutronix.de
Thu Jun 1 00:36:01 PDT 2023


On Wed, May 31, 2023 at 04:59:19PM +0200, Ahmad Fatoum wrote:
> Starting with commit 7f9f45b9bfef ("devfs: Do not create overlapping
> partitions"), any overlapping is disallowed. Overlapping can be useful
> though to bridge the gap between partition described in DT and via
> on-disk partition tables. Let's handle the case of identical partitions
> specially and have it neither be an error or a duplicate partition, but
> instead just return the existing partition. This existing partition will
> be given a device tree node and thus enabling schemes like:
> 
>   &{/state} {
>   	backend = <&state_part>;
>   };
> 
>   &mmc1 {
>          partitions {
>                  compatible = "fixed-partitions";
>                  #address-cells = <2>;
>                  #size-cells = <2>;
> 
>                  state_part: partition at 5300000 {
>                          label = "barebox-state";
> 			 /* will be folded with overlapping GPT partition if found */
>                          reg = <0x0 0x5300000 0x0 0x100000>;
>                  };
>          };
>   };

You introduced the DEVFS_PARTITION_FROM_OF earlier this series.
Depending on the order the code runs you end up with either the
partition from the partition table or the one created from OF with
DEVFS_PARTITION_FROM_OF. I am not sure about the implications of
this inconsistency. Can it lead to problems later?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list