Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756323AbcK2H2A (ORCPT ); Tue, 29 Nov 2016 02:28:00 -0500 Received: from mail-db5eur01on0090.outbound.protection.outlook.com ([104.47.2.90]:11677 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754538AbcK2H1y (ORCPT ); Tue, 29 Nov 2016 02:27:54 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Subject: Re: [PATCH V3] i2c: mux: pca954x: Add ACPI support for pca954x To: , Wolfram Sang References: <1480391189-1775-1-git-send-email-tnhuynh@apm.com> CC: , , , Loc Ho , Thang Nguyen , Phong Vo , From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <07dfd83e-e878-fae6-6a9d-8a9678235744@axentia.se> Date: Tue, 29 Nov 2016 06:55:52 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0 MIME-Version: 1.0 In-Reply-To: <1480391189-1775-1-git-send-email-tnhuynh@apm.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: HE1PR0401CA0034.eurprd04.prod.outlook.com (10.166.116.172) To DB6PR0201MB2309.eurprd02.prod.outlook.com (10.169.222.148) X-MS-Office365-Filtering-Correlation-Id: bfdbb7f9-cd29-4830-1c29-08d4181c6402 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB6PR0201MB2309; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;3:YXgDGXaIfzOH31PxNasVYYqa45RaiTfEY3oTzGF0HOjdDBabLmXiiphTGivlg2oN1PkxboxybZMTBg0pOl9PRaPMWJhIL0pEnYrx2b3VOpsyrwwyQU5z+wSDfbuoLLnhFPzqg45M8/QsFCCDf7K0JWl/uVDf3kMc6JrDbrJ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G2NoqXRkCtiazmySj70pvXsHHlAiKpMtKGEdTVqwc0a8IgsUlm7WTGeUxxNKJ02hsMcmVXWsWd/fZcptbAwtT6dPCsF0o4+Lp9E205IiTz3aM5rhsCrD1N8KYvhS6UTWtuQFbhcWBH+2tAnSEo= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6045199)(6040361)(6060326)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(6061324)(20161123555025)(20161123560025)(20161123564025)(2016111802025)(20161123562025)(6043046);SRVR:DB6PR0201MB2309;BCL:0;PCL:0;RULEID:;SRVR:DB6PR0201MB2309; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;4:o5HrnmpiQ9oGd56bSmCuYlAA+oKAEBSh0bm7wLDsBVBhvSIncmQk7mZD38ZVlSzjlZpHglMdtU7p6+Xm/14JXKh0TB31t/XVfdbLqC4QiL+tHIc2/oEWbAMkXUU3u+45LfRtTdthe+bFubIyydTwypVcU1Fq1rirEuIkH2FtJ5qEqNXnWy9iQDwMXa3Ht4vkCmVo3i+/HUKLgvoW9uvyOjqwy3tX/lKWr5k1MIjaOiuAkrb0KuK6JgPuqjj6SZ/R8prr4Ht91ug6CtrhDRHJ2w2pXYphbu6JK651nBqcuTid0c3SuqGu5bWRFbshM3sTM/eESKr508U/0XatZT0Tf6a3l1PInUTJznuDfa+omOf7+9u4I79ZOTDQS0BdQkQ8+U8Hb3/+xbPz1mMMLi1UHxbuRLgVv5G6x8GYRxBNu3aV4bJHzYpobKFOvzy39IBGlid2kLVoPKpVetdYQP0YYI/fdUNV6nLmiTOYGyFTzAL0/0Wv8iBmdPOz6ymKUdUaZJ7MPmsqqzztGOPTwIi5fwTN4P4peJtJJMP2vqJ9kTswg6qUfi/WZpqiKwRRjUKaeJeWNbnR6457e7RmPqlPdeV+z4UmvycB2rBLPqOrdM67siiMX6Ck+zozUGA0Qc+9Imm0ito6m8uicmsfCzOAP73+vAFCdRnQG84CcT/VAuQ= X-Forefront-PRVS: 01415BB535 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(189002)(377424004)(24454002)(199003)(74482002)(6116002)(68736007)(230700001)(4326007)(3846002)(733004)(39400400001)(2906002)(39450400002)(6486002)(47776003)(101416001)(39410400001)(4001350100001)(189998001)(50986999)(92566002)(4001150100001)(117156001)(33646002)(54356999)(76176999)(97736004)(39380400001)(65956001)(64126003)(65806001)(86362001)(23746002)(229853002)(105586002)(65826007)(5001770100001)(66066001)(5660300001)(36756003)(106356001)(8676002)(7846002)(77096006)(2950100002)(31686004)(7736002)(38730400001)(83506001)(42186005)(305945005)(6666003)(81156014)(81166006)(31696002)(50466002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0201MB2309;H:[192.168.0.125];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0201MB2309;23:lxVUaiHlV/dd1o066CMAZVDVQKMGkkPYIw7?= =?Windows-1252?Q?UMmbVSIaREmGope7hgbJ5fVkEvITGexWKwmdeXR1mrX0pfxtJmbGVrgo?= =?Windows-1252?Q?QumOfP/QWLGcHOhGBaAlE+B+sQjTqo6tbOyl8I8V1u2NNhQ+wc1wt/6z?= =?Windows-1252?Q?dodoboUvOrJo6JPpyefEbOstyBdYi4A82lxm2QP3NY7RaRnXvUw21cZm?= =?Windows-1252?Q?pFb7iStPa+ZVXAFcI8HczOKggftN16HSL7g+Xl4zThWwozAhpWKyLskY?= =?Windows-1252?Q?a15aef7hhFXaXZEBKvyhFysqG4hXHb7rbtSWETZPxKd88kZEF91DOQ9c?= =?Windows-1252?Q?pL5NrDm03gIT5YkMzB4/QI1s2LqQU0UKOwWQaCjHWxBE7aqhe6bHYeUH?= =?Windows-1252?Q?hVx3aEDIKyxGmm7Fmm5kdG2iGa7VHdXtRJ3zD+DnI6TLyjNiSjVTM7z2?= =?Windows-1252?Q?zOhJDGWEQ3cviSSNYiw3CREJAtf0ZCXwomQ70skbvuOqG85fhB7VRClN?= =?Windows-1252?Q?tRPpXa4ZksrPEFFItm0Urb/QiPkAPJG9OnQGxuD++LA1WxAkejgFTfyi?= =?Windows-1252?Q?tP4C85yMyHC4MV8kCDMs3/aiUQrSKF7BlGsbkAPeK3nD1TAoVTVosW96?= =?Windows-1252?Q?BnWiOkTikWWQR0+dSeTW3QWP7lH0O/FfIdGWLL2zf0qoVjY37NDllWiF?= =?Windows-1252?Q?RccdYCkpPEuU9aNjjZcvnqoERJaBRrcgsccAhbEk+MG4RRsvaVczdOQZ?= =?Windows-1252?Q?om5/ExCODuk5qr8xsqz7Vq+CaV5ik2GgLTtZDamgsgt2yLN81AHAz5BS?= =?Windows-1252?Q?MhRaU1CPS0DWI8JOTJ8ln1j6HLxP0++N0TF1+CBFvNFH7AeFmEZLPc7e?= =?Windows-1252?Q?WVVsMTeQU1MFFbWiM/wHltEM6NU283sn/TGpqTcr90d/Wmj4qMJ+zhcx?= =?Windows-1252?Q?ZqHcFJPCIzLYvf2i2uoI9LjqBD+0h30BMrl42GTeCAFupagVYdD3RpCw?= =?Windows-1252?Q?1YZcYAVIWfN6mJFXLhWsukeMRh4HS9PBLuhHyRHlTxru2/lU0TMQJunz?= =?Windows-1252?Q?hubiPgyCx6HVSW30SK+B7bSNC+OX/ZuTCYOKq6NbpMv8O9o2yrmA7b4a?= =?Windows-1252?Q?LI2QXQgV0ukV6k22Y3KoU8ufZf6kIabi2md4JfnDUY78ECteW6/9fvlG?= =?Windows-1252?Q?HMtBiMnqxTudPeWs4ASDQvDFoyvLQQSY8IbHIzRzbhKLGkbvsx55Cu3q?= =?Windows-1252?Q?g0SVY9nvy3ftkFz21iDRMwkFZU+tzCy7caPAlA9gwWnwIxGrd6/grutU?= =?Windows-1252?Q?AjFOFQk/XHFfyTHU3fmbv+MCX0elRmth+zJTrE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bvUxwKP2QEpv+5bPZ0vEMzo8DiaZhJgzZRKju1v0h7IIpG13A3y2X1zfyT4oCnWHnwoDCzMGNNujn3nSXHSFSnDk2LY5DLPw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;7:dippbvilki/uiqq5SbyLOzf9M0P6EB2Grv3t9PCTYN8UXsrKzgTmIxOjXf/6c+SjPq/VWW1WsZL50q3Dg/ggggIUMuJ8z7oRA5LEJ3XfZXZipbPejlfmqC+CZXQfpVI7t9gs6zQKF9I0AOvR503X7f0xwmIPYfIIeTBs6z4vyorzbibSf1dcZtld+q8nNBUUwt+r8v0omV6ETwfcrWS/MJqb1DopqP7C1P82jzI5WpzBE290zoEAts1dZKGMxd6jQEurMg2YeZXur5+J5d3hUp1DEtlENu318+QaWw0SfkPAt1H2EuJ+pnWiffgKjOByoBJKZuTBvrwGakQ/g6CdomF1fNaeBWE2X9OAdKHRfzCMMng1Hnu7hoED0Q11QbytN7DfNW4w8GV/bk3XKCR1RIGe8w5EhOm8MxizFdYuITCBg2EnMyJh7D6X0Mxlm+BTrns1VZMN4mXP21Svx2HI9g== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2016 05:55:57.0013 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0201MB2309 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2826 Lines: 98 Hi! We're apparently misunderstanding each other, I meant only that last #ifdef in the v2 review... Sorry for not being clearer, new attempt below. Cheers, Peter On 2016-11-29 04:46, tnhuynh@apm.com wrote: > From: Tin Huynh > > This patch enables ACPI support for mux-pca954x driver. > > Signed-off-by: Tin Huynh > > --- > drivers/i2c/muxes/i2c-mux-pca954x.c | 25 ++++++++++++++++++++++++- > 1 files changed, 24 insertions(+), 1 deletions(-) > > Change from V2: > -Remove CONFIG_ACPI. > > Change from V1: > -Don't shadow id variable. > -Include sorted header. > -Redefine acpi_device_id. > -Add CONFIG_ACPI. > > diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c > index 1091346..f80191e 100644 > --- a/drivers/i2c/muxes/i2c-mux-pca954x.c > +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c > @@ -35,6 +35,7 @@ > * warranty of any kind, whether express or implied. > */ > > +#include > #include > #include > #include > @@ -120,6 +121,19 @@ struct pca954x { > }; > MODULE_DEVICE_TABLE(i2c, pca954x_id); > #ifdef CONFIG_ACPI > +static const struct acpi_device_id pca954x_acpi_ids[] = { > + { .id = "PCA9540", .driver_data = pca_9540 }, > + { .id = "PCA9542", .driver_data = pca_9540 }, > + { .id = "PCA9543", .driver_data = pca_9543 }, > + { .id = "PCA9544", .driver_data = pca_9544 }, > + { .id = "PCA9545", .driver_data = pca_9545 }, > + { .id = "PCA9546", .driver_data = pca_9545 }, > + { .id = "PCA9547", .driver_data = pca_9547 }, > + { .id = "PCA9548", .driver_data = pca_9548 }, > + { } > +}; > +MODULE_DEVICE_TABLE(acpi, pca954x_acpi_ids); #endif > + > #ifdef CONFIG_OF > static const struct of_device_id pca954x_of_match[] = { > { .compatible = "nxp,pca9540", .data = &chips[pca_9540] }, > @@ -245,8 +259,16 @@ static int pca954x_probe(struct i2c_client *client, > match = of_match_device(of_match_ptr(pca954x_of_match), &client->dev); > if (match) > data->chip = of_device_get_match_data(&client->dev); > - else > + else if (id) > data->chip = &chips[id->driver_data]; > + else { > + const struct acpi_device_id *acpi_id; > + > + acpi_id = acpi_match_device(pca954x_acpi_ids, &client->dev); acpi_id = acpi_match_device(ACPI_PTR(pca954x_acpi_ids), &client->dev); > + if (!acpi_id) > + return -ENODEV; > + data->chip = &chips[acpi_id->driver_data]; > + } > > data->last_chan = 0; /* force the first selection */ > > @@ -321,6 +343,7 @@ static int pca954x_resume(struct device *dev) > .name = "pca954x", > .pm = &pca954x_pm, > .of_match_table = of_match_ptr(pca954x_of_match), > + .acpi_match_table = ACPI_PTR(pca954x_acpi_ids), > }, > .probe = pca954x_probe, > .remove = pca954x_remove, >