From patchwork Tue Jul 12 16:33:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francesco Dolcini X-Patchwork-Id: 12915324 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7FF41C43334 for ; Tue, 12 Jul 2022 16:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ElI6NyRx/uGfwRZXfORN+9K6vSd4wvYrwGueAkD1HoQ=; b=TuMlY6OXuXYZN8 y5WqZ4n4jxbZiTAmUGjsuDYwUAyPnkQQ7jzM2rY/8spD7oekh41IxTfeAcVALSJ1regdP7raBI7WR ULFqq4vzdwePB4RLcUMQ355iZjEa6OJdkHBhrB2Q9XbkOQAvXPVVSEP8hLkptRnJG2AxtkYeXLRx6 9iDBp8DF5vHf4ueIQCPPOzr37jzCtz2pupAnkJt5JEJ8gZi0rEfkSAIjLr3NKdoeJhUSVb0v+6DXk Kv7mQB8dMOE4AogtNVNRKlhoD2EY8OGmRTZna/8CklPFQkiSe+4HaekzDH+6paERK5uVHvaOfk11K ntzq0crOvr5CH6+ifnnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBIr4-00CrrG-On; Tue, 12 Jul 2022 16:35:23 +0000 Received: from de-smtp-delivery-113.mimecast.com ([194.104.111.113]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oBIpg-00Cr34-SU for linux-arm-kernel@lists.infradead.org; Tue, 12 Jul 2022 16:34:01 +0000 Received: from CHE01-GV0-obe.outbound.protection.outlook.com (mail-gv0che01lp2047.outbound.protection.outlook.com [104.47.22.47]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id de-mta-22-RMZy1JirNn-sjAT-K7IYzg-2; Tue, 12 Jul 2022 18:33:49 +0200 X-MC-Unique: RMZy1JirNn-sjAT-K7IYzg-2 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) by ZRAP278MB0173.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2c::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.15; Tue, 12 Jul 2022 16:33:47 +0000 Received: from ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::3d:ca30:8c24:1a95]) by ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM ([fe80::3d:ca30:8c24:1a95%7]) with mapi id 15.20.5417.026; Tue, 12 Jul 2022 16:33:47 +0000 From: Francesco Dolcini To: Lee Jones , Maxime Coquelin , Alexandre Torgue , Rob Herring , Krzysztof Kozlowski CC: Francesco Dolcini , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Ahmad Fatoum Subject: [PATCH v2 2/5] mfd: stmpe: Probe sub-function by compatible Date: Tue, 12 Jul 2022 18:33:42 +0200 Message-ID: <20220712163345.445811-3-francesco.dolcini@toradex.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220712163345.445811-1-francesco.dolcini@toradex.com> References: <20220712163345.445811-1-francesco.dolcini@toradex.com> X-ClientProxiedBy: MR2P264CA0144.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:30::36) To ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:2e::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 615b4774-40a9-4985-a9b2-08da64244b77 X-MS-TrafficTypeDiagnostic: ZRAP278MB0173:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: wULL2Qvbwqj3+4wWPDq7bm0L7TPQxKzRgJkrW03HWJ9s+TgYVYszoZ7LQaUrUfcbY1jEc0KexmwB21ubewwi/lcWddMS6upsvjf/tycQTCzO97l/tWkZKkNjRYyGZAp1jMlIIfipCqEBHmlcCzVWfPUIlHAcl1Bmi1S4KQmW07Vkv6QYnQobQJfR3Ot2cbKiECuCZmHeQKED7QCxEqmaPSSxWHnFw5oMvBfkxE4f45No4ZJ5U7+aE7ljxnDq/M7TzN4kCWM2z9gTZprkD3TfQYLev85nz5ukA6OxTbhCsjkExxmitXkwxEJqSCjF5fhe4wtEakcmCj1m7jUMn9yqb9S0eNhN2n+pk1XiDRzkrqoevWpkaZoeSLFd444mXquhBqi+/VpIwGBiVpAqsR0o2Mgxu36sXxObKTaVeiNUuGqZOwFuFL6Fk5D1s12raHyXGKwOXokQUeia57CfnbQt/cfsuY0BUL8hDS/jNxsv1JvLcFOBAEj/DQAiRhH9yginEMsBo8HER4Zcn4pUea2X83H3uatMRnJTnZFfDvnw4ySeMjNJV0cI9BUW+xjezLYmjbDEXqlk1WVTaJ7FrF1XyQWiLm3WjPbI6HQxqBq8xMUPbtPuMG7Ipm2imqDY8kEJYZPeqT5TUqkBQzW9ODh7jj/OPnyUyHE2V7JV4diqV4M5bjk9YYVM6zRtwRO7IC7qIBEs4ghXLEB5OyK2LT8odGxZhRs0YkMoLdAeqcnXZIlpr7gIGr9+QZ67KCekjnl3xl7Ia3wVD+DRaRxx6Pb78bld5WH+DDopi9MHzbs2k5rQR9Ed+0CLhfisK/cOvJja X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230016)(4636009)(39850400004)(376002)(346002)(366004)(396003)(136003)(478600001)(44832011)(6666004)(36756003)(6486002)(8936002)(41300700001)(83380400001)(54906003)(7416002)(110136005)(316002)(5660300002)(2616005)(66946007)(26005)(1076003)(66556008)(8676002)(6512007)(186003)(52116002)(4326008)(66476007)(2906002)(38350700002)(6506007)(38100700002)(86362001);DIR:OUT;SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vwNnOiMo8cbLnNWHFmHH4YgoTBl46eCwFG8K7gPnzlC8S466HauzwF35u8RlfQZPNTZ2sZbT+rKKqzKkP9IMAOZpEtcWrHLwd7BmJ1f7td4WXKTgvhOGxVejmq1ibQPoWxCUkY6alv6whNOTFvY/rJWUSH1PM/PdDHKnB6rgKTea3++rYWAyE9CLI9QVoV0dZCzzG8MPwIg9xvT7dghZ27c+1pGfMXDgkS1GLEHzDoJKUqWfeMFlQgCO7n7H+PzHQ4fV/Nt0BxsTWJwOLew41iPxgQyizhFNAbID3T9JWdNAS01NGXoQSR7ggB1PO7e6XnqMukPGwMvc66Menll0ulXZ3P/HWHJDiu2AMdXcfP1LLLUvDhnb2SnKQp6Db6GquaQ57VQdxKmdFYFd5BekrKJUPORat8peCrmjjjuzehjoKthB5vT8YvRt09HoYNHH1TEWqzHYQ7p3GzVn++gHGJoJ3ar0QKya6GPjf/8OwXuDRNg7C04i2ktFI2QYDHVkdM4bKK8fQ2J6kyX6JVhbc3eW4CHjvc2Gd84yqXq9bEB0t9R8/v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com X-MS-Exchange-CrossTenant-Network-Message-Id: 615b4774-40a9-4985-a9b2-08da64244b77 X-MS-Exchange-CrossTenant-AuthSource: ZRAP278MB0495.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2022 16:33:47.5341 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: d9995866-0d9b-4251-8315-093f062abab4 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Tqk+vkjL3WHilQ/VpbFnWQcRwEOs1ejq8NOo19ltGFtkzjkrfLg0GM4fDbvW1g3z9JV8Je8fS0Yhq3mGZEAtV6H21i9BCiUv1DFN/MskGII= X-MS-Exchange-Transport-CrossTenantHeadersStamped: ZRAP278MB0173 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CDE13A77 smtp.mailfrom=francesco.dolcini@toradex.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: toradex.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220712_093357_291366_676B7B60 X-CRM114-Status: GOOD ( 10.49 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use sub-function of_compatible during probe, instead of using the node name. The code should not rely on the node names during probe, in addition to that the previously hard-coded node names are not compliant to the latest naming convention (they are not generic and they use underscores), and it was broken by mistake already once [1]. [1] commit 56086b5e804f ("ARM: dts: imx6qdl-apalis: Avoid underscore in node name") Suggested-by: Ahmad Fatoum Signed-off-by: Francesco Dolcini Reviewed-by: Linus Walleij --- v2: - remove define usage for compatible strings - moved rotator removal from probe to a separate patch --- drivers/mfd/stmpe.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 4aa4ac2ff406..987e251d90ae 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1362,17 +1362,16 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata, pdata->autosleep = (pdata->autosleep_timeout) ? true : false; for_each_available_child_of_node(np, child) { - if (of_node_name_eq(child, "stmpe_gpio")) { + if (of_device_is_compatible(child, stmpe_gpio_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_GPIO; - } else if (of_node_name_eq(child, "stmpe_keypad")) { + else if (of_device_is_compatible(child, stmpe_keypad_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_KEYPAD; - } else if (of_node_name_eq(child, "stmpe_touchscreen")) { + else if (of_device_is_compatible(child, stmpe_ts_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_TOUCHSCREEN; - } else if (of_node_name_eq(child, "stmpe_adc")) { + else if (of_device_is_compatible(child, stmpe_adc_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_ADC; - } else if (of_node_name_eq(child, "stmpe_pwm")) { + else if (of_device_is_compatible(child, stmpe_pwm_cell.of_compatible)) pdata->blocks |= STMPE_BLOCK_PWM; - } } }