Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935218AbdGTIrd (ORCPT ); Thu, 20 Jul 2017 04:47:33 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:45032 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934763AbdGTIra (ORCPT ); Thu, 20 Jul 2017 04:47:30 -0400 From: Jisheng Zhang To: , CC: , , Jisheng Zhang 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 Content-Type: text/plain 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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1161 Lines: 35 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) { -- 2.13.3