Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755508AbcK2H1X (ORCPT ); Tue, 29 Nov 2016 02:27:23 -0500 Received: from mail-db5eur01on0139.outbound.protection.outlook.com ([104.47.2.139]:21787 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756243AbcK2H1O (ORCPT ); Tue, 29 Nov 2016 02:27:14 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Subject: Re: [PATCH V4] i2c: mux: pca954x: Add ACPI support for pca954x To: Tin Huynh , Wolfram Sang References: <1480403062-4115-1-git-send-email-tnhuynh@apm.com> CC: , , , Loc Ho , Thang Nguyen , Phong Vo , From: Peter Rosin Organization: Axentia Technologies AB Message-ID: Date: Tue, 29 Nov 2016 08:12:48 +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: <1480403062-4115-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: AM4PR0101CA0040.eurprd01.prod.exchangelabs.com (10.167.254.50) To DB6PR0201MB2309.eurprd02.prod.outlook.com (10.169.222.148) X-MS-Office365-Filtering-Correlation-Id: bf645c57-74fa-4b56-2c9a-08d41827222f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DB6PR0201MB2309; X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;3:fjQHSvp7oBBjvH88oXfxAXLCZpSMbkxsvgIQt0wmkWPCztIM7+63rQ+VRKIqiqs8OF1lo2Qfeg8BLhjfTGfr/vV1heVQNWFMEZel6Y0UaiPJcUslGRGpY+aB+FLMP0O+DY1pt/+HwNNxTZT3je1FvMuiqSL4dbhSfCGJJSwwkdOdGkXEOgp2/8NYFZkWX9T5SEQ4zGQkGt7XrPRzfg6yWv06NqjkydAvibsNsZ/qu65mlylDq3zz54Yw8FTVK/5N+oJLG847sHJs5ubZmw8smA==;25:TqQO+c12xpLQOyaczGn8Kpd8WDI3ZIFzLvwvc702II+luUxSeP/K0UgGJLv93a+/G/fcaXZAdtbd1OfsW3czyRMw1Faz5ijjqn2EqKc6ypHenDybClDlXRy/JVYdZuLcowZ0haRz1r4rPpHLzkdtfc2deoeXHUb8h8lMY6sxTrUzxZ9UsMfABcJKbDOvLN61YVWkpa66Vms/e25KtK/u+meu78qPZZbtU89xpP778CFYLjot3etYcKkGYbasAB1suPON8uFP4aMa5LulAkh9JT3kN3cW9+o9gzkGnMpIvcESKVVNvjgCbMWt240uA99ScJ4DG8yzOdx+wz9+iePaMxO9tKOkXc2Qt/cc5RaMT+AaNkIxq0xTS2gMDIA/TrZ0+6qWKCuUvvpweK3aJjcwAKO2dhoehiorgCqsi/kMO2j1Qo3e/W2eHo0gc3KyOqMt8YgkBTsjepJ+xk19MWZy0w== X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;31:6IaS4YLwkWtzQVCiQvC7DX1JJpurJ4hoTwK2zwCI92AnlOWBwDAV/09jsVJNFfPVhDo9Xu4JCv+7FcyrcNc82o7aiMN8UOywRvZHwhbBNIHBwrCNdc7cEIfnihftKdib/D10SZaBH5i9Ti/1DzNTCHu+dAHC0ikMlSqZudIA1TXk68PMSV9bMKUGdT+tUFGybtfcLLxGBh8EH0FDSG0kYXmhQmc+ruZhs0+W/+5UGdcCJywDscmf7A57BFGRBjxL35FLd1pVRySPsMNcpB6esw== 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:OTFuzwusazpuJ/wWv4+ihZGdrF/sXV3OEQnhN+DLPeInORHnpCVGRIly6YK5uqmfZFtmqwYP99F8KkqZENhHpZmvkEHAoHL1W2oEKprKySsGka+OpH2BXfTV2Nr2gTvTYqNbU5vhhZeB5lcPgk14QfchtQSo+WUgHnCAeWcH4dVCbvmXHWvfyLzRd3gkFEfyzSt2U00ncWpl0uYkwJ7Ij/KzVm7KB/2To+frAgq94YnuCWgzDF5f0I/LDZmH9dHdzjBPTtlNXp89qV/MwqqU6sVFkJt66cl860MxDdZUv4QPocWM7OUNN0Ow34WAnq2kttpsMNBtKanAm98ybH+6CTHI+QYLk0nWivnlfUdq+KLrhN59b0dzdxI3MLmwW/GFF7jcRMZ77WDg8JxXiofY6V4gOsWwmLZQniMcZzaLDHmnYTIvCNx3ErIbPxyn0hIgCl01X6QABEnsnSQrqmp8nw/av4uR9wd7qcWWCUJWBCu1HykA+Au/6ATSahhmmF0ECJZFf5NbfAQW+iZDU89jr041y1Rk7GL7ESTMNQh1ZUeLaBUBMZ0zX2I1QNjf+aU5PVSWowgrg7C/B3GbpDd7d2zfIwRP4Y9xTlicTdOL1OS7EbWTqmUPn8VB2FLiKWxU7VwdtbsKt6LiTg6xRA79rtP0atZqEXUEi0jxmpmaV70= X-Forefront-PRVS: 01415BB535 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(377424004)(199003)(24454002)(189002)(5001770100001)(66066001)(65826007)(5660300001)(36756003)(86362001)(64126003)(65806001)(65956001)(23746002)(229853002)(105586002)(42186005)(305945005)(6666003)(83506001)(38730400001)(50466002)(31696002)(81166006)(81156014)(7846002)(106356001)(8676002)(77096006)(7736002)(31686004)(2950100002)(39400400001)(733004)(39450400002)(6486002)(2906002)(68736007)(74482002)(6116002)(3846002)(4326007)(230700001)(47776003)(33646002)(39380400001)(97736004)(76176999)(54356999)(189998001)(50986999)(92566002)(101416001)(39410400001)(4001350100001)(117156001)(4001150100001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:DB6PR0201MB2309;H:[192.168.0.125];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;DB6PR0201MB2309;23:IYGlJdiW7xEuagXrAIWL+5FazLz/1/l3PW6?= =?Windows-1252?Q?yS8PwMG+yaksWpQIexHRjrkZE/6/qfShlkduSO4Mw8IjJPBzpWTLudkG?= =?Windows-1252?Q?XkG1xWvVC9thVKrApLjm1GalKzQGsZil32aa2acPm8JHgJ1Nh4DW1KQX?= =?Windows-1252?Q?ncoPPQs8psz2KwaMRYtm8vrhO98dEFadzNxJLAt1Ucibm/bZV/MBIEgS?= =?Windows-1252?Q?+My8tNx4uyAYX/yARVk0pfayrGW+yevs5/zY75OIDpXzx5Os45E/K53P?= =?Windows-1252?Q?GgnYT2Cm73gmvhO6aSMC0SrYMgE3N9wXA0z2zcs5ZlGNfjFCAwLmW3tc?= =?Windows-1252?Q?ah9ZWmY3fovOXxKgd7hCLBWaqBQSUl7gBHXVgBVhjvwonDNbcefgbtrR?= =?Windows-1252?Q?FfYD1kxtVWDUKRsse3qz7Sb0kf0QqAM9qWf4i1g2xDYyTYAFOTaVcuub?= =?Windows-1252?Q?HQE2dvOceTg5QRqb+bVfGVMcPdGxCKh7m3iJda9x9/65k4YlMHsAeC4Z?= =?Windows-1252?Q?pxZBjjP/Rj3oSJcNzk1d30zWTG/t9E9twEO1pUlhBSDzH1GNQE7AOGRp?= =?Windows-1252?Q?7PR4CnfJCM/Y9BRoGmPnSQP7NPUXStBY8txWCmJjrEJZUBO/KxSlSH8r?= =?Windows-1252?Q?KHaAOctgBQQtL/n0u0qvyEq48t10L+JDXv1D3HYKN7P4UoTSRbIOeQ1M?= =?Windows-1252?Q?m2DSFVAHdg3KnC7oUvWdrnk/5QE+Rck50OvmesXPtuEU9zodktBqotqF?= =?Windows-1252?Q?Y5c8JRsTwVcGZMsseCJ9a5Mcb4r12QEr39Tcr6xsbuVHro8JosVdMEiw?= =?Windows-1252?Q?gKRrHoHC2INaukj1EMHootIAhuSDqAgi2WJOhrzn5E04JzS9+AEkmAaB?= =?Windows-1252?Q?+bnTjuSmXob58fE475AslaAm6T4byzDwKst8C32H8pCtoNu0QPfAJot7?= =?Windows-1252?Q?kjd/oz55m9EmMO8iT/gT7CeP996zxG9NAQSEQxMCSTKBp6k/U62HiTqx?= =?Windows-1252?Q?JTg47/cazFWSrewl/2f2/qtXE+h9FDg0lrpKHHqWgiw/4rBNvlO6dGmR?= =?Windows-1252?Q?v5oBPYvtZ75Z0GP07U4Q5celbQ1j2XmepTV8JVl7ZAK4//ta+vopHE7v?= =?Windows-1252?Q?FSRz9j8NE+qb+1B6Alg40O1bRtu4eUMpyPfKpIRRhMpoxXfjs3506Hnj?= =?Windows-1252?Q?o6XkMRjJzlOawIrG2k5nCuyQR8nIIzmMw6a/vWbNAOQrWvk+pmEle2DI?= =?Windows-1252?Q?st/nBFgTGUwqFwFDjuFxwsh8vREb2pQ/IigLZEBxreTjHhmHa1Lvml3c?= =?Windows-1252?Q?PU4htyQZbAsJgjU/W31UpFFl5iq5Fdth1E6Zw1XALZaTdQzSYSsTC7Lu?= =?Windows-1252?Q?gBFhqLE2GRph4/dFMtzonsuw5DXBpOXX+Jydoe++SvnWI6lmxYkIgcf0?= =?Windows-1252?Q?LOv+ftjnT9tg2cHGpLVaZtO/7NiDSsCYLiLIPYiE5v4zh0/e/nAD8r29?= =?Windows-1252?Q?abdP12wEszRhW2iwkRcG0Sd1yZz7zoxNLQ6VYQIetK0Zb8wS5rytzdfh?= =?Windows-1252?Q?4F47V6PkuuWvxwuZVjVb3ZQxveM+/8vaPC7UZKAzIwSBQFHl8cWn+JcP?= =?Windows-1252?Q?/pvhF8QJZb8Dhif3jZjAeXg0=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;6:+H4egs0dBYmmED2PxxA9C4xXDx9DVhFwVGkJG0ju7Rzs9hGqUBAbyEL3NGVGazdgCsZK7MKkgJcRa76q8RhN9PJtplapBbjh9HoBQe4merrOD45R8V0J5iWrdZPDNKSVhAu4c4AQYP/ahL8pKfrm2meA8OYWN6Z3y9DSMI5CYd4HBk/abyU1VYVZC8kBTmPBkcbBwNoAqlpd/64eQHyxkR6V9ZAoOqa8ZgpXNFbsj6uHb1B/ctNVg19pqCogFEpl4iZ/67smpi1k0i29opMFX0WRoi7g1krroF6dbnpMr04PlveEJnigNYk3rm+YorrXeYeixgEYVIRM/kR1FnTJbBbH8UKoaRK3HOe7UyiVFZXg7Lq1tEe/8pvlf8qs1HQttod5FHaLphMjI8rffEzZgu9dMZvl82RYrCduxcBZt5MGDlEZ6r9xghpgzjwYkbvy86T9e1XPBmom/Yc3G/qWRI9IP58r3FNxseRPvpInKc0=;5:69MoOJblsraZdE0s6j6ZKTQP5dYxCx/OrjWXp0cxrTmZFhDIp++JaCYnU0nJzt2DM6qyYoXuzoLnsc8XDRqkjr9VWRk6WkTw0IoKZmqC/LWTOTS980wTypm0yXeuggTApIiNGbr0wYd3hq7UTbXF7A==;24:m8iXcu/v1YHEJpDEwq+qdAnz6/YEKsOdOAVBpR5MRnrGP2teRQiEvMfxejVATVKvi1eT1vLgyzgf1oTNJU1uBV7tg6l4yZYOLdkk4eAFmbI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;DB6PR0201MB2309;7:hQTUlKsKtSChCvL8rycglKAHNwzJakJvDk8fhCHtACujDc4mQpAwJVrjUsMgamvy8gMUqYvAL+WLx7hctYNday/4fMB1eTuu3vI0pRV/H7ZV4NBPDFtS3M+gme8r4NPEi9bCTlj3pFLKCOo6a+0cu5ZGalZtbZkXlHvDhtmLInRfWMIHpK+GjgN+JJVxepCFFRpMVOCsrxSVUo52rxH0O8VXvITisklvfKk1tnBYfu+R7a+28YW7nhfh+taPmKOpWvu/sEKhQKKHnUCS6hYlh0sZVqTFlC7fOUo5Rytd1OMMkTjEW43kTMYFbbCgWca0HuMgYWmYfidsTZ2UTjh8Gfw539qeQfvCkFy4kWwgiU7Oki5A7vF2vQkQq5QGEVPS6DzCaA0DucNtvBWEJvdPdsUAGn4C5JutPTI14GNi0g3bZ8ZfPtX4YunNSyd/iOKanCwwg6UEuCVzN5VAGaDA4w== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2016 07:12:51.2712 (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: 2894 Lines: 96 On 2016-11-29 08:04, Tin Huynh wrote: > This patch enables ACPI support for mux-pca954x driver. > > Signed-off-by: Tin Huynh > > Change from v1 : > -Don't shadow id variable. > -Include sorted header. > -Redefine acpi_device_id. > -Add CONFIG_ACPI. > --- > drivers/i2c/muxes/i2c-mux-pca954x.c | 27 ++++++++++++++++++++++++++- > 1 files changed, 26 insertions(+), 1 deletions(-) > > Change from V3: > -Readd CONFIG_ACPI. > > 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..bdf4315 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,21 @@ 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 +261,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); You missed my note about this line in the v4 review, you need to use ACPI_PTR(pca954x_acpi_ids) here as well (instead of #ifdef-ing the whole block as you did in v3). Cheers, Peter > + if (!acpi_id) > + return -ENODEV; > + data->chip = &chips[acpi_id->driver_data]; > + } > > data->last_chan = 0; /* force the first selection */ > > @@ -321,6 +345,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, >