From patchwork Thu Jul 20 08:42:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 9854195 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 99B81602BA for ; Thu, 20 Jul 2017 08:47:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 887AE2877E for ; Thu, 20 Jul 2017 08:47:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D2A328782; Thu, 20 Jul 2017 08:47:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 09CD22877E for ; Thu, 20 Jul 2017 08:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=uqrLLxMUudUQS8Cx7++OJEOTGQSDY137vHVAqpuYGe4=; b=EiPcAwm3W/4GOX n4KN/pfjpyzLW0OcMNU0ZGGSO4wosfwJgfLkcl8cNQ5S8RqirabJ0VFz01V5PEMc93VCK/SNHbw2s B2oVz9Yl1UW7V19BXvWt+rZJpetZD+h5HcVte8Ja7eEzEnUOE3YcGGmhFn4CtATcsyP8ekyD62hVZ mVyNSZPriaMjYSazbDrtT854x36t20WWP0mVvuri/F0ajC+fARwgSZmg6/S0keq4+GfQYuEPA8/+X AQslt/jXwCqKxY9/5/8XWG5TWoIMiOCzrqeSZiETh9AUcTrcpQm5b9CJn1mhF5Fz51pV0xOcfdkt/ ChDEY1uiELVBXWzpt2Sg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dY77L-0002YY-EM; Thu, 20 Jul 2017 08:47:31 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dY77H-0002QC-IR for linux-arm-kernel@lists.infradead.org; Thu, 20 Jul 2017 08:47:29 +0000 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6K8iWkU028632; Thu, 20 Jul 2017 01:47:02 -0700 Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0b-0016f401.pphosted.com with ESMTP id 2bt5semm8s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 20 Jul 2017 01:47:02 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Thu, 20 Jul 2017 01:47:00 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Thu, 20 Jul 2017 01:47:00 -0700 Received: from xhacker.marvell.com (unknown [10.37.130.164]) by maili.marvell.com (Postfix) with ESMTP id 830353F703F; Thu, 20 Jul 2017 01:46:59 -0700 (PDT) From: Jisheng Zhang To: , Subject: [PATCH] regulator: fan53555: Use of_device_get_match_data() to simplify probe Date: Thu, 20 Jul 2017 16:42:17 +0800 Message-ID: <20170720084217.2584-1-jszhang@marvell.com> X-Mailer: git-send-email 2.13.3 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-20_05:, , signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707200143 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170720_014727_768841_814DCA17 X-CRM114-Status: GOOD ( 11.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jisheng Zhang , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP if fan53555_regulator_probe() is called and the "client->dev.of_node" isn't NULL, it means OF registered a device with a valid compatible string, so match cannot be NULL. Use of_device_get_match_data() to retrieve the drvdata pointer. No functional change intended. Signed-off-by: Jisheng Zhang --- drivers/regulator/fan53555.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index 60f431831582..6b1c0e4672a2 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c @@ -407,14 +407,8 @@ static int fan53555_regulator_probe(struct i2c_client *client, di->regulator = pdata->regulator; if (client->dev.of_node) { - const struct of_device_id *match; - - match = of_match_device(of_match_ptr(fan53555_dt_ids), - &client->dev); - if (!match) - return -ENODEV; - - di->vendor = (unsigned long) match->data; + di->vendor = + (unsigned long)of_device_get_match_data(&client->dev); } else { /* if no ramp constraint set, get the pdata ramp_delay */ if (!di->regulator->constraints.ramp_delay) {