Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp205190rwb; Wed, 28 Sep 2022 01:17:51 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6583dSYoonay/vR4nSrkRYy5e34IY3Ls4Oftg64p4/zg0k39kSD6lYZSkgEQQUlPH87jxK X-Received: by 2002:a05:6402:5189:b0:451:791e:f328 with SMTP id q9-20020a056402518900b00451791ef328mr31907180edd.282.1664353071627; Wed, 28 Sep 2022 01:17:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664353071; cv=none; d=google.com; s=arc-20160816; b=rm4zlFfgimWDl2RVByIEPmMNnAw1AaIRr8BWCndmxLKlFsRcRwq6XAPCCtfgPuSK5A j6nr/LXs0pXdsXhzsxBia5JQSUDcIJAo+AZt4m0DLQwQ//U1qJzdzvbgr67fLe4KGHAj VrYMewPTZ3hiFxbBwyKyV5jemN97QZbudYnIqW4J5V7oU0SVj6fwtAEnL9C6/JDNviuo ID7lzK6e4jZGFOLGbhG94gECCbBHcgCiX/SwMVLZTH2VolMsg6cttIpjNWY7WLn0vvZ1 9ZslkpR4EeeMjec09/gkVPwfuKThiADeL6xWRhTtYDk2HCjy/HQGcMviXZeQZVlqPDVL sIhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=XEiFCddhNm3q2UOLH3TNJQh3kLQOOpo/7ohe2RaYSDk=; b=JnYe874NpwApTpMn71hSxfYZ7SWyIIHzaJs+1vSMrZuSxHuZTFRJDYRHPg+I0V7p80 tL0762LYMBDzvgZSvKSBdDZK7eJFr5+bfKOeyQdJySA7/3b2q867uZJhQkSpSs2mhzsp xi9pNXZy5JZ8MNKSg5cxof6c1Bd7tFcX+3PgwVRuKg+ZUSxDXnVo0vqcfI1yRmrriySb Wdt9fsdIWSK1HUyUqUQQ7Z+3aZAb/SBKeGDczeQVAekllYCts+8sqM7UMNgStJ/BTOH5 oPolNzXbLkXhyyu91ULu4cjadjHxzHUp7JfBMxPvXCzFYUBbNBVp0YRMEWmFiwEpXQnb B2nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="UnvHMP/h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r22-20020a50c016000000b0044e73852b6asi3955381edb.133.2022.09.28.01.17.26; Wed, 28 Sep 2022 01:17:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="UnvHMP/h"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233702AbiI1Hhe (ORCPT + 99 others); Wed, 28 Sep 2022 03:37:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233701AbiI1Hg7 (ORCPT ); Wed, 28 Sep 2022 03:36:59 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E84A10B22D; Wed, 28 Sep 2022 00:36:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664350573; x=1695886573; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=p2mq9g0p0ey5aQ3uwN1EJXOqXSfkSPpw7+dExmRoAWc=; b=UnvHMP/hIdiSRAJAKoiUs8Oi314ZTepOeL3V5Z1fc1GQDOuXHr0qGEJf su7wc7ZbLQFuu7BlPj7uqH5Ihpm+a04uJu78aPJVC0nqXVJ2CWgjXqwEb 93/fJHGR9Q65KA8dq6qyfqSnaOH5EDeoWx41eiE9H4aQcUDeeDkA/CEou MmhefW+Eab+kqB/EOVeCvCEH8K+z45W+oBF/D3T8fnXL1QST13j/RW0vd 5bgwV71N24qq1VNBXX42SKL7SLuj0q9P6AoIo0EXOwntlV2cth1GC/CG0 1d0A4T6mMo2UGukNm1z/UIYJrcEpesuTvoMWQLBs7u/N+JpmPJO2dosmm w==; X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="281903370" X-IronPort-AV: E=Sophos;i="5.93,351,1654585200"; d="scan'208";a="281903370" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Sep 2022 00:35:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10483"; a="764186416" X-IronPort-AV: E=Sophos;i="5.93,351,1654585200"; d="scan'208";a="764186416" Received: from kuha.fi.intel.com ([10.237.72.185]) by fmsmga001.fm.intel.com with SMTP; 28 Sep 2022 00:35:47 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 28 Sep 2022 10:35:46 +0300 Date: Wed, 28 Sep 2022 10:35:46 +0300 From: Heikki Krogerus To: Andy Shevchenko Cc: Prashant Malani , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Daniel Scally , Sakari Ailus , Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: Re: [PATCH v1 1/5] device property: Keep dev_fwnode() and dev_fwnode_const() separate Message-ID: References: <20220927142822.4095-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220927142822.4095-1-andriy.shevchenko@linux.intel.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 27, 2022 at 05:28:17PM +0300, Andy Shevchenko wrote: > It's not fully correct to take a const parameter pointer to a struct > and return a non-const pointer to a member of that struct. > > Instead, introduce a const version of the dev_fwnode() API which takes > and returns const pointers and use it where it's applicable. > > Suggested-by: Sakari Ailus > Fixes: aade55c86033 ("device property: Add const qualifier to device_get_match_data() parameter") > Signed-off-by: Andy Shevchenko For the whole series: Acked-by: Heikki Krogerus > --- > drivers/base/property.c | 11 +++++++++-- > include/linux/property.h | 3 ++- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/drivers/base/property.c b/drivers/base/property.c > index 4d6278a84868..699f1b115e0a 100644 > --- a/drivers/base/property.c > +++ b/drivers/base/property.c > @@ -17,13 +17,20 @@ > #include > #include > > -struct fwnode_handle *dev_fwnode(const struct device *dev) > +struct fwnode_handle *dev_fwnode(struct device *dev) > { > return IS_ENABLED(CONFIG_OF) && dev->of_node ? > of_fwnode_handle(dev->of_node) : dev->fwnode; > } > EXPORT_SYMBOL_GPL(dev_fwnode); > > +const struct fwnode_handle *dev_fwnode_const(const struct device *dev) > +{ > + return IS_ENABLED(CONFIG_OF) && dev->of_node ? > + of_fwnode_handle(dev->of_node) : dev->fwnode; > +} > +EXPORT_SYMBOL_GPL(dev_fwnode_const); > + > /** > * device_property_present - check if a property of a device is present > * @dev: Device whose property is being checked > @@ -1202,7 +1209,7 @@ EXPORT_SYMBOL(fwnode_graph_parse_endpoint); > > const void *device_get_match_data(const struct device *dev) > { > - return fwnode_call_ptr_op(dev_fwnode(dev), device_get_match_data, dev); > + return fwnode_call_ptr_op(dev_fwnode_const(dev), device_get_match_data, dev); > } > EXPORT_SYMBOL_GPL(device_get_match_data); > > diff --git a/include/linux/property.h b/include/linux/property.h > index 117cc200c656..ae5d7f8eccf4 100644 > --- a/include/linux/property.h > +++ b/include/linux/property.h > @@ -32,7 +32,8 @@ enum dev_dma_attr { > DEV_DMA_COHERENT, > }; > > -struct fwnode_handle *dev_fwnode(const struct device *dev); > +struct fwnode_handle *dev_fwnode(struct device *dev); > +const struct fwnode_handle *dev_fwnode_const(const struct device *dev); > > bool device_property_present(struct device *dev, const char *propname); > int device_property_read_u8_array(struct device *dev, const char *propname, > -- > 2.35.1 -- heikki