Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756890Ab2K0XqP (ORCPT ); Tue, 27 Nov 2012 18:46:15 -0500 Received: from us-mx3.synaptics.com ([12.239.217.85]:14737 "EHLO us-mx3.synaptics.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756507Ab2K0XqK (ORCPT ); Tue, 27 Nov 2012 18:46:10 -0500 Message-ID: <50B550C0.80506@synaptics.com> Date: Tue, 27 Nov 2012 15:46:08 -0800 From: Christopher Heiny Organization: Synaptics, Inc User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Dmitry Torokhov CC: Linus Walleij , Linux Input , Linux Kernel , Allie Xiong , Vivian Ly , Daniel Rosenberg , Alexandra Chin , Joerie de Gram , Wolfram Sang , Mathieu Poirier Subject: Re: [PATCH 4/4] Input: RMI4 - introduce rmi_module_driver() macro References: <1354008098-26346-1-git-send-email-dmitry.torokhov@gmail.com> <1354008098-26346-4-git-send-email-dmitry.torokhov@gmail.com> In-Reply-To: <1354008098-26346-4-git-send-email-dmitry.torokhov@gmail.com> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: AAAAAA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2491 Lines: 76 On 11/27/2012 01:21 AM, Dmitry Torokhov wrote: > This also allows us to cut down on the boilerplate code in the function > handler modules. I like this idea a lot. We'll adopt it. Thanks! Chris > > Signed-off-by: Dmitry Torokhov > --- > drivers/input/rmi4/rmi_f11.c | 13 +------------ > include/linux/rmi.h | 14 ++++++++++++++ > 2 files changed, 15 insertions(+), 12 deletions(-) > > diff --git a/drivers/input/rmi4/rmi_f11.c b/drivers/input/rmi4/rmi_f11.c > index dbb6060..8457ab4 100644 > --- a/drivers/input/rmi4/rmi_f11.c > +++ b/drivers/input/rmi4/rmi_f11.c > @@ -2756,18 +2756,7 @@ static struct rmi_function_handler rmi_f11_handler = { > #endif /* defined(CONFIG_HAS_EARLYSUSPEND) */ > }; > > -static int __init rmi_f11_module_init(void) > -{ > - return rmi_register_function_handler(&rmi_f11_handler); > -} > - > -static void __exit rmi_f11_module_exit(void) > -{ > - rmi_unregister_function_handler(&rmi_f11_handler); > -} > - > -module_init(rmi_f11_module_init); > -module_exit(rmi_f11_module_exit); > +module_rmi_driver(rmi_f11_handler); > > MODULE_AUTHOR("Christopher Heiny MODULE_DESCRIPTION("RMI F11 module"); > diff --git a/include/linux/rmi.h b/include/linux/rmi.h > index 8a74066..daca41b 100644 > --- a/include/linux/rmi.h > +++ b/include/linux/rmi.h > @@ -600,4 +600,18 @@ int rmi_register_phys_device(struct rmi_phys_device *phys); > void rmi_unregister_phys_device(struct rmi_phys_device *phys); > int rmi_for_each_dev(void *data, int (*func)(struct device *dev, void *data)); > > +/** > + * module_serio_driver() - Helper macro for registering a serio driver > + * @__serio_driver: serio_driver struct > + * > + * Helper macro for serio drivers which do not do anything special in > + * module init/exit. This eliminates a lot of boilerplate. Each module > + * may only use this macro once, and calling it replaces module_init() > + * and module_exit(). > + */ > +#define module_rmi_driver(__rmi_driver) \ > + module_driver(__rmi_driver, \ > + rmi_register_function_handler, \ > + rmi_unregister_function_handler) > + > #endif > -- Christopher Heiny Senior Staff Firmware Engineer Synaptics Incorporated -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/