linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* CONFIG_BLK_DEV_BSG=n
@ 2007-09-14 19:50 Medve Emilian-EMMEDVE1
  2007-09-14 20:00 ` CONFIG_BLK_DEV_BSG=n James Bottomley
  2007-09-17 14:46 ` CONFIG_BLK_DEV_BSG=n David Howells
  0 siblings, 2 replies; 4+ messages in thread
From: Medve Emilian-EMMEDVE1 @ 2007-09-14 19:50 UTC (permalink / raw)
  To: fujita.tomonori, James.Bottomley, James.Bottomley, paulus,
	Gala Kumar-B11780
  Cc: linuxppc-dev, linux-scsi

Hello,


I'm trying to get powerpc to build without block device support
(CONFIG_BLOCK=3Dn). I'm getting the following errors:

  CC      arch/powerpc/kernel/setup_32.o
In file included from include/linux/blkdev.h:17,
                 from include/linux/ide.h:13,
                 from arch/powerpc/kernel/setup_32.c:13:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside
parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or
declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside
parameter list
In file included from arch/powerpc/kernel/setup_32.c:13:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

  CC      arch/powerpc/kernel/ppc_ksyms.o
In file included from include/linux/blkdev.h:17,
                 from include/linux/ide.h:13,
                 from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/bsg.h:67: warning: 'struct request_queue' declared inside
parameter list
include/linux/bsg.h:67: warning: its scope is only this definition or
declaration, which is probably not what you want
include/linux/bsg.h:71: warning: 'struct request_queue' declared inside
parameter list
In file included from arch/powerpc/kernel/ppc_ksyms.c:15:
include/linux/ide.h:857: error: field 'wrq' has incomplete type

I fixed the errors with a small patch in the powerpc code only and I'm
comfortable with that. The matter I wanted your input on is the warnings
from bsg.h coming from this are of the file:

	...
#ifdef __KERNEL__

#if defined(CONFIG_BLK_DEV_BSG)
struct bsg_class_device {
        struct class_device *class_dev;
        struct device *dev;
        int minor;
        struct request_queue *queue;
};

extern int bsg_register_queue(struct request_queue *, struct device *,
const char *);
extern void bsg_unregister_queue(struct request_queue *);
#else
static inline int bsg_register_queue(struct request_queue * rq, struct
device *dev, const char *name
)
{
        return 0;
}
static inline void bsg_unregister_queue(struct request_queue *rq)
{
}
#endif

#endif /* __KERNEL__ */
	...

I noticed that the '#else' branch was last updated by James (a4ee0df8)
in order to address some other warnings in scsi_sysfs.c, for example, in
the next piece of code:

	...
        error =3D bsg_register_queue(rq, &sdev->sdev_gendev, NULL);

        if (error)
                sdev_printk(KERN_INFO, sdev,
                            "Failed to register bsg queue, =
errno=3D%d\n",
error);

        /* we're treating error on bsg register as non-fatal, so pretend
         * nothing went wrong */
        error =3D 0;
	...

The quick fix to those warnings is to add a declaration of struct
request_queue in bsg.h something looking like this:

	...
#ifdef __KERNEL__

struct request_queue; <- This is the addition

