Skip to content

Commit

Permalink
lib: system: linux: Remove metal_linux_get_device_property() helper
Browse files Browse the repository at this point in the history
This function is unused and out of place in a library like libmetal. Remove
this helper function.

Signed-off-by: Andrew Davis <[email protected]>
  • Loading branch information
glneo committed Mar 18, 2024
1 parent fe6094a commit ca5768b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 40 deletions.
27 changes: 0 additions & 27 deletions lib/system/linux/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,30 +647,3 @@ int metal_generic_dev_sys_open(struct metal_device *dev)
(void)dev;
return 0;
}

int metal_linux_get_device_property(struct metal_device *device,
const char *property_name,
void *output, int len)
{
int fd = 0;
int status = 0;
const int flags = O_RDONLY;
const int mode = S_IRUSR | S_IRGRP | S_IROTH;
struct linux_device *ldev = to_linux_device(device);
char path[PATH_MAX];

snprintf(path, sizeof(path), "%s/of_node/%s",
ldev->sdev->path, property_name);
fd = open(path, flags, mode);
if (fd < 0)
return -errno;
if (read(fd, output, len) < 0) {
status = -errno;
close(fd);
return status;
}

status = close(fd);
return status < 0 ? -errno : 0;
}

13 changes: 0 additions & 13 deletions lib/system/linux/sys.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,6 @@ extern int metal_map(int fd, off_t offset, size_t size, int expand,
int flags, void **result);
extern int metal_unmap(void *mem, size_t size);

/**
* @brief Read a device tree property of a device
*
* @param[in] device metal_device of the intended DT node
* @param[in] property_name name of the property to be read
* @param[out] output output buffer to store read data
* @param[in] len number of bytes to be read
* @return 0 on success, or -errno on error.
*/
extern int metal_linux_get_device_property(struct metal_device *device,
const char *property_name,
void *output, int len);

#define metal_for_each_page_size_up(ps) \
for ((ps) = &_metal.page_sizes[0]; \
(ps) <= &_metal.page_sizes[_metal.num_page_sizes - 1]; \
Expand Down

0 comments on commit ca5768b

Please sign in to comment.