Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mtd: ubi: populate ubi volume fwnode

Look for the 'volumes' subnode of an MTD partition attached to a UBI
device and attach matching child nodes to UBI volumes.
This allows UBI volumes to be referenced in device tree, e.g. for use
as NVMEM providers.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Richard Weinberger <richard@nod.at>

authored by

Daniel Golle and committed by
Richard Weinberger
51932f9f 7e84c961

+27
+27
drivers/mtd/ubi/vmt.c
··· 124 124 kfree(vol); 125 125 } 126 126 127 + static struct fwnode_handle *find_volume_fwnode(struct ubi_volume *vol) 128 + { 129 + struct fwnode_handle *fw_vols, *fw_vol; 130 + const char *volname; 131 + u32 volid; 132 + 133 + fw_vols = device_get_named_child_node(vol->dev.parent->parent, "volumes"); 134 + if (!fw_vols) 135 + return NULL; 136 + 137 + fwnode_for_each_child_node(fw_vols, fw_vol) { 138 + if (!fwnode_property_read_string(fw_vol, "volname", &volname) && 139 + strncmp(volname, vol->name, vol->name_len)) 140 + continue; 141 + 142 + if (!fwnode_property_read_u32(fw_vol, "volid", &volid) && 143 + vol->vol_id != volid) 144 + continue; 145 + 146 + return fw_vol; 147 + } 148 + 149 + return NULL; 150 + } 151 + 127 152 /** 128 153 * ubi_create_volume - create volume. 129 154 * @ubi: UBI device description object ··· 248 223 vol->name_len = req->name_len; 249 224 memcpy(vol->name, req->name, vol->name_len); 250 225 vol->ubi = ubi; 226 + device_set_node(&vol->dev, find_volume_fwnode(vol)); 251 227 252 228 /* 253 229 * Finish all pending erases because there may be some LEBs belonging ··· 640 614 vol->dev.class = &ubi_class; 641 615 vol->dev.groups = volume_dev_groups; 642 616 dev_set_name(&vol->dev, "%s_%d", ubi->ubi_name, vol->vol_id); 617 + device_set_node(&vol->dev, find_volume_fwnode(vol)); 643 618 err = device_register(&vol->dev); 644 619 if (err) { 645 620 cdev_del(&vol->cdev);