Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751540AbdFIH4I (ORCPT ); Fri, 9 Jun 2017 03:56:08 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:34820 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbdFIH4H (ORCPT ); Fri, 9 Jun 2017 03:56:07 -0400 MIME-Version: 1.0 In-Reply-To: <7ff6bd21-19f0-7e0c-18bf-e835e7d4319e@mentor.com> References: <1493142007-29347-1-git-send-email-geert+renesas@glider.be> <7ff6bd21-19f0-7e0c-18bf-e835e7d4319e@mentor.com> From: Geert Uytterhoeven Date: Fri, 9 Jun 2017 09:56:05 +0200 X-Google-Sender-Auth: 5tILJxRzkwk1dv5fdbCPnxqqmOE Message-ID: Subject: Re: [PATCH] of: Introduce of_node_get_match_data() helper To: Vladimir Zapolskiy Cc: Geert Uytterhoeven , Rob Herring , Frank Rowand , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v597uCff029943 Content-Length: 1761 Lines: 46 Hi Vladimir, On Fri, Jun 9, 2017 at 9:30 AM, Vladimir Zapolskiy wrote: > On 04/25/2017 08:40 PM, Geert Uytterhoeven wrote: >> If CONFIG_OF=n, code using >> >> info = of_match_node(matchs, np)->data; >> >> fails to compile: >> >> warning: dereferencing ‘void *’ pointer >> error: request for member ‘data’ in something not a structure or union > > IMHO firstly all the cases like one above must be fixed in place, in > parallel do an overall conversion of subcases: > > - of_id = of_match_node(some_dt_ids, dev->of_node); > + of_id = of_match_device(some_dt_ids, dev); > >> Follow the example set by of_device_get_match_data(), and introduce a >> new helper of_node_get_match_data(). This will allow to increase >> compile-testing coverage later. > > Unfortunately the proposed of_node_get_match_data() is not so similar > to the of_device_get_match_data(), the latter one has only one input > argument in opposite to of_match_device(), which is truly convenient. Thanks to your comment, I realized I can just use of_device_get_match_data(). Hence I'd like to withdraw my patch. Background: I encountered this in a clock driver, which started life as a CLK_OF_DECLARE() driver, but ended up as a platform driver anyway. CLK_OF_DECLARE() drivers don't have a struct device to use, so the driver still used of_match_node() instead of of_match_device(). Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds