Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758061AbcK2RXl (ORCPT ); Tue, 29 Nov 2016 12:23:41 -0500 Received: from mail-he1eur01on0102.outbound.protection.outlook.com ([104.47.0.102]:35048 "EHLO EUR01-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757904AbcK2RXF (ORCPT ); Tue, 29 Nov 2016 12:23:05 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=peda@axentia.se; Subject: Re: [PATCH V5] i2c: mux: pca954x: Add ACPI support for pca954x To: Tin Huynh , Mika Westerberg References: <1480414363-16318-1-git-send-email-tnhuynh@apm.com> CC: Wolfram Sang , , , , Loc Ho , Thang Nguyen , Phong Vo , patches From: Peter Rosin Organization: Axentia Technologies AB Message-ID: <8351922e-f006-da76-1b76-e850113d4e7a@axentia.se> Date: Tue, 29 Nov 2016 16:50:51 +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: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [217.210.101.82] X-ClientProxiedBy: AM4PR0101CA0036.eurprd01.prod.exchangelabs.com (10.167.254.46) To HE1PR0201MB2313.eurprd02.prod.outlook.com (10.168.145.148) X-MS-Office365-Filtering-Correlation-Id: 3cb22dcd-c587-4d60-c8ed-08d4186f81d7 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:HE1PR0201MB2313; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0201MB2313;3:X4ifbwiUta7MuVrk3IBzHlSpX59pGY4r8lKCPwvIgIg9ggg1E/8zv1r6hfHZRB5VtWOZaKf9kka3MuVqtekyvsipNJgaByK2ukuUvjUhTW3WCBRHCwOVN/KTcITT8aly0VAgMyKiC6TAczynMFgFAT7QZgRvs/luPN5M/hh+6F+e+gHG7LL2xc00c+jLkRhf6UmQti6Z/GJk+zx63CCJoQU2ntbKaAN2mWjdMvhs9lt9Pgf4TkjXUZNSSODlTb8DzfM75kRpGwZjtLOIYEw1AA==;25:DQppTOx3nQnfJsCuteU7dDDKFA2nMSl8/Nbv0e6Pg8FMfWQiDQF9x9ngPCqCwsdBDJI0xQE3dWOic+FcKd0gL9JO0PR96ffqGyicqsXj5zqkQJ5B+2mPMcOgETP7bgQdgHAHt3gkXhKNlR0ZUf8ryU4z5TTWilb1C3MEJDpzBgCwz9guYpnGZGHAZ4HmVoqcZzf6pW4z8mESgxFHm2do5Rwu7uS+xoOQ9TqVCHq791L2OynEkv8CqS8ZsPtoZut+Aq5OIgugwXJmtVYbZys7pV2JYIfqog8+dw1krh/K5QnqbhwgnzL9J1qhBXX4I3hDBz2KnnTWiN6NyNeCWRvnSC3YJa3lxmKtWQmArRFx3o7Ih3aLIJqamUTkxXko2V8aUIoics9zTRF3C9t9gnfBdMQA2yKdziLfsvXvZVUKx/ptC47tYAQUFRGrLcRWp/WdbPymI4beANuTSNT3Q8HA1w== X-Microsoft-Exchange-Diagnostics: 1;HE1PR0201MB2313;31:zAfRMFTPX6oQf7sRrelMftrqj6V6DH3LJIXGL+FnsRKmUEEksMuwMd3PMtgkPr6fbtt+EI+1B5DGSfWtSSX504kH7JNw7bijDbN9MtIepzjbXGsgjI0CH2TSFEZnZsyrHsRtq4fT2PJDoTJri/KxH54xlv5Mox9n0ifjIBWiauMUEk0QJ1mrWtBZRjKb2juVInELusIufzc2/tAqs8Xy5A/mL5brhGRwBWCYNOVYsPTV1anSptbulGxgqi595Omq83YbackEEsbBiaC8rDfvb8SFMEE+xPtFguCAc9FS2c4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(84791874153150); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6060326)(6040361)(6045199)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(6061324)(20161123564025)(20161123562025)(20161123560025)(20161123555025)(2016111802025)(6043046)(6072148);SRVR:HE1PR0201MB2313;BCL:0;PCL:0;RULEID:;SRVR:HE1PR0201MB2313; X-Microsoft-Exchange-Diagnostics: 1;HE1PR0201MB2313;4:MFndvrwU5hJNDffs9xaGUFxqyu7xjM6zjpm3BYV5Wojj5ASbZ3EyCUoVFrjoBpnf01La0+bzE8/jrYGvpiyybW6B7Rsc10qKzZPwrSByx1f4VFN4UkBgg16rgdwKEMqPOPivo0Ec7GHhejQlCBvTqYAmBnR25Itv3aUvO4z8qlaPceK6Cbn86NRLyWVowpvRoDO0XwU6DQlS7bN1NykU59LewwTHPrvKi2Q2K8o33j/WHIOVHrunG9OhIg3Kfr4uUIxPx1Fw0Et5eQjk8DMgQxCJfrZcb2n12Li/ZMOazFVgVmzk9awU9VMUBIbBHNMYIQyTlrtspF/aCu6kRa+Z1GdtTjzZ+jnlUGhp0xlomtTZ+TTYNuUjqVDq1boZVbI728roUSJC7xUTM9vul0yQVoFMvBX5nipOcyK2XBDrScC5lDf5+dI01jCzVixxVJ3ivtXgtU5pCXZvENmQhT3o1qlskSU7Man6vbMUa1u96UKJAgGu7iyhS5fUsNNQMfC/PlsGjYOSFuWwcsxHC5TLRhCAyF1Zj4VcTymi8zgdTt6qEbEHjoR1UgfhKp+I3h7oBwdFUzDp411siDzwLdFN4rRmTbLZ5PGp/3bCwlZRQocNAXJYmHma8Ig1W6VPsqLfdi4fXOjEWG+b9kesda3CXvT1iAZ5JTjg+PkeKuYKef1HLLjzZGaw9DM6PlMQPtAJKZNjbHnv/pC3SFDysIazCzHMLf6p0+QP0jWv5aakn94= X-Forefront-PRVS: 01415BB535 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6049001)(6009001)(7916002)(199003)(377454003)(189002)(377424004)(52314003)(24454002)(101416001)(229853002)(23676002)(6116002)(38730400001)(4001150100001)(81166006)(230700001)(4326007)(74482002)(3846002)(8676002)(575784001)(86362001)(81156014)(47776003)(4001350100001)(39380400001)(65806001)(97736004)(5001770100001)(39450400002)(733004)(2906002)(39410400001)(6486002)(39400400001)(83506001)(77096006)(7736002)(305945005)(65956001)(66066001)(36756003)(189998001)(7846002)(7416002)(92566002)(31686004)(54356999)(42186005)(76176999)(50986999)(5660300001)(105586002)(106356001)(68736007)(6666003)(65826007)(31696002)(64126003)(2950100002)(50466002)(117156001)(33646002)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:HE1PR0201MB2313;H:[192.168.0.125];FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtIRTFQUjAyMDFNQjIzMTM7MjM6TlZzekdkbDB6TDFrS1UycGJ6K1BKVzM4?= =?utf-8?B?Z2NXa2Ezay9ZN2lQNU5NNktsdUM3cFpnRnJaMVRGc0JDMzFJa0EwT0xLSExn?= =?utf-8?B?S1ZVRGgxZXhCOHVvajhYbkIyNWdiZlhJb3VnTmF5QkFjamlTNE5ENjF0cDNE?= =?utf-8?B?WE9GVWpYYjk2RkRvMTlYVWIvdTdFT1BMWDcraVUvNlNqdkdzRlE3eFNqQjRn?= =?utf-8?B?b29tNVFFVGwxNTNaay9mM0piY2g0K0hYUExNK2hMRDlPWTlaV3E3ei9CZXpi?= =?utf-8?B?NWZxM1FBWXU3Y1cybGJxdXl2eFZVbm13RFJTWlNSWjMwUktqOTNCUXM4Qk5v?= =?utf-8?B?SmU3QkkxVEovMkQ1S1RUb3VxcU13bGE2VGtqUlJDQ2ZBVFdlM29GSWxXbnRx?= =?utf-8?B?ZVlIUC9IdTB0bXVRNnRuZEVpNG85bGVadTYwNnRIaUh4bkJlenpnNlJ2cVBq?= =?utf-8?B?bWJ5Sy9uUFZsYnRjSFM4Z1dCRWYrQUs1WFRadDJiTXQrbzdjVUFnR0tpZjFa?= =?utf-8?B?RFZHcXg3SGFvRTE2d3EwMnphUEhpWWdweE9CbEdxWkpxZ1duQUNNaEVSbmlZ?= =?utf-8?B?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/kCuqQsaAFdbe+2A== X-OriginatorOrg: axentia.se X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2016 15:50:55.3251 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0201MB2313 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1897 Lines: 48 On 2016-11-29 16:12, Tin Huynh wrote: > On Tue, Nov 29, 2016 at 5:15 PM, Peter Rosin wrote: >> On 2016-11-29 11:12, Tin Huynh wrote: >>> This patch enables ACPI support for mux-pca954x driver. >> >> Looks good, thanks! >> >>> Signed-off-by: Tin Huynh >> >> Acked-by: Peter Rosin >> >> Cheers, >> Peter >> > Added Mika > However , in http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpio/gpio-pca953x.c?id=f32517bf1ae0a2de72b3f27200233bd3ad65bfeb > log , i didn't see the CONFIG_ACPI and CONFIG_PTR. > I have been acked with the same patch to support for i2c-leds ( > without CONFIG_ACPI) > About logic , if we don't enable CONFIG_ACPI , acpi_match_table will > be NULL . So , the probe functions will be not called > and nothing happens. > I though we should use V3 (https://lkml.org/lkml/2016/11/28/893) > V3 will work, but you waste resources (not much, but still) for the ACPI table even though it is never going to be used, so it's best to #ifdef it out. (At least I think so, but maybe GCC sees that the variable isn't really used for anything useful and manages to kill it off? Anyway, I'm assuming that there really are resources wasted if you don't do the #ifdef...) But the thing is that you do not want a bunch of #ifdefs *in* the code. It's ok to #ifdef out a variable, but not *in* the code. That way lies madness. So the code is going to have a call to acpi_match_device(). If CONFIG_ACPI isn't set, that function compiles to an inline function simply returning NULL, but the compiler still evaluates its args and complains if the above variable is not found, which it isn't since it's #ifdef out. So, we need to "hide" the variable if it doesn't exist, using the ACPI_PTR macro. For gpio-pca953x, the same reasoning can be used, but the resource waste is even less in that case. Cheers, Peter