From patchwork Mon Jul 11 14:10:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: axel lin X-Patchwork-Id: 964982 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6BEAwig009791 for ; Mon, 11 Jul 2011 14:10:58 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757580Ab1GKOK5 (ORCPT ); Mon, 11 Jul 2011 10:10:57 -0400 Received: from mail-vx0-f174.google.com ([209.85.220.174]:35619 "EHLO mail-vx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757512Ab1GKOK4 (ORCPT ); Mon, 11 Jul 2011 10:10:56 -0400 Received: by vxb39 with SMTP id 39so2681792vxb.19 for ; Mon, 11 Jul 2011 07:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; bh=JPnVvrYNitM9LQaDMMDLxkEhi0ziKZEn1hgwf0NC9w4=; b=wlXSNYSSC3cxz72PIkOCjiPJ7HW8b1h30HBbX+QxgeRuF1buTDc5112DAt+z38KoM6 xNG8AgjV+1gvKN7NUmtb5Jfdlao3vpKo/9FDCcnA+AirzBF3vsM+BuYGmw1eznAYNdz5 KowPxhKMv13dzeQzyfuJTvCc+4Y1cCZmd/be0= Received: by 10.52.73.34 with SMTP id i2mr5589204vdv.166.1310393455649; Mon, 11 Jul 2011 07:10:55 -0700 (PDT) Received: from [218.172.225.204] (218-172-225-204.dynamic.hinet.net [218.172.225.204]) by mx.google.com with ESMTPS id a12sm76697vdu.35.2011.07.11.07.10.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 11 Jul 2011 07:10:52 -0700 (PDT) Subject: [PATCH 2/2] Input: lifebook - make dmi callback functions return 1 From: Axel Lin To: linux-kernel@vger.kernel.org Cc: Vojtech Pavlik , Alessandro Rubini , Dmitry Torokhov , linux-input@vger.kernel.org In-Reply-To: <1310393256.2415.2.camel@phoenix> References: <1310393256.2415.2.camel@phoenix> Date: Mon, 11 Jul 2011 22:10:48 +0800 Message-ID: <1310393448.2415.5.camel@phoenix> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 11 Jul 2011 14:10:58 +0000 (UTC) We only care about if there is any successful match from the table (or no match at all), we can make dmi_check_system return immediately if we have a successful match instead of iterate thorough the whole table. Make the dmi callback function return 1 then dmi_check_system will return immediately if we have a successful match. I think current implementation already assumes there is exactly one match or no match at all. If there are multiple successful matches then it is a bug, because new matches will override some variables such as lifebook_use_6byte_proto and desired_serio_phys. Signed-off-by: Axel Lin --- drivers/input/mouse/lifebook.c | 17 +++++++++++++++-- 1 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c index c31ad11..d21becb 100644 --- a/drivers/input/mouse/lifebook.c +++ b/drivers/input/mouse/lifebook.c @@ -30,10 +30,15 @@ static bool lifebook_present; static const char *desired_serio_phys; +static int lifebook_found(const struct dmi_system_id *d) +{ + return 1; +} + static int lifebook_limit_serio3(const struct dmi_system_id *d) { desired_serio_phys = "isa0060/serio3"; - return 0; + return 1; } static bool lifebook_use_6byte_proto; @@ -41,7 +46,7 @@ static bool lifebook_use_6byte_proto; static int lifebook_set_6byte_proto(const struct dmi_system_id *d) { lifebook_use_6byte_proto = true; - return 0; + return 1; } static const struct dmi_system_id __initconst lifebook_dmi_table[] = { @@ -50,42 +55,49 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = { .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"), }, + .callback = lifebook_found, }, { /* LifeBook B */ .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "Lifebook B Series"), }, + .callback = lifebook_found, }, { /* LifeBook B */ .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"), }, + .callback = lifebook_found, }, { /* Lifebook B */ .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"), }, + .callback = lifebook_found, }, { /* Lifebook B-2130 */ .matches = { DMI_MATCH(DMI_BOARD_NAME, "ZEPHYR"), }, + .callback = lifebook_found, }, { /* Lifebook B213x/B2150 */ .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"), }, + .callback = lifebook_found, }, { /* Zephyr */ .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"), }, + .callback = lifebook_found, }, { /* Panasonic CF-18 */ @@ -122,6 +134,7 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = { .matches = { DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"), }, + .callback = lifebook_found, }, { } };