Skip to content

Commit

Permalink
misc: fs_loader: Use device_get_global_by_ofnode to get to node
Browse files Browse the repository at this point in the history
Instead of two staged ofnode_to_offset followed by
device_get_global_by_of_offset approach, direcly use the
device_get_global_by_ofnode to fetch the device.

Signed-off-by: Keerthy <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
  • Loading branch information
Keerthyj authored and trini committed Nov 16, 2018
1 parent 48e2f0c commit 7c096ea
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/misc/fs_loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,9 @@ static int select_fs_dev(struct device_platdata *plat)

node = ofnode_get_by_phandle(plat->phandlepart.phandle);

int of_offset = ofnode_to_offset(node);

struct udevice *dev;

ret = device_get_global_by_of_offset(of_offset, &dev);
ret = device_get_global_by_ofnode(node, &dev);
if (!ret) {
struct blk_desc *desc = blk_get_by_device(dev);
if (desc) {
Expand Down Expand Up @@ -190,6 +188,7 @@ static int fw_get_filesystem_firmware(struct device_platdata *plat,

ret = fs_read(fw_priv->name, (ulong)map_to_sysmem(firmware->data),
fw_priv->offset, firmware->size, &actread);

if (ret) {
debug("Error: %d Failed to read %s from flash %lld != %d.\n",
ret, fw_priv->name, actread, firmware->size);
Expand Down

0 comments on commit 7c096ea

Please sign in to comment.