From patchwork Thu Jan 13 08:55:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 12712483 X-Patchwork-Delegate: johannes@sipsolutions.net 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 A7F97C433F5 for ; Thu, 13 Jan 2022 08:59:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232361AbiAMI75 (ORCPT ); Thu, 13 Jan 2022 03:59:57 -0500 Received: from mail-dm6nam11on2047.outbound.protection.outlook.com ([40.107.223.47]:10080 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231576AbiAMI6l (ORCPT ); Thu, 13 Jan 2022 03:58:41 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HvJOz/IvskuhSKI5wiP3W84rWUYTEuBXWqjV0rlq+b0fuO+LwmcXBVIETMoa89UVsXD1Lq4slt3JIgeyGjaXbHh83+x22oKj0B7IF9/6zxLZlPJya4N5s8crMB7yh5a0qtnPY7OrjGpOYfnHi1bkq0p7FF3A7ucElDVNNrYi0kYUE5oHa3TIjMOWOVqOcWvZC921rhAlAASNaK2RjiRQP+PIW+cFQk77+/NRS8t5Y1gZf+qGP3Cup7vcFf0M5hxVFTTM/K9QgVS+q/fvoLEkWdrbf4MTYmPwwsvHiERBJoShxUUbDObnl/heCCViTc9rRqF5koP1zK7Fw8ja7ABqnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fga0Vvkv5TIpQBCpG1FdA+lj1LRtkHc3USzK+Erj9MM=; b=JNll201+HiMtb2Qjb7xFvpKKDPQ98igKBCtFpd+IGQQVpHH1iFGjp/oXsHrr496QJQCAxtCqx6vA+E/dawBoJMo4gw9rkIR7SIWEWXzxWXfwk8CICPFDnYYvr8buIDXuA+MzsrYG5UsvDES9s77BYCCLIzkqLbQgEs8alIaI11GmmsgSz0pf2Ar/K52PFG4SxfHTz98kjAWSFOxXuSIgN6NztrBnlvOEm2X1rze4FgeCCeT+Qruv7u+HAVW/COBr07nlcYeiyLurW+ESes22pXHdFzAg153Kyd2KmSH/RkV3/1jkFTaENm7MyjtcaIBjxNJH8XaKp1h7yxvlUKLJjw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fga0Vvkv5TIpQBCpG1FdA+lj1LRtkHc3USzK+Erj9MM=; b=j8yP5Nbt5JtRqE7mxarj2ZbZacRIUpSvj9JJBYGGGM635YZNkuJ69lgsaISgDIVIXg46QIsyFdtqiYQsYXpramG++SlPJJoNdmSaVlpumC0KcmnO9ZNoiDcNEyS2mKCC9+UFzeplotzW/WIBPH31gAkeTipiTY+VvhXgnnEyUFY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) by CY4PR1101MB2071.namprd11.prod.outlook.com (2603:10b6:910:1a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4867.9; Thu, 13 Jan 2022 08:56:40 +0000 Received: from PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4]) by PH0PR11MB5657.namprd11.prod.outlook.com ([fe80::d031:da9e:71a:73e4%5]) with mapi id 15.20.4888.011; Thu, 13 Jan 2022 08:56:40 +0000 From: Jerome Pouiller To: devel@driverdev.osuosl.org, linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Kalle Valo , "David S . Miller" , =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH 31/31] staging: wfx: do not probe the device if not in the DT Date: Thu, 13 Jan 2022 09:55:24 +0100 Message-Id: <20220113085524.1110708-32-Jerome.Pouiller@silabs.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com> References: <20220113085524.1110708-1-Jerome.Pouiller@silabs.com> X-ClientProxiedBy: SA0PR11CA0117.namprd11.prod.outlook.com (2603:10b6:806:d1::32) To PH0PR11MB5657.namprd11.prod.outlook.com (2603:10b6:510:ee::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fb830ddc-7db8-4aab-9199-08d9d6729d51 X-MS-TrafficTypeDiagnostic: CY4PR1101MB2071:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Oa86KHzRHUVMd5vYf3eJ7UNN0LIGlnJZu1dmJBl0RBu6Q6lBYXXXRhTXn396UjIIu9Txol823vA9mv4QXHkkGtbf6ZXnI3Vrd2Kq5v71AOfQ8XCHNqN/2IXNRRFszMxOBxaCR6IcecFGj44VwQP2eMsJMER7hwK/dKYRx39SwDtR7zxQKl9BsZcRJQEJb6Q+2LB3kqY/BGkEi8OMFcE0n2/zJGWhrfv/on25fEYFGiDSs2TeJOHLL2WgYrCs3l1OO/NVbKOZJYZFe55TZjQ12UCORyqMjNNuCM00W4VGymeqxvaqCx4ONx77H94WefDekIG2wTU7dE8SQZiF0/VFcxmdX4w5fVRAA4HroSRGruarJ5402LfczB6jLVHHuV5ucnW4pOJHaz+wPwd0hRegKF/LU/lWeCoOYOwXwDzU38JAurBN10a98X4rE2iVoOBRZ/4Ti2LNZEBYie7vBRajDgNb2QWm4t9l/Zt556Rz5Crc4lHJjFU4LjHzxyjVV7PEyNTVZ51gyMxfUMqqqMgkN44Lm3YiMZetAH6H8Z7rGmgqz9OzbOwnfKe0VRIL4K8cf9UU2xv+uHFKwN15I7U3dfrxbfsEzRDWFsOAHPjiQYrFi2vXE+MKldcKVjcNP+8WeLJV7T0oum5pu7cS6zndZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR11MB5657.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(2616005)(66476007)(52116002)(8676002)(6486002)(4326008)(66574015)(38100700002)(8936002)(83380400001)(6506007)(107886003)(66556008)(6666004)(36756003)(508600001)(2906002)(5660300002)(6512007)(1076003)(86362001)(186003)(316002)(66946007)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?S1wts/dhKWyWipP3Lxma2ZKUHH19?= =?utf-8?q?fdBOUNVXuQ6R6Sja6PH1XHbQlVkz6XBGZsP+2B/boIu39y83D8ZxWA8F85gvhVi4i?= =?utf-8?q?c8cayW7VIHCCIQ39poO+/Lz0sT4hCtYvj2nQSqQ6I7MZ9pTuUZHDn1Sg8/xUk1wNY?= =?utf-8?q?1iSoI1SfHzT2ZS52+V+PX518lmaNLit6CvSz25dnHTQwZq3urDig7M2fEfXqzGl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pG0wt?= =?utf-8?q?MyuF1DcOk8AHxUOZt0qRlIFxkblwgxSebBlHN8wsNz9+Wmud0swHceA4FPZoi/r7h?= =?utf-8?q?N71fr64/W6WLrt+zDgTICF1Cb1r97WMSjpTkDWEgF/blUtNrLo/RqGPuKnumXoSPT?= =?utf-8?q?O3hFIHn20DSvtC1GjnOgBBiIfmmqJ81A1lgU2WsioW8HRxEr4dIVnEJJmPpNhoh9a?= =?utf-8?q?ogCDN8GPuYeM1UZbIOu7MAMxFryRTqra+FHcTZEWtEvkYuMO66jFqJN3JWEjRzV1Z?= =?utf-8?q?EYm3bEATJLIRQ59ZqAzdqcd4fkCXHtT+HZawX7AZmOJsq1z0vdOMfnninKTMAwzEt?= =?utf-8?q?p6/+3dJ1oPpzpGhGnGXRAv1OwEkTQRgvQiej1OY6rFY28uvtrn0UofmUaXp2rseJX?= =?utf-8?q?lamCF2O7xNj8KPIHcLtc9cQf55aUVRe4HiCI/JdaqFHivn09iVg6H8mpISOTjrewy?= =?utf-8?q?bwAB8qW/J4RBLUfBFiYSBAZdiJu4geg7N3RTASVPZ246cFtYqNZssw2uSj9ZrtGuf?= =?utf-8?q?KHZHxVOGnmst5l8IyJryKR8mACVg/5ondzP0a+59g+4IFmIw2Sxld4=3D?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb830ddc-7db8-4aab-9199-08d9d6729d51 X-MS-Exchange-CrossTenant-AuthSource: PH0PR11MB5657.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2022 08:56:40.5651 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YmouS+2Rnsvloi6cmM6nnmNo4/2VlYItyjuJqE7lsWReGHHiRQyGzz+MrVd0N9aySwh7vNQUkJoJEqhPcZdLVQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2071 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Jérôme Pouiller Since the WF200 VID/PID are not reliable, it's recommended to declare it in the DT. Until now, if the device was not declared, the driver just printed a warning and continue. But, the risk of a collision is too high, the driver now returns an error. Signed-off-by: Jérôme Pouiller --- drivers/staging/wfx/Kconfig | 4 ++++ drivers/staging/wfx/bus_sdio.c | 21 ++++++--------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/staging/wfx/Kconfig b/drivers/staging/wfx/Kconfig index 01ea09cb9697..835a855409d8 100644 --- a/drivers/staging/wfx/Kconfig +++ b/drivers/staging/wfx/Kconfig @@ -7,3 +7,7 @@ config WFX help This is a driver for Silicons Labs WFxxx series (WF200 and further) chipsets. This chip can be found on SPI or SDIO buses. + + Silabs does not use a reliable SDIO vendor ID. So, to avoid conflicts, + the driver won't probe the device if it is not also declared in the + Device Tree. diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 6ea573221ab1..bc3df85a05b6 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -204,24 +204,17 @@ static int wfx_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i return -ENODEV; } + if (!pdata) { + dev_warn(&func->dev, "no compatible device found in DT\n"); + return -ENODEV; + } + bus = devm_kzalloc(&func->dev, sizeof(*bus), GFP_KERNEL); if (!bus) return -ENOMEM; - if (np) { - if (!of_match_node(wfx_sdio_of_match, np)) { - dev_warn(&func->dev, "no compatible device found in DT\n"); - return -ENODEV; - } - bus->of_irq = irq_of_parse_and_map(np, 0); - } else { - dev_warn(&func->dev, - "device is not declared in DT, features will be limited\n"); - /* FIXME: ignore VID/PID and only rely on device tree */ - // return -ENODEV; - } - bus->func = func; + bus->of_irq = irq_of_parse_and_map(np, 0); sdio_set_drvdata(func, bus); func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | @@ -268,8 +261,6 @@ static void wfx_sdio_remove(struct sdio_func *func) #define SDIO_DEVICE_ID_SILABS_WF200 0x1000 static const struct sdio_device_id wfx_sdio_ids[] = { { SDIO_DEVICE(SDIO_VENDOR_ID_SILABS, SDIO_DEVICE_ID_SILABS_WF200) }, - /* FIXME: ignore VID/PID and only rely on device tree */ - // { SDIO_DEVICE(SDIO_ANY_ID, SDIO_ANY_ID) }, { }, }; MODULE_DEVICE_TABLE(sdio, wfx_sdio_ids);