linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: trenn@suse.de
Cc: linux-kernel@vger.kernel.org, openipmi-developer@lists.sourceforge.net
Subject: Re: [patch 1/3] ipmi: Setup ipmi_devintf automatically if ipmi_msghandler gets loaded
Date: Tue, 14 Oct 2014 20:22:20 -0500	[thread overview]
Message-ID: <543DCC4C.3090404@acm.org> (raw)
In-Reply-To: <20141014144315.178850163@d46.suse.de>

On 10/14/2014 09:40 AM, trenn@suse.de wrote:
> This removes the ipmi_devintf to be a module, but it will automatically
> compiled in if ipmi_msghandler is set.
>
> ipmi_msghandler module is renamed to ipmi_handler because of the name
> clash with the ipmi_msghandler.o object file (see Makefile for details).
> Alternatively ipmi_msghandler.c could be renamed to ipmi_handler.c, but
> not polluting git history should be more of an advantage than module renaming.
>
> cleanup_ipmi_dev() and init_ipmi_devintf() implemented in ipmi_devintf.c
> are are simply declared ipmi_msghandler.c without creating a separate header
> file which looks more reasonable to me. Hope that is ok.

One minor style issue: the function definitions should really be in a .h
file.

Renaming the module is also probably a bad idea.  If this was to go in,
it would certainly need to keep the ipmi_msghandler.ko name to avoid
complete breakage all over the place.

In that vein, I am worried that this would just result in a lot of work
for all the
distros that have set up this already.  I'm trying to see the pros and
cons of
this, and I can't see that the pros outweigh the cons.  Do you have people
that have issues with this?

Does anyone else care about this?  Unless I hear from some people that
the way it is causes issues, I don't think I can let this in.

>
> In fact there already was a kind of autoloading mechanism (gets deleted
> with this patch). I interpret this line that ipmi_devintf should get
> autoloaded if ipmi_si gets loaded?:
> -MODULE_ALIAS("platform:ipmi_si");
> But:
>   - It's wrong: There are other low lever drivers which can be used by
>     ipmi_devintf
>   - It does not work (anymore?)
>   - There is no need to keep ipmi_devintf as a module (resource and load time
>     overhead)

This change is certainly a good idea.  Whatever it was trying to do is
wrong.

-corey

