public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] w1: support auto-load of w1_bq27000 module.
@ 2014-11-07 23:32 NeilBrown
  2014-11-10  0:11 ` Евгений Поляков
  0 siblings, 1 reply; 4+ messages in thread
From: NeilBrown @ 2014-11-07 23:32 UTC (permalink / raw)
  To: Evgeniy Polyakov; +Cc: linux-kernel, GTA04 owners

[-- Attachment #1: Type: text/plain, Size: 2180 bytes --]



1/ change request_module call to zero-pad single digit
   family numbers.  This appears to be the intention of
   the code, but not what it actually does.

   This means that the alias created for W1_FAMILY_SMEM_01
   might actually be useful.

2/ Define a family name for the BQ27000 battery charge monitor.
   Unfortunately this is the same number as W1_FAMILY_SMEM_01
   so if both a compiled on a system, one module might need to
   be blacklisted.

3/ Add a MODULE_ALIAS for the bq27000.

Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/drivers/w1/slaves/w1_bq27000.c b/drivers/w1/slaves/w1_bq27000.c
index afbefed5f2c9..caafb1722783 100644
--- a/drivers/w1/slaves/w1_bq27000.c
+++ b/drivers/w1/slaves/w1_bq27000.c
@@ -88,7 +88,7 @@ static struct w1_family_ops w1_bq27000_fops = {
 };
 
 static struct w1_family w1_bq27000_family = {
-	.fid = 1,
+	.fid = W1_FAMILY_BQ27000,
 	.fops = &w1_bq27000_fops,
 };
 
@@ -111,7 +111,7 @@ module_exit(w1_bq27000_exit);
 
 module_param(F_ID, int, S_IRUSR);
 MODULE_PARM_DESC(F_ID, "1-wire slave FID for BQ device");
-
+MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_BQ27000));
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Texas Instruments Ltd");
 MODULE_DESCRIPTION("HDQ/1-wire slave driver bq27000 battery monitor chip");
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 592f7edc671e..181f41cb960b 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -727,7 +727,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 
 	/* slave modules need to be loaded in a context with unlocked mutex */
 	mutex_unlock(&dev->mutex);
-	request_module("w1-family-0x%0x", rn->family);
+	request_module("w1-family-0x%02x", rn->family);
 	mutex_lock(&dev->mutex);
 
 	spin_lock(&w1_flock);
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
index 0d18365b61ad..ed5dcb80a1f7 100644
--- a/drivers/w1/w1_family.h
+++ b/drivers/w1/w1_family.h
@@ -27,6 +27,7 @@
 #include <linux/atomic.h>
 
 #define W1_FAMILY_DEFAULT	0
+#define W1_FAMILY_BQ27000	0x01
 #define W1_FAMILY_SMEM_01	0x01
 #define W1_FAMILY_SMEM_81	0x81
 #define W1_THERM_DS18S20 	0x10

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH] w1: support auto-load of w1_bq27000 module.
  2014-11-07 23:32 [PATCH] w1: support auto-load of w1_bq27000 module NeilBrown
@ 2014-11-10  0:11 ` Евгений Поляков
  2014-11-10  0:32   ` NeilBrown
  0 siblings, 1 reply; 4+ messages in thread
From: Евгений Поляков @ 2014-11-10  0:11 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-kernel@vger.kernel.org, GTA04 owners

Hi

08.11.2014, 02:33, "NeilBrown" <neilb@suse.de>:
> 1/ change request_module call to zero-pad single digit
>    family numbers.  This appears to be the intention of
>    the code, but not what it actually does.
>
>    This means that the alias created for W1_FAMILY_SMEM_01
>    might actually be useful.
>
> 2/ Define a family name for the BQ27000 battery charge monitor.
>    Unfortunately this is the same number as W1_FAMILY_SMEM_01
>    so if both a compiled on a system, one module might need to
>    be blacklisted.
>
> 3/ Add a MODULE_ALIAS for the bq27000.
>
> Signed-off-by: NeilBrown <neilb@suse.de>

Looks good to me.
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>

Which tree should this patch use to get into the kernel?

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

* Re: [PATCH] w1: support auto-load of w1_bq27000 module.
  2014-11-10  0:11 ` Евгений Поляков
