From: Jiri Slaby <jslaby@suse.cz>
To: Josh Boyer <jwboyer@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: 8250.nr_uarts broken in 3.7
Date: Sat, 09 Mar 2013 15:14:18 +0100 [thread overview]
Message-ID: <513B43BA.3000906@suse.cz> (raw)
In-Reply-To: <20130309133014.GQ13719@hansolo.jdub.homelinux.org>
On 03/09/2013 02:30 PM, Josh Boyer wrote:
> From: Josh Boyer <jwboyer@redhat.com>
> Date: Fri, 8 Mar 2013 21:13:52 -0500
> Subject: [PATCH] serial: 8250: Keep 8250.<xxxx> module options functional
> after driver rename
>
> With commit 835d844d1 (8250_pnp: do pnp probe before legacy probe), the
> 8250 driver was renamed to 8250_core. This means any existing usage of
> the 8259.<xxxx> module parameters or as a kernel command line switch is
> now broken, as the 8250_core driver doesn't parse options belonging to
> something called "8250".
>
> To solve this, we redefine the module options in a dummy function using
> a redefined MODULE_PARAM_PREFX when built into the kernel. In the case
> where we're building as a module, we provide an alias to the old 8250
> name. The dummy function prevents compiler errors due to global variable
> redefinitions that happen as part of the module_param_ macro expansions.
>
> Signed-off-by: Josh Boyer <jwboyer@redhat.com>
> ---
> drivers/tty/serial/8250/8250.c | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/drivers/tty/serial/8250/8250.c b/drivers/tty/serial/8250/8250.c
> index 0efc815..446beb7 100644
> --- a/drivers/tty/serial/8250/8250.c
> +++ b/drivers/tty/serial/8250/8250.c
> @@ -3396,3 +3396,34 @@ module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
> MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
> #endif
> MODULE_ALIAS_CHARDEV_MAJOR(TTY_MAJOR);
> +
> +#ifndef MODULE
> +/* This module was renamed to 8250_core in 3.7. Keep the old "8250" name
> + * working as well for the module options so we don't break people. We
> + * need to keep the names identical and the convenient macros will happily
> + * refuse to let us do that by failing the build with redefinition errors
> + * of global variables. So we stick them inside a dummy function to avoid
> + * those conflicts. The options still get parsed, and the redefined
> + * MODULE_PARAM_PREFIX lets us keep the "8250." syntax alive. We redefine
> + * __param_check to a throw away value to avoid type conflicts from the
> + * expansion that would happen otherwise.
> + *
> + * This is hacky. I'm sorry.
> + */
> +static void __used s8250_options(void)
> +{
> +#undef MODULE_PARAM_PREFIX
> +#define MODULE_PARAM_PREFIX "8250."
> +
> + module_param_cb(share_irqs, ¶m_ops_uint, &share_irqs, 0644);
> + module_param_cb(nr_uarts, ¶m_ops_uint, &nr_uarts, 0644);
> + module_param_cb(skip_txen_test, ¶m_ops_uint, &skip_txen_test, 0644);
> +#ifdef CONFIG_SERIAL_8250_RSA
> +#undef __param_check
> +#define __param_check(name, p, type) int __attribute((unused)) tmp
> + module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
Aiee, we havo no _cb for arrays. But we can do just:
__module_param_call(MODULE_PARAM_PREFIX, probe_rsa,
¶m_array_ops, .arr = &__param_arr_probe_rsa,
0444, -1);
> +#endif
> +}
> +#else
> +MODULE_ALIAS("8250");
This is so disgusting that I will do the following:
* ack your patch after you change the above (if that works)
* rename 8250.c to 8250_core.c
* change 8250_core.ko back to 8250.ko (ie. bring back the old module name)
* thus switch MODULE_PARAM_PREFIX above to "8250_core."
* deprecate all the newly added 8250_core.* params somehow and schedule
for removal. IMO this warrants a kernel config option like
CONFIG_8250_DEPRECATED_MODULE_PARAMS.
We have a lesson learned.
thanks,
--
js
suse labs
next prev parent reply other threads:[~2013-03-09 14:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-07 18:56 8250.nr_uarts broken in 3.7 Josh Boyer
2013-03-07 18:58 ` Josh Boyer
2013-03-07 19:07 ` Jiri Slaby
2013-03-07 19:10 ` Josh Boyer
2013-03-07 21:14 ` Josh Boyer
2013-03-07 23:12 ` Greg Kroah-Hartman
2013-03-08 1:01 ` Josh Boyer
2013-03-08 1:39 ` Greg Kroah-Hartman
2013-03-08 21:27 ` Josh Boyer
2013-03-08 22:47 ` Jiri Slaby
2013-03-08 22:49 ` Josh Boyer
2013-03-08 22:58 ` Jiri Slaby
2013-03-08 23:10 ` Jiri Slaby
2013-03-08 23:14 ` Jiri Slaby
2013-03-08 23:28 ` Josh Boyer
2013-03-08 23:44 ` Josh Boyer
2013-03-09 9:14 ` Jiri Slaby
2013-03-09 13:30 ` Josh Boyer
2013-03-09 14:14 ` Jiri Slaby [this message]
2013-03-09 17:02 ` Josh Boyer
2013-03-10 14:33 ` [PATCH v2] serial: 8250: Keep 8250.<xxxx> module options functional after driver rename Josh Boyer
2013-03-10 22:33 ` Jiri Slaby
2013-03-10 12:21 ` 8250.nr_uarts broken in 3.7 Sean Young
2013-03-08 23:11 ` Josh Boyer
2013-03-08 23:11 ` Josh Boyer
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=513B43BA.3000906@suse.cz \
--to=jslaby@suse.cz \
--cc=gregkh@linuxfoundation.org \
--cc=jwboyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.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.