From patchwork Wed Dec 16 14:33:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 345124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BD03C4361B for ; Wed, 16 Dec 2020 14:34:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EB097233CF for ; Wed, 16 Dec 2020 14:34:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726566AbgLPOdz (ORCPT ); Wed, 16 Dec 2020 09:33:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbgLPOdz (ORCPT ); Wed, 16 Dec 2020 09:33:55 -0500 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 66A74C06179C; Wed, 16 Dec 2020 06:33:14 -0800 (PST) Received: by mail-lf1-x135.google.com with SMTP id l11so48886458lfg.0; Wed, 16 Dec 2020 06:33:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OgA/Qj5MoeLXprwzpH85DyU4GOR+t7v9bSyabWdDu6Y=; b=d189VRzhBWxK/ithEterE85fheUFT35ZpyzsvKMhWkxDdDuMCGJJs2GrJeafo6X9Lp hLEaO0ybylViAI94CR/hOeAS28jxwmmbNdwOUr3WME5EFr6jDJwoYJ0ODVKa6RBCDZ2H nkDtnCoLElQhfqbBUlHXkMGTgxWh4w54HrwAQqqk3ps3tRCzvRjg7HCTfiUZHv3etXN6 j1xdTprRWkj51BcIuIA4L2CLCnpPc3hfu0JAMtCUhhyIi/M8JtbIPb6OvCcKXL2l0zdo d3MKSFf86WN2+VtrWCN04Zn6U8t0ih3pq5e9AYPUb6kpZEf/pnWs1sPW2pOM8eneWgMP 4Z1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=OgA/Qj5MoeLXprwzpH85DyU4GOR+t7v9bSyabWdDu6Y=; b=QXRKEBt6uTlMDMVM2NuLYDGTSvx+PXufbfbeIb8xpJTknj+ige3FCKKRxgAiKBO0Ga 6X4gLHnfl3u/mzeHzLba8RT5lgAav6FPwtI8eZdYiQ3ovHCn2ksqInAcRbMRToUagxjF SmVzQoDtdqbvU8dZ3v+1OTSXg02IHIRPam+GUeAiTfFTD/i7c10lMgR7up8PgloEDLNR 0rXk5Wmn9sE5EIlxtmzSXLdV3x6sO3LN+6fPHRPYM8QIlh/18gQeqA8NMme+AxKI5oux lN7G6h3zQKqiFgbwvwUe1IfY4LIlKxVoYTwMuGhj0uxvln9FPKRUDUKjbRAn78BWusBw g9ng== X-Gm-Message-State: AOAM532zK0sxSLgDvpi+1HbyFZTylmcWfcQLrJv5qVUHcI6tGnLUyrza jTUAZb7vAEcr20A1BZiNXig= X-Google-Smtp-Source: ABdhPJyWdqhurn5BIrt7MvgzkcIQVlqqao56ZNN6OiHvgcpof5Lfuun3wpkqk6oL+O+fXHxOIuPD5A== X-Received: by 2002:ac2:598c:: with SMTP id w12mr12061647lfn.526.1608129192537; Wed, 16 Dec 2020 06:33:12 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id q21sm302803ljj.31.2020.12.16.06.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 06:33:11 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kishon Vijay Abraham I , Vinod Koul Cc: Al Cooper , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 1/2] phy: phy-brcm-usb: improve getting OF matching data Date: Wed, 16 Dec 2020 15:33:04 +0100 Message-Id: <20201216143305.12179-1-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rafał Miłecki 1. Use of_device_get_match_data() helper to simplify the code 2. Check for NULL as a good practice Signed-off-by: Rafał Miłecki --- drivers/phy/broadcom/phy-brcm-usb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c index 63f922a5f29b..f0f01060bd12 100644 --- a/drivers/phy/broadcom/phy-brcm-usb.c +++ b/drivers/phy/broadcom/phy-brcm-usb.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -431,7 +432,6 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) struct device_node *dn = pdev->dev.of_node; int err; const char *mode; - const struct of_device_id *match; void (*dvr_init)(struct brcm_usb_init_params *params); const struct match_chip_info *info; struct regmap *rmap; @@ -445,8 +445,9 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) priv->ini.family_id = brcmstb_get_family_id(); priv->ini.product_id = brcmstb_get_product_id(); - match = of_match_node(brcm_usb_dt_ids, dev->of_node); - info = match->data; + info = of_device_get_match_data(&pdev->dev); + if (!info) + return -ENOENT; dvr_init = info->init_func; (*dvr_init)(&priv->ini); From patchwork Wed Dec 16 14:33:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 344599 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93363C0018C for ; Wed, 16 Dec 2020 14:34:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4AA3D233FA for ; Wed, 16 Dec 2020 14:34:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726570AbgLPOd5 (ORCPT ); Wed, 16 Dec 2020 09:33:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbgLPOd4 (ORCPT ); Wed, 16 Dec 2020 09:33:56 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E54BC0617A6; Wed, 16 Dec 2020 06:33:16 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id 23so48840406lfg.10; Wed, 16 Dec 2020 06:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fH2l2Ia7BO3y3r4emJ9xAC0yjRKyCBVHd/WRfzCfaN8=; b=gomnBTgmxslprhhUPQAyiWF/o4oS7jcCEqTu2NgOniBhMPEcqaHVV4WBVbA5yKGUGT eUUswHnaQjQBCgeg7VDd7fCJkZSN2I+errDul/B2HhwhSnUAuBNqarx/gmyqPrZgjngc FJzOIn0hIXN4bkI9cVokFFxweSjXR/Z1/mdUwettlOlvbzyAAIilmAegYdCdQ3+8sisD UtgGXdLoTT+tc00/EtbrWCyXhUZwdxWe8SZEij56SSWiYX8uv9DEUAbYDO81BlYHhHHF 8H7Lcj76bvpGNvPlzB8gQiE4pZy32t1156+SusGItVhmP3cPEv13JaoyTruLMyiHFNOB 3H2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fH2l2Ia7BO3y3r4emJ9xAC0yjRKyCBVHd/WRfzCfaN8=; b=gVlp/wOBtrZcgPOpX1iaphtX7nS90/mvRncB+d9ujjfqtg4PBRw6VpHVWZgxHB+qyy 2+HHpd3/qZxJgOHMccZMtFkqUFhXI+gf5Kp1kGapC9Qd8dcaNtMBdv4nmwxRe7ai9Yge J8hKSrdDzOqAdUT1TSpteqMVwlip4OOxXsE/svDKEIV+b2BTpraSvmyRODuMymV7q+jg SRGDEpeklP8dnn/K52i7h6mY7JpzL2OOHPAovH/PMG6gm3ply7S6fF11OV3KqQQVSHdT 16WfpUo/hJACnmCP6y8gBvgtF5MNMerJHsm7koYMKbFGJ9/mhJa6BUfeRnt8nUb9ZcGR ajTQ== X-Gm-Message-State: AOAM531N2oXewFSbRAkXV68DTzhQWNVamun++b56oTAflkMuKNgZjWvH Yb5vzHGAq50uIUvfOnQ4ACU= X-Google-Smtp-Source: ABdhPJxClypsqHFX6VxGE5iSsayx4QiIkOMc8/mMOiQM0p6mqeirdNniV70/KbQo0XmJ+sZdXeCfHg== X-Received: by 2002:a05:651c:1312:: with SMTP id u18mr13663281lja.200.1608129194415; Wed, 16 Dec 2020 06:33:14 -0800 (PST) Received: from localhost.lan (ip-194-187-74-233.konfederacka.maverick.com.pl. [194.187.74.233]) by smtp.gmail.com with ESMTPSA id q21sm302803ljj.31.2020.12.16.06.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Dec 2020 06:33:13 -0800 (PST) From: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= To: Kishon Vijay Abraham I , Vinod Koul Cc: Al Cooper , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= Subject: [PATCH 2/2] phy: phy-brcm-usb: specify init function format at struct level Date: Wed, 16 Dec 2020 15:33:05 +0100 Message-Id: <20201216143305.12179-2-zajec5@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201216143305.12179-1-zajec5@gmail.com> References: <20201216143305.12179-1-zajec5@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rafał Miłecki This is slightly cleaner solution that assures noone assings a wrong function to the pointer. Signed-off-by: Rafał Miłecki Acked-by: Florian Fainelli --- drivers/phy/broadcom/phy-brcm-usb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c index f0f01060bd12..116fb23aebd9 100644 --- a/drivers/phy/broadcom/phy-brcm-usb.c +++ b/drivers/phy/broadcom/phy-brcm-usb.c @@ -35,7 +35,7 @@ struct value_to_name_map { }; struct match_chip_info { - void *init_func; + void (*init_func)(struct brcm_usb_init_params *params); u8 required_regs[BRCM_REGS_MAX + 1]; u8 optional_reg; }; @@ -432,7 +432,6 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) struct device_node *dn = pdev->dev.of_node; int err; const char *mode; - void (*dvr_init)(struct brcm_usb_init_params *params); const struct match_chip_info *info; struct regmap *rmap; int x; @@ -448,8 +447,8 @@ static int brcm_usb_phy_probe(struct platform_device *pdev) info = of_device_get_match_data(&pdev->dev); if (!info) return -ENOENT; - dvr_init = info->init_func; - (*dvr_init)(&priv->ini); + + info->init_func(&priv->ini); dev_dbg(dev, "Best mapping table is for %s\n", priv->ini.family_name);