2002-10-07 20:41:50

by Marcel Holtmann

[permalink] [raw]
Subject: [PATCH] Make it possible to compile in the Bluetooth subsystem

You can import this changeset into BK by piping this whole message to:
'| bk receive [path to repository]' or apply the patch as usual.

===================================================================


[email protected], 2002-10-07 22:08:56+02:00, [email protected]
Make it possible to compile in the Bluetooth subsystem


af_bluetooth.c | 8 +++-----
rfcomm/tty.c | 8 +-------
2 files changed, 4 insertions(+), 12 deletions(-)


diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
--- a/net/bluetooth/af_bluetooth.c Mon Oct 7 22:16:14 2002
+++ b/net/bluetooth/af_bluetooth.c Mon Oct 7 22:16:14 2002
@@ -320,7 +320,7 @@
PF_BLUETOOTH, bluez_sock_create
};

-static int __init bluez_init(void)
+int __init bluez_init(void)
{
BT_INFO("BlueZ Core ver %s Copyright (C) 2000,2001 Qualcomm Inc",
VERSION);
@@ -337,7 +337,7 @@
BT_ERR("BlueZ socket cache creation failed");
return -ENOMEM;
}
-
+
sock_register(&bluez_sock_family_ops);

hci_core_init();
@@ -345,7 +345,7 @@
return 0;
}

-static void __exit bluez_cleanup(void)
+void __exit bluez_cleanup(void)
{
hci_sock_cleanup();
hci_core_cleanup();
@@ -356,11 +356,9 @@
remove_proc_entry("bluetooth", NULL);
}

-#ifdef MODULE
module_init(bluez_init);
module_exit(bluez_cleanup);

