Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753065AbdLHJLw convert rfc822-to-8bit (ORCPT ); Fri, 8 Dec 2017 04:11:52 -0500 Received: from smtprelay03.ispgateway.de ([80.67.31.37]:57052 "EHLO smtprelay03.ispgateway.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753026AbdLHJLr (ORCPT ); Fri, 8 Dec 2017 04:11:47 -0500 Date: Fri, 8 Dec 2017 10:11:42 +0100 From: Lothar =?UTF-8?B?V2HDn21hbm4=?= To: Sinan Kaya Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org, timur@codeaurora.org, open list , linux-acpi@vger.kernel.org, Rob Herring , dmaengine@vger.kernel.org, Frank Rowand , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH V6 4/7] OF: properties: Implement get_match_data() callback Message-ID: <20171208101142.1ea9bc13@karo-electronics.de> In-Reply-To: <661cbe4d-ea33-3e84-b5f2-ab6517cbb135@codeaurora.org> References: <1512493493-6464-1-git-send-email-okaya@codeaurora.org> <1512493493-6464-5-git-send-email-okaya@codeaurora.org> <20171207141029.575c0a03@karo-electronics.de> <20171207162036.6a71a4f5@karo-electronics.de> <661cbe4d-ea33-3e84-b5f2-ab6517cbb135@codeaurora.org> Organization: Ka-Ro electronics GmbH MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Df-Sender: bHdAa2Fyby1lbGVjdHJvbmljcy5kZQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1306 Lines: 35 Hi, On Thu, 7 Dec 2017 12:50:50 -0500 Sinan Kaya wrote: > On 12/7/2017 10:20 AM, Lothar Waßmann wrote: > > Hi, > > > > On Thu, 7 Dec 2017 09:45:31 -0500 Sinan Kaya wrote: > >> On 12/7/2017 8:10 AM, Lothar Waßmann wrote: > >>>> +void *of_fwnode_get_match_data(const struct fwnode_handle *fwnode, > >>>> + struct device *dev) > >>> Shouldn't this be 'const void *of_fwnode_get_match_data > >> > >> OF keeps the driver data as a (const void*) internally. ACPI keeps the > >> driver data as kernel_ulong_t in struct acpi_device_id. > >> > >> I tried to find the middle ground here by converting output to void* > >> but not keeping const. > >> > > It should be no problem to cast a (const void *) to an unsigned long > > data type (without const qualifier). > > > > It is the other way around. If I change this API to return a a (const void*), > the device_get_match_data() function need to return a (const void *). > > While implementing the ACPI piece, I have to convert an unsigned long to > (const void *) in ACPI code so that the APIs are compatible. > Just one more remark: Do you need write access to the data the pointer returned by device_get_match_data() or of_fwnode_get_match_data() points to? If not, the return type of those functions should be 'const void *'. Lothar Waßmann