Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1528065pxb; Fri, 22 Jan 2021 19:48:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzPm3jr0gBX1dR8BpPIoHUPYXgGfJwbBN3tlOhVzBye55VFdiumJQ93hgsO2Kej8SA628bl X-Received: by 2002:aa7:d9c3:: with SMTP id v3mr1355110eds.133.1611373733682; Fri, 22 Jan 2021 19:48:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611373733; cv=none; d=google.com; s=arc-20160816; b=ZUZj4D9sX0eZMXjILaOTgEoUjizfcPyTaS/svS0/UOpld2FYkCPU92OskvrrZmpSF9 clbHLYkgoT6aQ0tuReLtHPKou0Nv8APcElmN7YLXMte+AVi4sQChIgfj9bvfv65Ubp2V 6amjR8Wnqc+QaAf6rAWwufPUSPdgpLpPgHLnWYbvJJfXJGcqNiKqBvEOl3gvrFSt7c5a 7YQYsd2VyVQcdC7Z768Dl5xG1FsYzo7uqnEixqjpKHrzmVttSMyY5Gzin6ny+hknzgiG V9neNamXYpCQuu1fXzmIxKCOqA2oewdkrxIeW/XBo6CV+9k9En7y10WYP3JxwKvSGlEj yT1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TAGPmP9BOJXhZhPf5GwqBeoScIfskZqY/J81LHEeHtk=; b=gPrBVbM3ycH+pcDNuZ1FqLUIdsHVo7KV3tgZVizQtFlrtpaz5W5gyoZy1F/sXVp3Iz gbWEVt73GW62hokMHl2buUtZuxvfqe11z9hhHh5JlZhw6Hgfp2Ln1fbnSKmibGV9cB28 dYeM+MD0Vjfgi/AgaS535/EDUMn0BcyroG6Z4pkEY7ygH+puUq6T4h+m/uqVJItb/Vcz eOpYM3dFXPpZtEogSjRbGketpdvdxF84j0NI4OzLbP/2iEIxB5qtPGseXphiPxzs+EOs d4L14DGESbPnP/ebA5yLjhuxEKVJ4MxicEfw7qVJ+R5n0JTk3oM+C3c3ulsm/rmErz/X 8TwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NZZ6yFVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd20si4416150edb.489.2021.01.22.19.48.30; Fri, 22 Jan 2021 19:48:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NZZ6yFVm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726808AbhAWDqa (ORCPT + 99 others); Fri, 22 Jan 2021 22:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbhAWDqK (ORCPT ); Fri, 22 Jan 2021 22:46:10 -0500 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98E3EC06121F for ; Fri, 22 Jan 2021 19:44:38 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id n10so5139923pgl.10 for ; Fri, 22 Jan 2021 19:44:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TAGPmP9BOJXhZhPf5GwqBeoScIfskZqY/J81LHEeHtk=; b=NZZ6yFVmNa7MxufUctRDhrA/2kE4i5M/O2laQqAIdRTg+v0WaUoejxIkipX2gg/JO8 o4NiObGkeDm7IDiHhRPngZP9FP/mimImdZ6hYrEQoilLtad2G5wBGpPWs6AAojVqSYre SZkFzokfE9dqhMRMw1Z0pgZ/GD7gWAqAQIxs4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TAGPmP9BOJXhZhPf5GwqBeoScIfskZqY/J81LHEeHtk=; b=eSWtwC3QeFxBijBaNFcsr0wpHed5ZCb8F3lFZRi+V0VBhrCfcV21Si0hL+1viNgz3V rbmA7OXQTs/COv8aunkajPFC6OM6A0pyUQ+Nnu5uoV4O3RZUeyPzUFBmvhZ8N6+Wn2gJ 2ANDeCeJbDfSd8JIup86l+a3y+8hYDcjeLZMVdl4saUmwrmbF9dIOUYcHVtyvOON1IAR w0xIezZRa0TFKtXPt3C91xv0xTTKGTcWKDnkT3U/ZTDunTmYgF+XQnGMkFtTPZ677sAp aYOACxoo3pFLtcRA46HIUWgizCZKklwSlh/P8qrbf1I/vogqPGuP5I4cxlz37nG6SWCY chVA== X-Gm-Message-State: AOAM530dTMBGAag793RlFql0br3F6gNxTTI4KDMWmGpj9kJV5v+a+8nI 0254RCJo86UXMTQuOJpfAYSMEw== X-Received: by 2002:a05:6a00:1385:b029:1be:ac19:3a9d with SMTP id t5-20020a056a001385b02901beac193a9dmr1557962pfg.65.1611373478208; Fri, 22 Jan 2021 19:44:38 -0800 (PST) Received: from smtp.gmail.com ([2620:15c:202:201:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id gf23sm10480343pjb.42.2021.01.22.19.44.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 19:44:37 -0800 (PST) From: Stephen Boyd To: Rob Herring Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Greg Kroah-Hartman , Arnd Bergmann , Geert Uytterhoeven , Richard Leitner , Rob Herring , Frank Rowand , linux-usb@vger.kernel.org Subject: [PATCH v2 4/6] usb: usb251xb: Use of_device_get_match_data() Date: Fri, 22 Jan 2021 19:44:26 -0800 Message-Id: <20210123034428.2841052-5-swboyd@chromium.org> X-Mailer: git-send-email 2.30.0.280.ga3ce27912f-goog In-Reply-To: <20210123034428.2841052-1-swboyd@chromium.org> References: <20210123034428.2841052-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the more modern API here instead of using of_match_device() and avoid casting away const from the returned pointer by pushing the const type through to the users. This nicely avoids referencing the match table when it is undefined with configurations where CONFIG_OF=n and avoids const issues. Signed-off-by: Stephen Boyd Acked-by: Greg Kroah-Hartman Cc: Arnd Bergmann Cc: Geert Uytterhoeven Cc: Richard Leitner Cc: Greg Kroah-Hartman Cc: Rob Herring Cc: Frank Rowand Cc: --- Please ack so Rob can apply. drivers/usb/misc/usb251xb.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c index 29fe5771c21b..507deef1f709 100644 --- a/drivers/usb/misc/usb251xb.c +++ b/drivers/usb/misc/usb251xb.c @@ -396,7 +396,7 @@ static void usb251xb_get_ports_field(struct usb251xb *hub, } static int usb251xb_get_ofdata(struct usb251xb *hub, - struct usb251xb_data *data) + const struct usb251xb_data *data) { struct device *dev = hub->dev; struct device_node *np = dev->of_node; @@ -630,7 +630,7 @@ static const struct of_device_id usb251xb_of_match[] = { MODULE_DEVICE_TABLE(of, usb251xb_of_match); #else /* CONFIG_OF */ static int usb251xb_get_ofdata(struct usb251xb *hub, - struct usb251xb_data *data) + const struct usb251xb_data *data) { return 0; } @@ -647,13 +647,11 @@ static int usb251xb_probe(struct usb251xb *hub) { struct device *dev = hub->dev; struct device_node *np = dev->of_node; - const struct of_device_id *of_id = of_match_device(usb251xb_of_match, - dev); + const struct usb251xb_data *usb_data = of_device_get_match_data(dev); int err; - if (np && of_id) { - err = usb251xb_get_ofdata(hub, - (struct usb251xb_data *)of_id->data); + if (np && usb_data) { + err = usb251xb_get_ofdata(hub, usb_data); if (err) { dev_err(dev, "failed to get ofdata: %d\n", err); return err; -- https://chromeos.dev