Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750937AbdCNLRd (ORCPT ); Tue, 14 Mar 2017 07:17:33 -0400 Received: from mail-lf0-f50.google.com ([209.85.215.50]:33669 "EHLO mail-lf0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbdCNLRb (ORCPT ); Tue, 14 Mar 2017 07:17:31 -0400 Subject: Re: [PATCH 2/7] ath9k: ahb: Add OF support To: Alban , QCA ath9k Development References: <1489439116-4233-1-git-send-email-albeu@free.fr> <1489439116-4233-2-git-send-email-albeu@free.fr> Cc: John Crispin , Kalle Valo , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org From: Sergei Shtylyov Message-ID: Date: Tue, 14 Mar 2017 14:17:27 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <1489439116-4233-2-git-send-email-albeu@free.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1275 Lines: 45 Hello! On 3/14/2017 12:05 AM, Alban wrote: > Allow registering ath9k AHB devices defined in DT. This just add the > compatible strings to allow matching the driver and setting the proper > device ID. > > Signed-off-by: Alban > --- > drivers/net/wireless/ath/ath9k/ahb.c | 47 +++++++++++++++++++++++++++++++++--- > 1 file changed, 43 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/wireless/ath/ath9k/ahb.c b/drivers/net/wireless/ath/ath9k/ahb.c > index 2bd982c..36a2645 100644 > --- a/drivers/net/wireless/ath/ath9k/ahb.c > +++ b/drivers/net/wireless/ath/ath9k/ahb.c [...] > @@ -79,10 +107,20 @@ static int ath_ahb_probe(struct platform_device *pdev) > int ret = 0; > struct ath_hw *ah; > char hw_name[64]; > + u16 devid; > > - if (!dev_get_platdata(&pdev->dev)) { > - dev_err(&pdev->dev, "no platform data specified\n"); > - return -EINVAL; > + if (id) { > + devid = id->driver_data; > + } else { > + const struct of_device_id *match; > + > + match = of_match_device(ath_ahb_of_match, &pdev->dev); > + if (!match) { > + dev_err(&pdev->dev, "no device match found\n"); > + return -EINVAL; > + } > + > + devid = (u16)(unsigned long)match->data; of_device_get_match_data() instead of the above perhaps? [...] MBR, Sergei