#if defined(CONFIG_BLK_DEV_BSG)
struct bsg_class_device {
        struct class_device *class_dev;
	...

However, I was wondering if there isn't a cleaner way of doing it. For
example, from the comments in scsi_sysfs.c it looks like it would be
possible not to call bsg_register_queue() at all when
CONFIG_BLK_DEV_BSG=3Dn and get rid of the '#else' branch in bsg.h as I
don't think bsg_register_queue() and bsg_unregister_queue() should be
called when CONFIG_BLK_DEV_BSG=3Dn.

Which solution would you be more comfortable with?


Thanks,
Emil.


This e-mail, and any associated attachments have been classified as:
--------------------------------------------------------------------
[ ] Public
[x] Freescale Semiconductor Internal Use Only
[ ] Freescale Semiconductor Confidential Proprietary

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: CONFIG_BLK_DEV_BSG=n
  2007-09-14 19:50 CONFIG_BLK_DEV_BSG=n Medve Emilian-EMMEDVE1
@ 2007-09-14 20:00 ` James Bottomley
  2007-09-17 14:46 ` CONFIG_BLK_DEV_BSG=n David Howells
  1 sibling, 0 replies; 4+ messages in thread
From: James Bottomley @ 2007-09-14 20:00 UTC (permalink / raw)
  To: Medve Emilian-EMMEDVE1
  Cc: fujita.tomonori, linuxppc-dev, Gala Kumar-B11780, paulus,
	linux-scsi

On Fri, 2007-09-14 at 12:50 -0700, Medve Emilian-EMMEDVE1 wrote:
> Which solution would you be more comfortable with?

The one which is currently in -mm is this one:

http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a

James

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: CONFIG_BLK_DEV_BSG=n
  2007-09-14 19:50 CONFIG_BLK_DEV_BSG=n Medve Emilian-EMMEDVE1
  2007-09-14 20:00 ` CONFIG_BLK_DEV_BSG=n James Bottomley
@ 2007-09-17 14:46 ` David Howells
  2007-09-19 12:53   ` CONFIG_BLK_DEV_BSG=n Jens Axboe
  1 sibling, 1 reply; 4+ messages in thread
From: David Howells @ 2007-09-17 14:46 UTC (permalink / raw)
  To: James Bottomley, akpm, jens.axboe
  Cc: fujita.tomonori, linux-scsi, Gala Kumar-B11780, linuxppc-dev,
	paulus


James Bottomley <James.Bottomley@SteelEye.com> wrote:

> > Which solution would you be more comfortable with?
> 
> The one which is currently in -mm is this one:
> 
> http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a

In my opinion, this is the wrong fix.  There shouldn't be anything in the
kernel using stuff from bsg.h if CONFIG_BLOCK=n, so there should be an error if
anything tries to.  The correct fix is to exclude the non-userspace-visible
contents of bsg.h with #ifdef CONFIG_BLOCK, not to declare things that we've
tried to make sure specifically aren't declared.

David
---

[PATCH] VFS: Make BSG declarations dependent on CONFIG_BLOCK

From: David Howells <dhowells@redhat.com>

Make BSG function declarations dependent on CONFIG_BLOCK as they are not
compilable if the block layer is compiled out.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/bsg.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/linux/bsg.h b/include/linux/bsg.h
index 60e377b..28f5d44 100644
--- a/include/linux/bsg.h
+++ b/include/linux/bsg.h
@@ -52,6 +52,7 @@ struct sg_io_v4 {
 };
 
 #ifdef __KERNEL__
+#ifdef CONFIG_BLOCK
 
 #if defined(CONFIG_BLK_DEV_BSG)
 struct bsg_class_device {
@@ -73,6 +74,7 @@ static inline void bsg_unregister_queue(struct request_queue *rq)
 }
 #endif
 
+#endif /* CONFIG_BLOCK */
 #endif /* __KERNEL__ */
 
 #endif

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: CONFIG_BLK_DEV_BSG=n
  2007-09-17 14:46 ` CONFIG_BLK_DEV_BSG=n David Howells
@ 2007-09-19 12:53   ` Jens Axboe
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2007-09-19 12:53 UTC (permalink / raw)
  To: David Howells
  Cc: James Bottomley, akpm, linux-scsi, Gala Kumar-B11780,
	fujita.tomonori, linuxppc-dev, paulus

On Mon, Sep 17 2007, David Howells wrote:
> 
> James Bottomley <James.Bottomley@SteelEye.com> wrote:
> 
> > > Which solution would you be more comfortable with?
> > 
> > The one which is currently in -mm is this one:
> > 
> > http://git.kernel.org/?p=linux/kernel/git/jejb/scsi-misc-2.6.git;a=commit;h=49892223f7d3a2333ef9e6cbdd526676e1fc517a
> 
> In my opinion, this is the wrong fix.  There shouldn't be anything in
> the kernel using stuff from bsg.h if CONFIG_BLOCK=n, so there should
> be an error if anything tries to.  The correct fix is to exclude the
> non-userspace-visible contents of bsg.h with #ifdef CONFIG_BLOCK, not
> to declare things that we've tried to make sure specifically aren't
> declared.

I agree, I'll pass your fix on.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-19 13:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-14 19:50 CONFIG_BLK_DEV_BSG=n Medve Emilian-EMMEDVE1
2007-09-14 20:00 ` CONFIG_BLK_DEV_BSG=n James Bottomley
2007-09-17 14:46 ` CONFIG_BLK_DEV_BSG=n David Howells
2007-09-19 12:53   ` CONFIG_BLK_DEV_BSG=n Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).