Re: [PATCH v2 08/16] cdev: stub out cdev_read/write for PBL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Nov 25, 2024 at 04:12:20PM +0100, Ahmad Fatoum wrote:
> To optimize out calls to undefined functions in PBL at compile-time
> instead of link time, let's define stubs for the functions that
> are referenced in obj-pbl-y files, but inside function sections
> that are ultimately unreferenced.
> 
> We don't use IS_PROPER here as cdev support is always available
> in barebox proper.

Again, drop this sentence?

Sascha

> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> ---
>  include/driver.h | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/include/driver.h b/include/driver.h
> index c4067d531cc7..3aef385bc837 100644
> --- a/include/driver.h
> +++ b/include/driver.h
> @@ -14,6 +14,7 @@
>  #include <device.h>
>  #include <of.h>
>  #include <init.h>
> +#include <errno.h>
>  #include <filetype.h>
>  
>  #define FORMAT_DRIVER_NAME_ID	"%s%d"
> @@ -514,21 +515,40 @@ int devfs_create_link(struct cdev *, const char *name);
>  int devfs_remove(struct cdev *);
>  int cdev_find_free_index(const char *);
>  struct cdev *device_find_partition(struct device *dev, const char *name);
> -struct cdev *cdev_by_name(const char *filename);
>  struct cdev *lcdev_by_name(const char *filename);
>  struct cdev *cdev_readlink(struct cdev *cdev);
>  struct cdev *cdev_by_device_node(struct device_node *node);
>  struct cdev *cdev_by_partuuid(const char *partuuid);
>  struct cdev *cdev_by_diskuuid(const char *partuuid);
> -struct cdev *cdev_open_by_name(const char *name, unsigned long flags);
>  struct cdev *cdev_create_loop(const char *path, ulong flags, loff_t offset);
>  void cdev_remove_loop(struct cdev *cdev);
>  int cdev_open(struct cdev *, unsigned long flags);
>  int cdev_fdopen(struct cdev *cdev, unsigned long flags);
>  int cdev_close(struct cdev *cdev);
>  int cdev_flush(struct cdev *cdev);
> +#if IN_PROPER
>  ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags);
>  ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags);
> +struct cdev *cdev_by_name(const char *filename);
> +struct cdev *cdev_open_by_name(const char *name, unsigned long flags);
> +#else
> +static inline ssize_t cdev_read(struct cdev *cdev, void *buf, size_t count, loff_t offset, ulong flags)
> +{
> +	return -ENOSYS;
> +}
> +static inline ssize_t cdev_write(struct cdev *cdev, const void *buf, size_t count, loff_t offset, ulong flags)
> +{
> +	return -ENOSYS;
> +}
> +static inline struct cdev *cdev_by_name(const char *filename)
> +{
> +	return NULL;
> +}
> +static inline struct cdev *cdev_open_by_name(const char *name, unsigned long flags)
> +{
> +	return NULL;
> +}
> +#endif
>  int cdev_ioctl(struct cdev *cdev, unsigned int cmd, void *buf);
>  int cdev_erase(struct cdev *cdev, loff_t count, loff_t offset);
>  int cdev_lseek(struct cdev*, loff_t);
> -- 
> 2.39.5
> 
> 
> 

-- 
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 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux