All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@domain.hid>
To: Wolfgang Grandegger <wg@domain.hid>
Cc: xenomai-core <xenomai@xenomai.org>
Subject: [Xenomai-core] [PATCH] can: avoid naming conflict in 2.6.26
Date: Fri, 04 Jul 2008 20:38:21 +0200	[thread overview]
Message-ID: <486E6E1D.2020209@domain.hid> (raw)

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

Due to a global definition of 'clock' in latest 2.6.26, we now have a
problem with two rtcan drivers. Below is a fix that breaks those
drivers' user interface by rename the conflicting variable which
unfortunately also renames the module parameter name.

An alternative approach would be to add a kernel version dependent fix
to the drivers. That would be required as compat_module_param_array
cannot be extended to use a different parameter name than the related
variable is called. Maybe someone sees a third, better solution, I do
not.

Jan

Index: ksrc/drivers/can/sja1000/rtcan_isa.c
===================================================================
--- ksrc/drivers/can/sja1000/rtcan_isa.c	(Revision 4017)
+++ ksrc/drivers/can/sja1000/rtcan_isa.c	(Arbeitskopie)
@@ -47,19 +47,19 @@ MODULE_LICENSE("GPL");
 
 static u16 io[RTCAN_ISA_MAX_DEV];
 static int irq[RTCAN_ISA_MAX_DEV];
-static u32 clock[RTCAN_ISA_MAX_DEV];
+static u32 clock_freq[RTCAN_ISA_MAX_DEV];
 static u8 ocr[RTCAN_ISA_MAX_DEV];
 static u8 cdr[RTCAN_ISA_MAX_DEV];
 
 compat_module_param_array(io, ushort, RTCAN_ISA_MAX_DEV, 0444);
 compat_module_param_array(irq, int, RTCAN_ISA_MAX_DEV, 0444);
-compat_module_param_array(clock, uint, RTCAN_ISA_MAX_DEV, 0444);
+compat_module_param_array(clock_freq, uint, RTCAN_ISA_MAX_DEV, 0444);
 compat_module_param_array(ocr, byte, RTCAN_ISA_MAX_DEV, 0444);
 compat_module_param_array(cdr, byte, RTCAN_ISA_MAX_DEV, 0444);
 
 MODULE_PARM_DESC(io, "The io-port address");
 MODULE_PARM_DESC(irq, "The interrupt number");
-MODULE_PARM_DESC(clock, "External clock frequency (default 16 MHz)");
+MODULE_PARM_DESC(clock_freq, "External clock frequency (default 16 MHz)");
 MODULE_PARM_DESC(ocr, "Value of output control register (default 0x1a)");
 MODULE_PARM_DESC(cdr, "Value of clock divider register (default 0xc8");
 
@@ -116,8 +116,8 @@ int __init rtcan_isa_init_one(int idx)
 	}
 
 	/* Clock frequency in Hz */
-	if (clock[idx])
-		dev->can_sys_clock = clock[idx] / 2;
+	if (clock_freq[idx])
+		dev->can_sys_clock = clock_freq[idx] / 2;
 	else
 		dev->can_sys_clock = 8000000; /* 16/2 MHz */
 
Index: ksrc/drivers/can/sja1000/rtcan_mem.c
===================================================================
--- ksrc/drivers/can/sja1000/rtcan_mem.c	(Revision 4017)
+++ ksrc/drivers/can/sja1000/rtcan_mem.c	(Arbeitskopie)
@@ -55,19 +55,19 @@ MODULE_LICENSE("GPL");
 
 static u32 mem[RTCAN_MEM_MAX_DEV];
 static int irq[RTCAN_MEM_MAX_DEV];
-static u32 clock[RTCAN_MEM_MAX_DEV];
+static u32 clock_freq[RTCAN_MEM_MAX_DEV];
 static u8 ocr[RTCAN_MEM_MAX_DEV];
 static u8 cdr[RTCAN_MEM_MAX_DEV];
 
 compat_module_param_array(mem, uint, RTCAN_MEM_MAX_DEV, 0444);
 compat_module_param_array(irq, int, RTCAN_MEM_MAX_DEV, 0444);
-compat_module_param_array(clock, uint, RTCAN_MEM_MAX_DEV, 0444);
+compat_module_param_array(clock_freq, uint, RTCAN_MEM_MAX_DEV, 0444);
 compat_module_param_array(ocr, byte, RTCAN_MEM_MAX_DEV, 0444);
 compat_module_param_array(cdr, byte, RTCAN_MEM_MAX_DEV, 0444);
 
 MODULE_PARM_DESC(mem, "The io-memory address");
 MODULE_PARM_DESC(irq, "The interrupt number");
-MODULE_PARM_DESC(clock, "External clock frequency (default 16 MHz)");
+MODULE_PARM_DESC(clock_freq, "External clock frequency (default 16 MHz)");
 MODULE_PARM_DESC(ocr, "Value of output control register (default 0x1a)");
 MODULE_PARM_DESC(cdr, "Value of clock divider register (default 0xc8");
 
@@ -125,8 +125,8 @@ int __init rtcan_mem_init_one(int idx)
 	}
 
 	/* Clock frequency in Hz */
-	if (clock[idx])
-		dev->can_sys_clock = clock[idx] / 2;
+	if (clock_freq[idx])
+		dev->can_sys_clock = clock_freq[idx] / 2;
 	else
 		dev->can_sys_clock = 8000000; /* 16/2 MHz */
 


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

             reply	other threads:[~2008-07-04 18:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-04 18:38 Jan Kiszka [this message]
2008-07-07  7:32 ` [Xenomai-core] [PATCH] can: avoid naming conflict in 2.6.26 Wolfgang Grandegger
2008-08-13 11:04   ` Jan Kiszka
2008-08-16 22:15     ` Paul
2008-08-17  7:41       ` Wolfgang Grandegger
2008-08-17 22:38         ` Jan Kiszka

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=486E6E1D.2020209@domain.hid \
    --to=jan.kiszka@domain.hid \
    --cc=wg@domain.hid \
    --cc=xenomai@xenomai.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.