Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1825414imm; Sat, 15 Sep 2018 03:56:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYoW9s70QYp3+1pfDg4ImI+ds5o5/ki3sy+H8Bakp5Ia/EczkqNsCiqPQGuiNtFWg7mwCRw X-Received: by 2002:a62:4f0b:: with SMTP id d11-v6mr16626648pfb.132.1537008999125; Sat, 15 Sep 2018 03:56:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537008999; cv=none; d=google.com; s=arc-20160816; b=XUKZgjnI44bC+Ewk8/ubadY4yIeDWdvvOAX8O1SNJ7nAlTNDrY7dZ+/JIqKNxAmsif swOFnMx8cOvmPleeO7t+yu8MXCQ137jAquoSPhZkT6nxT4Dai6wZKZT6qDZXVO9dZzAF vj3aw1APLp8Uk5QF+EZilgHHRfk6CzG37L5pCBBUHCoqvKQpP8YSgQKO25lloacCE59J 9Ucf0neunfY8NkieohUQI+8KkL1QmM5SFlzAvkwt7N+q/3zvIgU9+HCrNYrjTi02ifEv VhaqtbG1U9ATG7jEuHmaP1eFHduyh6obMe4pLBNi+xvJATpS2p+xSmrfwIlrEtxb0+f9 k7qQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=1jLIKHjsVrvrzjapmQOU68FdW7VGa+YvzTtlJKbJXDo=; b=qVCc8hFlQ4fl5S6CWn+JHI+oeVqRGoTZ/1PCGbwlPXE0vEdHNpFa/Y6xY+ZUigCyNH Djpk/BxcxUVci9O42iUMTLFVWDAve/l00hzB7h+ByiMonwMsCJrXSSCnxmnxWOAnhYh6 ppC2A/HTuHEo0jTI3RO9YVdkxPJbZH311r7xxdysW9yWJwK7i50a6+ZHMlHkS3GpavuU Bj32LM2TTb3a6yND5sHO60gBK73CSxNzZdXG6q7wfGiR+zvcgzYD9xjleifyKvYcHTBF 6/ZqOez8i9V6DRDeE/xkgjqsX3+IhMXJrzZth7WAdzDJelPX7QhcbpQ8LQI79UYaC7hq exLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d2-v6si9348927pla.307.2018.09.15.03.56.23; Sat, 15 Sep 2018 03:56:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbeIOQNY (ORCPT + 99 others); Sat, 15 Sep 2018 12:13:24 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:11719 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726446AbeIOQNX (ORCPT ); Sat, 15 Sep 2018 12:13:23 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 1D3CD19274499; Sat, 15 Sep 2018 18:54:45 +0800 (CST) Received: from localhost (10.177.31.96) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.399.0; Sat, 15 Sep 2018 18:54:38 +0800 From: YueHaibing To: , , , , CC: , , YueHaibing Subject: [PATCH -next] iio: potentiometer: mcp4531: merge calls to of_match_device and of_device_get_match_data Date: Sat, 15 Sep 2018 18:54:30 +0800 Message-ID: <20180915105430.24052-1-yuehaibing@huawei.com> X-Mailer: git-send-email 2.10.2.windows.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.31.96] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Drop call to of_match_device, which is subsumed by the subsequent call to of_device_get_match_data. The code becomes simpler, and a temporary variable can be dropped. Found by coccinelle. Signed-off-by: YueHaibing --- drivers/iio/potentiometer/mcp4531.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/potentiometer/mcp4531.c b/drivers/iio/potentiometer/mcp4531.c index df894af..d87ca85 100644 --- a/drivers/iio/potentiometer/mcp4531.c +++ b/drivers/iio/potentiometer/mcp4531.c @@ -360,7 +360,6 @@ static int mcp4531_probe(struct i2c_client *client) struct device *dev = &client->dev; struct mcp4531_data *data; struct iio_dev *indio_dev; - const struct of_device_id *match; if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WORD_DATA)) { @@ -375,10 +374,8 @@ static int mcp4531_probe(struct i2c_client *client) i2c_set_clientdata(client, indio_dev); data->client = client; - match = of_match_device(of_match_ptr(mcp4531_of_match), dev); - if (match) - data->cfg = of_device_get_match_data(dev); - else + data->cfg = of_device_get_match_data(dev); + if (!data->cfg) data->cfg = &mcp4531_cfg[i2c_match_id(mcp4531_id, client)->driver_data]; indio_dev->dev.parent = dev; -- 1.8.3.1