From patchwork Tue Mar 14 20:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 13174981 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95FD9C05027 for ; Tue, 14 Mar 2023 20:13:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231142AbjCNUN1 (ORCPT ); Tue, 14 Mar 2023 16:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjCNUNW (ORCPT ); Tue, 14 Mar 2023 16:13:22 -0400 Received: from mail-il1-f179.google.com (mail-il1-f179.google.com [209.85.166.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0BC71969E; Tue, 14 Mar 2023 13:13:14 -0700 (PDT) Received: by mail-il1-f179.google.com with SMTP id j6so4793095ilr.7; Tue, 14 Mar 2023 13:13:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678824794; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CJlM3chLn2hYsljtdG2Gsvt+783JHIg7bd5IO9aY9nI=; b=2gwgZdKQFNu5DSKff+6jfaXg8i+D6yAnCSA1A9jKLoWb5Y9wO2fNkCdR+90FfhZkAu s74pIC/aVjtGGeoL3Pd0r2M/UimlB/nyG8HIg0AAM9tQ1n4iQSRznfj5GuEJLoRNi7XF riaI31Scxt+Je7OYeWGEi2BwetTNuj6Al35V3VOn7wRCBCYqjr/eLtoQ/fQSdPrMbuk7 wPbM05IhhfaUOvBRJlviCcgZZhOhsWI7NeHYJyeJS0Pxa7Ft8mTxgSrjDxRVRFop7u0d OYLCXjJ82v2pSalJbChOySpX1a36bJwdy/MuDzftdOK6JUWaZNrSeb3wC9aqEqbzaYck ShMQ== X-Gm-Message-State: AO0yUKUiNDRkltLMLxsq4pN0WJAGxh5wfAqqjke5Mwnobn4zh6SryG3o 4r1sL+ucDPJfLzNV5QLnhY2VGPtaaw== X-Google-Smtp-Source: AK7set9K4OXj5mFkbJbzAE5PFyZYK2s4RSbidcBMbfRzBKgYZAYAC+nEZtrczmuTAg708d10IQiiRw== X-Received: by 2002:a92:7302:0:b0:315:6fc5:ea46 with SMTP id o2-20020a927302000000b003156fc5ea46mr2893332ilc.2.1678824793715; Tue, 14 Mar 2023 13:13:13 -0700 (PDT) Received: from robh_at_kernel.org ([64.188.179.249]) by smtp.gmail.com with ESMTPSA id e20-20020a056638021400b0040611a31d5fsm361854jaq.80.2023.03.14.13.13.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 13:13:13 -0700 (PDT) Received: (nullmailer pid 995516 invoked by uid 1000); Tue, 14 Mar 2023 20:13:12 -0000 From: Rob Herring To: Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v2 1/2] nfc: mrvl: Move platform_data struct into driver Date: Tue, 14 Mar 2023 15:13:08 -0500 Message-Id: <20230314201309.995421-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org There are no users of nfcmrvl platform_data struct outside of the driver and none will be added, so move it into the driver. Signed-off-by: Rob Herring Reviewed-by: Simon Horman --- drivers/nfc/nfcmrvl/nfcmrvl.h | 30 +++++++++++++++-- include/linux/platform_data/nfcmrvl.h | 48 --------------------------- 2 files changed, 28 insertions(+), 50 deletions(-) delete mode 100644 include/linux/platform_data/nfcmrvl.h diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h index 165bd0a95190..0f22b3233f73 100644 --- a/drivers/nfc/nfcmrvl/nfcmrvl.h +++ b/drivers/nfc/nfcmrvl/nfcmrvl.h @@ -8,8 +8,6 @@ #ifndef _NFCMRVL_H_ #define _NFCMRVL_H_ -#include - #include "fw_dnld.h" /* Define private flags: */ @@ -50,6 +48,34 @@ enum nfcmrvl_phy { NFCMRVL_PHY_SPI = 3, }; +struct nfcmrvl_platform_data { + /* + * Generic + */ + + /* GPIO that is wired to RESET_N signal */ + int reset_n_io; + /* Tell if transport is muxed in HCI one */ + unsigned int hci_muxed; + + /* + * UART specific + */ + + /* Tell if UART needs flow control at init */ + unsigned int flow_control; + /* Tell if firmware supports break control for power management */ + unsigned int break_control; + + + /* + * I2C specific + */ + + unsigned int irq; + unsigned int irq_polarity; +}; + struct nfcmrvl_private { unsigned long flags; diff --git a/include/linux/platform_data/nfcmrvl.h b/include/linux/platform_data/nfcmrvl.h deleted file mode 100644 index 9e75ac8d19be..000000000000 --- a/include/linux/platform_data/nfcmrvl.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2015, Marvell International Ltd. - * - * This software file (the "File") is distributed by Marvell International - * Ltd. under the terms of the GNU General Public License Version 2, June 1991 - * (the "License"). You may use, redistribute and/or modify this File in - * accordance with the terms and conditions of the License, a copy of which - * is available on the worldwide web at - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. - * - * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE - * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE - * ARE EXPRESSLY DISCLAIMED. The License provides additional details about - * this warranty disclaimer. - */ - -#ifndef _NFCMRVL_PTF_H_ -#define _NFCMRVL_PTF_H_ - -struct nfcmrvl_platform_data { - /* - * Generic - */ - - /* GPIO that is wired to RESET_N signal */ - int reset_n_io; - /* Tell if transport is muxed in HCI one */ - unsigned int hci_muxed; - - /* - * UART specific - */ - - /* Tell if UART needs flow control at init */ - unsigned int flow_control; - /* Tell if firmware supports break control for power management */ - unsigned int break_control; - - - /* - * I2C specific - */ - - unsigned int irq; - unsigned int irq_polarity; -}; - -#endif /* _NFCMRVL_PTF_H_ */ From patchwork Tue Mar 14 20:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 13174982 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B522C7618B for ; Tue, 14 Mar 2023 20:13:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230395AbjCNUNa (ORCPT ); Tue, 14 Mar 2023 16:13:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjCNUNX (ORCPT ); Tue, 14 Mar 2023 16:13:23 -0400 Received: from mail-il1-f176.google.com (mail-il1-f176.google.com [209.85.166.176]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EEEA859CE; Tue, 14 Mar 2023 13:13:15 -0700 (PDT) Received: by mail-il1-f176.google.com with SMTP id r4so9274853ila.2; Tue, 14 Mar 2023 13:13:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678824795; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zM6p6/AP+GRJf21/LuwRpnaaVKcsH/RiAIONAo73BAA=; b=vhWV+lChRec2kQXz16+SLgq5W106CzPkl4N29pUhIC4Zh1lRtcp82qiq6XS91Ed28H 08NVvROQBAdJaz/F/lmUDn1H6bL1xnc+DuygxTxaMjOzwlF0jQIxVoOVwG8fnTSD1scf hH74LFLn8h0au4bTBQP3eCms5Dk5uuURv1HmCno10idAMJi0F8EX5/numLHYsfxGDMDe lBOfPqlB/3b2UnFTkfteQzlBZtMCm15DtZLzVMs/eYQt4dyduCBVGmu3KKnSnH96wrWQ fvYIgb6jGv6rCRAjWTABa8BX1cDFvyYaKh9IEsO1ZVc6nq3FE/mUyoLwKCTCLLjA1bdd T9QA== X-Gm-Message-State: AO0yUKVZ4WYogcmaBUnaVbKh0KkY3Z/csn0nqYMVzOeIkvZmB1Yj7SUL SKyXRJUgBAWKWjFfACvLMQ== X-Google-Smtp-Source: AK7set+n0wBOGJvllvMna3DictaV2YchaIZ1cNiodVNXtAFpLZCLmtMgxTjZDwVV+XnHWf4/DRl1hw== X-Received: by 2002:a05:6e02:e0b:b0:316:b0b2:beff with SMTP id a11-20020a056e020e0b00b00316b0b2beffmr2616607ilk.4.1678824795191; Tue, 14 Mar 2023 13:13:15 -0700 (PDT) Received: from robh_at_kernel.org ([64.188.179.249]) by smtp.gmail.com with ESMTPSA id p11-20020a92c60b000000b003179d2677f4sm1065067ilm.48.2023.03.14.13.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 13:13:14 -0700 (PDT) Received: (nullmailer pid 995533 invoked by uid 1000); Tue, 14 Mar 2023 20:13:12 -0000 From: Rob Herring To: Krzysztof Kozlowski Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Simon Horman Subject: [PATCH v2 2/2] nfc: mrvl: Use of_property_read_bool() for boolean properties Date: Tue, 14 Mar 2023 15:13:09 -0500 Message-Id: <20230314201309.995421-2-robh@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230314201309.995421-1-robh@kernel.org> References: <20230314201309.995421-1-robh@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org It is preferred to use typed property access functions (i.e. of_property_read_ functions) rather than low-level of_get_property/of_find_property functions for reading properties. Convert reading boolean properties to of_property_read_bool(). Reviewed-by: Simon Horman Reviewed-by: Krzysztof Kozlowski Signed-off-by: Rob Herring --- v2: - Convert platform_data int types to boolean --- drivers/nfc/nfcmrvl/i2c.c | 2 +- drivers/nfc/nfcmrvl/main.c | 6 +----- drivers/nfc/nfcmrvl/nfcmrvl.h | 6 +++--- drivers/nfc/nfcmrvl/uart.c | 11 ++--------- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c index e74342b0b728..164e2ab859fd 100644 --- a/drivers/nfc/nfcmrvl/i2c.c +++ b/drivers/nfc/nfcmrvl/i2c.c @@ -168,7 +168,7 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node, return ret; } - if (of_find_property(node, "i2c-int-falling", NULL)) + if (of_property_read_bool(node, "i2c-int-falling")) pdata->irq_polarity = IRQF_TRIGGER_FALLING; else pdata->irq_polarity = IRQF_TRIGGER_RISING; diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index 1a5284de4341..141bc4b66dcb 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -261,11 +261,7 @@ int nfcmrvl_parse_dt(struct device_node *node, return reset_n_io; } pdata->reset_n_io = reset_n_io; - - if (of_find_property(node, "hci-muxed", NULL)) - pdata->hci_muxed = 1; - else - pdata->hci_muxed = 0; + pdata->hci_muxed = of_property_read_bool(node, "hci-muxed"); return 0; } diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h index 0f22b3233f73..f61a99e553db 100644 --- a/drivers/nfc/nfcmrvl/nfcmrvl.h +++ b/drivers/nfc/nfcmrvl/nfcmrvl.h @@ -56,16 +56,16 @@ struct nfcmrvl_platform_data { /* GPIO that is wired to RESET_N signal */ int reset_n_io; /* Tell if transport is muxed in HCI one */ - unsigned int hci_muxed; + bool hci_muxed; /* * UART specific */ /* Tell if UART needs flow control at init */ - unsigned int flow_control; + bool flow_control; /* Tell if firmware supports break control for power management */ - unsigned int break_control; + bool break_control; /* diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c index 9c92cbdc42f0..956ae92f7573 100644 --- a/drivers/nfc/nfcmrvl/uart.c +++ b/drivers/nfc/nfcmrvl/uart.c @@ -76,15 +76,8 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node, return ret; } - if (of_find_property(matched_node, "flow-control", NULL)) - pdata->flow_control = 1; - else - pdata->flow_control = 0; - - if (of_find_property(matched_node, "break-control", NULL)) - pdata->break_control = 1; - else - pdata->break_control = 0; + pdata->flow_control = of_property_read_bool(matched_node, "flow-control"); + pdata->break_control = of_property_read_bool(matched_node, "break-control"); of_node_put(matched_node);