@ 2014-11-10  0:32   ` NeilBrown
  0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2014-11-10  0:32 UTC (permalink / raw)
  To: Евгений Поляков
  Cc: linux-kernel@vger.kernel.org, GTA04 owners

[-- Attachment #1: Type: text/plain, Size: 1172 bytes --]

On Mon, 10 Nov 2014 03:11:29 +0300 Евгений Поляков <zbr@ioremap.net> wrote:

> Hi
> 
> 08.11.2014, 02:33, "NeilBrown" <neilb@suse.de>:
> > 1/ change request_module call to zero-pad single digit
> >    family numbers.  This appears to be the intention of
> >    the code, but not what it actually does.
> >
> >    This means that the alias created for W1_FAMILY_SMEM_01
> >    might actually be useful.
> >
> > 2/ Define a family name for the BQ27000 battery charge monitor.
> >    Unfortunately this is the same number as W1_FAMILY_SMEM_01
> >    so if both a compiled on a system, one module might need to
> >    be blacklisted.
> >
> > 3/ Add a MODULE_ALIAS for the bq27000.
> >
> > Signed-off-by: NeilBrown <neilb@suse.de>
> 
> Looks good to me.
> Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
> 
> Which tree should this patch use to get into the kernel?

MAINTAINERS lists you as the maintainer, so I though you would know.

When is doubt: send to akpm .. or gregkh.
It looks like greg has more Signed-off-by's in drivers/w1 than akpm,
so I'll add your acked-by and send to him.

Thanks,
NeilBrown

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* [PATCH] w1: support auto-load of w1_bq27000 module.
@ 2014-11-19  3:04 NeilBrown
  0 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2014-11-19  3:04 UTC (permalink / raw)
  To: greg kh; +Cc: Evgeniy Polyakov, linux-kernel, GTA04 owners

[-- Attachment #1: Type: text/plain, Size: 2324 bytes --]



1/ change request_module call to zero-pad single digit
   family numbers.  This appears to be the intention of
   the code, but not what it actually does.

   This means that the alias created for W1_FAMILY_SMEM_01
   might actually be useful.

2/ Define a family name for the BQ27000 battery charge monitor.
   Unfortunately this is the same number as W1_FAMILY_SMEM_01
   so if both a compiled on a system, one module might need to
   be blacklisted.

3/ Add a MODULE_ALIAS for the bq27000.

Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: NeilBrown <neilb@suse.de>

---
Hi Greg,
 appreciate it if you could queue this up for whenever.

Thanks,
NeilBrown


diff --git a/drivers/w1/slaves/w1_bq27000.c b/drivers/w1/slaves/w1_bq27000.c
index afbefed5f2c9..caafb1722783 100644
--- a/drivers/w1/slaves/w1_bq27000.c
+++ b/drivers/w1/slaves/w1_bq27000.c
@@ -88,7 +88,7 @@ static struct w1_family_ops w1_bq27000_fops = {
 };
 
 static struct w1_family w1_bq27000_family = {
-	.fid = 1,
+	.fid = W1_FAMILY_BQ27000,
 	.fops = &w1_bq27000_fops,
 };
 
@@ -111,7 +111,7 @@ module_exit(w1_bq27000_exit);
 
 module_param(F_ID, int, S_IRUSR);
 MODULE_PARM_DESC(F_ID, "1-wire slave FID for BQ device");
-
+MODULE_ALIAS("w1-family-" __stringify(W1_FAMILY_BQ27000));
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Texas Instruments Ltd");
 MODULE_DESCRIPTION("HDQ/1-wire slave driver bq27000 battery monitor chip");
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 592f7edc671e..181f41cb960b 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -727,7 +727,7 @@ int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn)
 
 	/* slave modules need to be loaded in a context with unlocked mutex */
 	mutex_unlock(&dev->mutex);
-	request_module("w1-family-0x%0x", rn->family);
+	request_module("w1-family-0x%02x", rn->family);
 	mutex_lock(&dev->mutex);
 
 	spin_lock(&w1_flock);
diff --git a/drivers/w1/w1_family.h b/drivers/w1/w1_family.h
index 0d18365b61ad..ed5dcb80a1f7 100644
--- a/drivers/w1/w1_family.h
+++ b/drivers/w1/w1_family.h
@@ -27,6 +27,7 @@
 #include <linux/atomic.h>
 
 #define W1_FAMILY_DEFAULT	0
+#define W1_FAMILY_BQ27000	0x01
 #define W1_FAMILY_SMEM_01	0x01
 #define W1_FAMILY_SMEM_81	0x81
 #define W1_THERM_DS18S20 	0x10

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

end of thread, other threads:[~2014-11-19  3:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-07 23:32 [PATCH] w1: support auto-load of w1_bq27000 module NeilBrown
2014-11-10  0:11 ` Евгений Поляков
2014-11-10  0:32   ` NeilBrown
  -- strict thread matches above, loose matches on Subject: below --
2014-11-19  3:04 NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox