From patchwork Wed Oct 4 12:21:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 9984497 X-Patchwork-Delegate: geert@linux-m68k.org 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 570926028E for ; Wed, 4 Oct 2017 12:22:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CBF42860A for ; Wed, 4 Oct 2017 12:22:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4102D28ADD; Wed, 4 Oct 2017 12:22:05 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E20282860A for ; Wed, 4 Oct 2017 12:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751947AbdJDMWE (ORCPT ); Wed, 4 Oct 2017 08:22:04 -0400 Received: from baptiste.telenet-ops.be ([195.130.132.51]:43852 "EHLO baptiste.telenet-ops.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751699AbdJDMWE (ORCPT ); Wed, 4 Oct 2017 08:22:04 -0400 Received: from ayla.of.borg ([84.195.106.246]) by baptiste.telenet-ops.be with bizsmtp id HQN21w01M5JzmfG01QN2ZV; Wed, 04 Oct 2017 14:22:02 +0200 Received: from ramsan.of.borg ([192.168.97.29] helo=ramsan) by ayla.of.borg with esmtp (Exim 4.86_2) (envelope-from ) id 1dzigc-0000lq-LV; Wed, 04 Oct 2017 14:22:02 +0200 Received: from geert by ramsan with local (Exim 4.86_2) (envelope-from ) id 1dzigc-0003Ni-K4; Wed, 04 Oct 2017 14:22:02 +0200 From: Geert Uytterhoeven To: Greg Kroah-Hartman Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] serial: sh-sci: Use of_device_get_match_data() helper Date: Wed, 4 Oct 2017 14:21:56 +0200 Message-Id: <1507119716-12958-1-git-send-email-geert+renesas@glider.be> X-Mailer: git-send-email 2.7.4 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use the of_device_get_match_data() helper instead of open coding. Note that when used with DT, there's always a valid match. Signed-off-by: Geert Uytterhoeven Reviewed-by: Simon Horman --- drivers/tty/serial/sh-sci.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 784dd42002eadbeb..95b12eefcb7ae906 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -3044,17 +3045,15 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev, unsigned int *dev_id) { struct device_node *np = pdev->dev.of_node; - const struct of_device_id *match; struct plat_sci_port *p; struct sci_port *sp; + const void *data; int id; if (!IS_ENABLED(CONFIG_OF) || !np) return NULL; - match = of_match_node(of_sci_match, np); - if (!match) - return NULL; + data = of_device_get_match_data(&pdev->dev); p = devm_kzalloc(&pdev->dev, sizeof(struct plat_sci_port), GFP_KERNEL); if (!p) @@ -3070,8 +3069,8 @@ static struct plat_sci_port *sci_parse_dt(struct platform_device *pdev, sp = &sci_ports[id]; *dev_id = id; - p->type = SCI_OF_TYPE(match->data); - p->regtype = SCI_OF_REGTYPE(match->data); + p->type = SCI_OF_TYPE(data); + p->regtype = SCI_OF_REGTYPE(data); sp->has_rtscts = of_property_read_bool(np, "uart-has-rtscts");