MODULE_AUTHOR("Maxim Krasnyansky <[email protected]>");
MODULE_DESCRIPTION("BlueZ Core ver " VERSION);
MODULE_LICENSE("GPL");
-#endif
diff -Nru a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
--- a/net/bluetooth/rfcomm/tty.c Mon Oct 7 22:16:14 2002
+++ b/net/bluetooth/rfcomm/tty.c Mon Oct 7 22:16:14 2002
@@ -501,12 +501,6 @@
#endif
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#define __minor MINOR
-#else
-#define __minor minor
-#endif
-
static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
{
DECLARE_WAITQUEUE(wait, current);
@@ -514,7 +508,7 @@
struct rfcomm_dlc *dlc;
int err, id;

- id = __minor(tty->device) - tty->driver.minor_start;
+ id = minor(tty->device) - tty->driver.minor_start;

BT_DBG("tty %p id %d", tty, id);


===================================================================


This BitKeeper patch contains the following changesets:
+
## Wrapped with gzip_uu ##


begin 664 bkpatch19808
M'XL(`([KH3T``\U5;6O;,!#^'/V*@WYI*;9/KW8\4KJV8QO;6.GHMT%0;*4V
MB>[email protected]*VD[_.,G.UO2CBS;[email protected]>U#2?)IT>G>YZ3#N"Z,74\*'2=F#[email protected]'=58^-!
M5LUMH<O2K^H;-WA556XPR*K"!#]_!9/<SHQ9F#J8S)?FF\=\29SOI;9)!BM3
M-_&`^GPS8N\7)AY<O7E[_?'U%2&C$9QGNKPQ7XR%T8C8JE[I>=J<:IO-J]*W
MM2Z;PECM)U71;EQ;ALC<*VG(4:J6*A1AF]"44BVH29&)2(DMVL*4-\M\/QQ%
M#&G$&*I641PR<@'4#W$(R`**`8;`6([email protected];".EFG#Y,$QPP\)&?PO/LX
M)PE\TC,#N85%U33Y9&[<$N"P%KEKYB78S,"9(\`ZCC)HEI/FOK&F(!]`4>XV
M<[G-,_'^\2$$-9(36'0,[MY1:6S/?[]\H*?C3<=/MIN,N.2BI>&0LY:K%#6C
[email protected]:3.<[$KGGV$[TAB5',-62,6%B[+0=[/35>X4Z1^656F.?D&IIR[@(K#V
M?HLA$;D0K'4<R*B-PA13)JD14ZV5G/Y%:+M`76!"2=Y*B:'LI?[[.9WVGS]P
M\L3`43"[email protected](9]&[email protected]'1<!CH6+)]Q4!!2]\646PYN`S>/5M_SE17^ZAXPDE
M<B%[email protected]'*&AD#)^[6!'T^>[email protected]*O*SJ0X?OG:1FE2?F"#Q8=^O<G91^[S!NK*[M
MJQUZ>2S_3C'_M2!)[;SWZ7%W.0H'RKEJ'6<8]N)1C\0C>8SA/O%P\.3+$L_Z
M9-DKGL>Y>(I\...=;M8F+RV,QWGIHNUOU;YYN*KR],AY"NP]>_.UZT?K?F<Z
M'S?5W&VF)G.CR^5B,UL.G=L%5\J9S;6<9":9-<MBQ"91)(64Y#L%[email protected]`
!````
`
end


2002-10-07 20:46:59

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to compile in the Bluetooth subsystem


On Mon, 7 Oct 2002, Linus Torvalds wrote:
>
> Looks good, but you should _not_ remove the "static". Please keep the init
> functions static, they will be explicitly exported to the stuff that cares
> (and nobody else) by the "module_init()" thing anyway.

In other words, I think the patch should be just this instead..

Linus

diff -Nru a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
--- a/net/bluetooth/af_bluetooth.c Mon Oct 7 22:16:14 2002
+++ b/net/bluetooth/af_bluetooth.c Mon Oct 7 22:16:14 2002
@@ -356,11 +356,9 @@
remove_proc_entry("bluetooth", NULL);
}

-#ifdef MODULE
module_init(bluez_init);
module_exit(bluez_cleanup);

MODULE_AUTHOR("Maxim Krasnyansky <[email protected]>");
MODULE_DESCRIPTION("BlueZ Core ver " VERSION);
MODULE_LICENSE("GPL");
-#endif
diff -Nru a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c
--- a/net/bluetooth/rfcomm/tty.c Mon Oct 7 22:16:14 2002
+++ b/net/bluetooth/rfcomm/tty.c Mon Oct 7 22:16:14 2002
@@ -501,12 +501,6 @@
#endif
}

-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#define __minor MINOR
-#else
-#define __minor minor
-#endif
-
static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp)
{
DECLARE_WAITQUEUE(wait, current);
@@ -514,7 +508,7 @@
struct rfcomm_dlc *dlc;
int err, id;

- id = __minor(tty->device) - tty->driver.minor_start;
+ id = minor(tty->device) - tty->driver.minor_start;

BT_DBG("tty %p id %d", tty, id);



2002-10-07 20:44:10

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to compile in the Bluetooth subsystem


On Mon, 7 Oct 2002, Marcel Holtmann wrote:
>
> [email protected], 2002-10-07 22:08:56+02:00, [email protected]
> Make it possible to compile in the Bluetooth subsystem

Looks good, but you should _not_ remove the "static". Please keep the init
functions static, they will be explicitly exported to the stuff that cares
(and nobody else) by the "module_init()" thing anyway.

Linus

2002-10-07 21:24:21

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to compile in the Bluetooth subsystem


On 7 Oct 2002, Marcel Holtmann wrote:
>
> but when I try to compile in the Bluetooth subsystem I got the following
> error:
>
> net/built-in.o: In function `sock_init':
> net/built-in.o(.text.init+0x5b): undefined reference to `bluez_init'
> make: *** [.tmp_vmlinux1] Error 1

This is a separate error, apparently because net/socket.c calls
"blues_init()" if bluetooth is configured in.

That shouldn't be needed at all, since the "init_module()" thing should
take care of it. Please try just removing the bluez_init references from
net/socket.c - that should fix the compile, and if all the ordering issues
are ok, it should also work afterwards..

Linus

2002-10-07 21:19:37

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to compile in the Bluetooth subsystem

On Mon, 2002-10-07 at 22:49, Linus Torvalds wrote:
>
> On Mon, 7 Oct 2002, Marcel Holtmann wrote:
> >
> > [email protected], 2002-10-07 22:08:56+02:00, [email protected]
> > Make it possible to compile in the Bluetooth subsystem
>
> Looks good, but you should _not_ remove the "static". Please keep the init
> functions static, they will be explicitly exported to the stuff that cares
> (and nobody else) by the "module_init()" thing anyway.

but when I try to compile in the Bluetooth subsystem I got the following
error:

net/built-in.o: In function `sock_init':
net/built-in.o(.text.init+0x5b): undefined reference to `bluez_init'
make: *** [.tmp_vmlinux1] Error 1

It seems like that I have missed some magic to understand, because
"wanrouter_init" is also not declared static. But for netfilter or
netlink init it seems to work this way. Can you please give me some
infos how to fix this the right way.

Regards

Marcel


2002-10-07 22:36:03

by Max Krasnyansky

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to compile in the Bluetooth subsystem

Marcel,

>@@ -345,7 +345,7 @@
> return 0;
> }
>
>-static void __exit bluez_cleanup(void)
>+void __exit bluez_cleanup(void)
> {
> hci_sock_cleanup();
> hci_core_cleanup();
>@@ -356,11 +356,9 @@
> remove_proc_entry("bluetooth", NULL);
> }
>
>-#ifdef MODULE
> module_init(bluez_init);
> module_exit(bluez_cleanup);
>
> MODULE_AUTHOR("Maxim Krasnyansky <[email protected]>");
> MODULE_DESCRIPTION("BlueZ Core ver " VERSION);
> MODULE_LICENSE("GPL");
>-#endif
This is wrong. If Bluetooth is compiled in, bluez_init() is called from
linux/net/socket.c. We have to change that to subsys_initcall.

Linus, please don't apply. We'll send correct patch later.

Thanks
Max





2002-10-07 22:34:10

by Marcel Holtmann

[permalink] [raw]
Subject: Re: [PATCH] Make it possible to compile in the Bluetooth subsystem

On Mon, 2002-10-07 at 23:28, Linus Torvalds wrote:
>
> On 7 Oct 2002, Marcel Holtmann wrote:
> >
> > but when I try to compile in the Bluetooth subsystem I got the following
> > error:
> >
> > net/built-in.o: In function `sock_init':
> > net/built-in.o(.text.init+0x5b): undefined reference to `bluez_init'
> > make: *** [.tmp_vmlinux1] Error 1
>
> This is a separate error, apparently because net/socket.c calls
> "blues_init()" if bluetooth is configured in.
>
> That shouldn't be needed at all, since the "init_module()" thing should
> take care of it. Please try just removing the bluez_init references from
> net/socket.c - that should fix the compile, and if all the ordering issues
> are ok, it should also work afterwards..

I started a clean build kernel without this code and it works. Thanks
for the info and a new patch follows.

Regards

Marcel