From patchwork Mon Dec 6 16:23:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 12658871 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF071C433EF for ; Mon, 6 Dec 2021 16:23:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379408AbhLFQ1T (ORCPT ); Mon, 6 Dec 2021 11:27:19 -0500 Received: from mga06.intel.com ([134.134.136.31]:25573 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379240AbhLFQ1S (ORCPT ); Mon, 6 Dec 2021 11:27:18 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10189"; a="298147083" X-IronPort-AV: E=Sophos;i="5.87,292,1631602800"; d="scan'208";a="298147083" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2021 08:23:29 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,292,1631602800"; d="scan'208";a="502180954" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 06 Dec 2021 08:23:27 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1DE28199; Mon, 6 Dec 2021 18:23:33 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Wolfgang Grandegger , Marc Kleine-Budde , "David S. Miller" , Jakub Kicinski Subject: [PATCH v1 3/4] can: hi311x: Make use of device property API Date: Mon, 6 Dec 2021 18:23:22 +0200 Message-Id: <20211206162323.29281-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211206162323.29281-1-andriy.shevchenko@linux.intel.com> References: <20211206162323.29281-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Make use of device property API in this driver so that both OF based system and ACPI based system can use this driver. Signed-off-by: Andy Shevchenko --- drivers/net/can/spi/hi311x.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index 1e4ff904be0f..78044ec24575 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -25,11 +25,11 @@ #include #include #include +#include #include #include -#include -#include #include +#include #include #include #include @@ -831,6 +831,7 @@ static int hi3110_can_probe(struct spi_device *spi) struct device *dev = &spi->dev; struct net_device *net; struct hi3110_priv *priv; + const void *match; struct clk *clk; u32 freq; int ret; @@ -875,8 +876,9 @@ static int hi3110_can_probe(struct spi_device *spi) CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_BERR_REPORTING; - if (of_id) - priv->model = (enum hi3110_model)(uintptr_t)of_id->data; + match = device_get_match_data(dev); + if (match) + priv->model = (enum hi3110_model)(uintptr_t)match; else priv->model = spi_get_device_id(spi)->driver_data; priv->net = net;