>
> Signed-off-by: Thomas Renninger <trenn@suse.de>
> CC: minyard@acm.org
> CC: martin.wilck@ts.fujitsu.com
>
> Index: kernel_ipmi/drivers/char/ipmi/Kconfig
> ===================================================================
> --- kernel_ipmi.orig/drivers/char/ipmi/Kconfig
> +++ kernel_ipmi/drivers/char/ipmi/Kconfig
> @@ -8,6 +8,8 @@ menuconfig IPMI_HANDLER
>         help
>           This enables the central IPMI message handler, required for IPMI
>  	 to work.
> +	 It also provides userspace interface /dev/ipmiX, so that userspace
> +	 tools can query the BMC.
>  
>           IPMI is a standard for managing sensors (temperature,
>           voltage, etc.) in a system.
> @@ -37,12 +39,6 @@ config IPMI_PANIC_STRING
>  	  You can fetch these events and use the sequence numbers to piece the
>  	  string together.
>  
> -config IPMI_DEVICE_INTERFACE
> -       tristate 'Device interface for IPMI'
> -       help
> -         This provides an IOCTL interface to the IPMI message handler so
> -	 userland processes may use IPMI.  It supports poll() and select().
> -
>  config IPMI_SI
>         tristate 'IPMI System Interface handler'
>         help
> Index: kernel_ipmi/drivers/char/ipmi/Makefile
> ===================================================================
> --- kernel_ipmi.orig/drivers/char/ipmi/Makefile
> +++ kernel_ipmi/drivers/char/ipmi/Makefile
> @@ -4,8 +4,10 @@
>  
>  ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o
>  
> -obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
> -obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
> +obj-$(CONFIG_IPMI_HANDLER) += ipmi_handler.o
> +
> +ipmi_handler-objs := ipmi_msghandler.o ipmi_devintf.o
> +
>  obj-$(CONFIG_IPMI_SI) += ipmi_si.o
>  obj-$(CONFIG_IPMI_WATCHDOG) += ipmi_watchdog.o
>  obj-$(CONFIG_IPMI_POWEROFF) += ipmi_poweroff.o
> Index: kernel_ipmi/drivers/char/ipmi/ipmi_devintf.c
> ===================================================================
> --- kernel_ipmi.orig/drivers/char/ipmi/ipmi_devintf.c
> +++ kernel_ipmi/drivers/char/ipmi/ipmi_devintf.c
> @@ -928,7 +928,7 @@ static struct ipmi_smi_watcher smi_watch
>  	.smi_gone = ipmi_smi_gone,
>  };
>  
> -static int __init init_ipmi_devintf(void)
> +int __init init_ipmi_devintf(void)
>  {
>  	int rv;
>  
> @@ -964,9 +964,8 @@ static int __init init_ipmi_devintf(void
>  
>  	return 0;
>  }
> -module_init(init_ipmi_devintf);
>  
> -static void __exit cleanup_ipmi(void)
> +void cleanup_ipmi_dev(void)
>  {
>  	struct ipmi_reg_list *entry, *entry2;
>  	mutex_lock(&reg_list_mutex);
> @@ -980,9 +979,3 @@ static void __exit cleanup_ipmi(void)
>  	ipmi_smi_watcher_unregister(&smi_watcher);
>  	unregister_chrdev(ipmi_major, DEVICE_NAME);
>  }
> -module_exit(cleanup_ipmi);
> -
> -MODULE_LICENSE("GPL");
> -MODULE_AUTHOR("Corey Minyard <minyard@mvista.com>");
> -MODULE_DESCRIPTION("Linux device interface for the IPMI message handler.");
> -MODULE_ALIAS("platform:ipmi_si");
> Index: kernel_ipmi/drivers/char/ipmi/ipmi_msghandler.c
> ===================================================================
> --- kernel_ipmi.orig/drivers/char/ipmi/ipmi_msghandler.c
> +++ kernel_ipmi/drivers/char/ipmi/ipmi_msghandler.c
> @@ -4560,13 +4560,27 @@ static int ipmi_init_msghandler(void)
>  	return 0;
>  }
>  
> +void cleanup_ipmi_dev(void);
> +static void cleanup_ipmi(void);
> +int init_ipmi_devintf(void);
> +
> +
>  static int __init ipmi_init_msghandler_mod(void)
>  {
> -	ipmi_init_msghandler();
> +	int ret;
> +
> +	ret = ipmi_init_msghandler();
> +	if (ret)
> +		return ret;
> +	ret = init_ipmi_devintf();
> +	if (ret) {
> +		cleanup_ipmi();
> +		return ret;
> +	}
>  	return 0;
>  }
>  
> -static void __exit cleanup_ipmi(void)
> +static void cleanup_ipmi(void)
>  {
>  	int count;
>  
> @@ -4605,6 +4619,7 @@ static void __exit cleanup_ipmi(void)
>  	if (count != 0)
>  		printk(KERN_WARNING PFX "recv message count %d at exit\n",
>  		       count);
> +	cleanup_ipmi_dev();
>  }
>  module_exit(cleanup_ipmi);
>  
>


       reply	other threads:[~2014-10-15  1:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141014144020.683892494@d46.suse.de>
     [not found] ` <20141014144315.178850163@d46.suse.de>
2014-10-15  1:22   ` Corey Minyard [this message]
2014-10-17  7:49     ` [patch 1/3] ipmi: Setup ipmi_devintf automatically if ipmi_msghandler gets loaded Thomas Renninger
2014-10-17 16:14       ` Corey Minyard
2014-10-20  8:28         ` Wilck, Martin
2014-10-23  9:56           ` Thomas Renninger
2014-10-24 10:40             ` Wilck, Martin
2014-10-28 12:10               ` Thomas Renninger
     [not found] ` <20141014144315.519093022@d46.suse.de>
2014-10-15  1:26   ` [patch 2/3] ipmi: Remove ipmi_major module parameter and define global IPMI_MAJOR Corey Minyard
2014-10-17  7:55     ` Thomas Renninger
2014-10-17 16:21       ` Corey Minyard
     [not found] ` <20141014144315.728965695@d46.suse.de>
2014-10-15  1:27   ` [patch 3/3] ipmi: Unregister previously registered driver in error case Corey Minyard

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=543DCC4C.3090404@acm.org \
    --to=minyard@acm.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openipmi-developer@lists.sourceforge.net \
    --cc=trenn@suse.de \
    /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 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).