Re: [patch] usb: call bdev_read_only() only on CONFIG_BLOCK

From: Sam Ravnborg
Date: Tue Mar 27 2007 - 05:37:39 EST


On Tue, Mar 27, 2007 at 02:03:25AM -0700, David Rientjes wrote:
> bdev_read_only() is only defined on CONFIG_BLOCK so we make sure not to
> call it unless we have it. A new static inline function,
> is_inode_read_only(), is invoked to call bdev_read_only() on CONFIG_BLOCK
> and return zero otherwise.
>
> Cc: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx>
> ---
> drivers/usb/gadget/file_storage.c | 10 +++++++++-
> 1 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
> --- a/drivers/usb/gadget/file_storage.c
> +++ b/drivers/usb/gadget/file_storage.c
> @@ -3493,6 +3493,14 @@ static int fsg_main_thread(void *fsg_)
> complete_and_exit(&fsg->thread_notifier, 0);
> }
>
> +#ifdef CONFIG_BLOCK
> +static inline int is_inode_read_only(struct inode *inode)
> +{
> + return bdev_read_only(inode->i_bdev);
> +}
> +#else
> +#define is_inode_read_only(inode) (0)
> +#endif

This looks like the wrong place to fix this.
Like we do with for exampel the pci_ functions we should provide a dummy
implementation in the kernel if configured without CONFIG_BLOCK.

In this way the decision to provide dummy functions are centralized
and benefits all users.

Sam
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/