All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: David Rientjes <rientjes@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Alan Stern <stern@rowland.harvard.edu>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] usb: call bdev_read_only() only on CONFIG_BLOCK
Date: Tue, 27 Mar 2007 11:37:25 +0200	[thread overview]
Message-ID: <20070327093725.GA2481@uranus.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0703270201410.10410@chino.kir.corp.google.com>

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@rowland.harvard.edu>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  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

  reply	other threads:[~2007-03-27  9:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27  9:03 [patch] usb: call bdev_read_only() only on CONFIG_BLOCK David Rientjes
2007-03-27  9:37 ` Sam Ravnborg [this message]
2007-03-27 16:04   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070327093725.GA2481@uranus.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=stern@rowland.harvard.edu \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.