Received: by 10.213.65.68 with SMTP id h4csp1021693imn; Tue, 27 Mar 2018 13:10:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx48xhZTtwaPr73m4EhhMj5kUx+RQUavA32fRW5eGs4piEjuwED8KqEX9bR7nTrbbT8N5byFW X-Received: by 10.99.95.78 with SMTP id t75mr495059pgb.330.1522181451096; Tue, 27 Mar 2018 13:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522181451; cv=none; d=google.com; s=arc-20160816; b=Kn5KoJttcgZg5/ylGuGpcYADN1fA6TFQVGOT/EJN9J/6iKxKEc3zuo7m9YcnCgkc+6 FIwkEpPGOKeJkPNpACydAu3cXbMw+RTosIFsU0ZS1cF2reVJhZ91lBDDuzMtw1IyvtbD A/LDruU0rCkWu1cM5Me8ve6p8DFolG20LEdcruJp9xm2nHh7MV2ukQOauUwNFMh21Uem E3S18mB6vmqizoj4tSEj0ko/bLSTcpBeahwxfOwdPx5GoA0elTa1kK6wvtpb7pwUfIOc QdzqUky9bXpnncinEFSRiOeemdk6afQOnh58NCWr9WxGEGbDVijXczXK/94xAYxUY7uX ROzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=tJfLOXNe2OdNKxlL5mXwMzsrw5VPWr4yVOe0HeFU9uI=; b=qjAqdJO4aM3qMopGjyEtA3rmWQ9G4sulyQXvTTuwFlEK4dpPIq3B9nEW7UDNS5Okla G+IbeinH8hnHIjjvH7jh2z/2oFMc9vVX9wZbkpfC9K1oJLyzCLafI/4yLTdcU9KRQfFR ppxxX14yoKoLv0y0U3ZHdH6JoevnfBukPl4/GyIMB33xFblHmoO81cDxsrSTcsw5PV9s mOe27unmXHpwAM73AlWyJgLoNUnI0rbsz7Ffd9i3YoJyvARuzWGPGGuSNkAl5uRfsQo/ PFSrQTGSDTuxBMXSGzFHRIGgfUk0HdA5kXsNNXom4xH7dI/LaWfy/LCpecaibEbyTFzw z46A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ettus-com.20150623.gappssmtp.com header.s=20150623 header.b=hSAPNw+v; 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 x5si1351422pgb.365.2018.03.27.13.10.36; Tue, 27 Mar 2018 13:10:51 -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; dkim=pass header.i=@ettus-com.20150623.gappssmtp.com header.s=20150623 header.b=hSAPNw+v; 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 S1751316AbeC0UJa (ORCPT + 99 others); Tue, 27 Mar 2018 16:09:30 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:35329 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750914AbeC0UJ2 (ORCPT ); Tue, 27 Mar 2018 16:09:28 -0400 Received: by mail-it0-f66.google.com with SMTP id v194-v6so797807itb.0 for ; Tue, 27 Mar 2018 13:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ettus-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tJfLOXNe2OdNKxlL5mXwMzsrw5VPWr4yVOe0HeFU9uI=; b=hSAPNw+vVVieOT7PB2LFltYbxZA0sDixJF8H+Yp3iRvypnZ+w4avgEXh8QpyW8paNh FiP7rDuvsO4ace8JXx5quurJW8GUfckCT4J6gnWxxz1p3A4BmyuDUFx3D4KOphKWTWr/ qzwwmNjjjDJ+4hJdpGYZnY9kC3ZY8+jPFRicpwp/TRnFt8gIlkD9QLlOk/9QzGN6O6kn MVf35afNgXGw4Ci7bVcUNDcd4QwjYcBgucpsXhS3veb8Xgb6IdGjKbXurhuALsbHQycJ 1my1+QENMYbYwb2qyY86MQlbhfBXLECPi4PBgyT0yubwj7emQDINe4mZs5wMNXsGd4kX i2zQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tJfLOXNe2OdNKxlL5mXwMzsrw5VPWr4yVOe0HeFU9uI=; b=JT1fPV3oXF1M8nhnpac0hzGo8tjWkZc2dk6eLBZ4zJTwVpBQGQjPyJIxoHNcBcj0+4 bIPoXh3v2RLSIEm/Np3HWq9C/zuryJU2vtzTk6rGN6V51zkMWr5f0m0Nv5U8I30GPiwb SPoJ7iLlZIAEZhW+EcsBYgJB1sLEb44XKE68GuAQZ2THaccF1AW+2dcUSQnA2CzoRznn WeabAoptjqXyLtqLjFLodxzzKYUNQYorWpMb91qu5hPFjntun5pxJw3yH9GivZEtBZsK Bfhdif56ozDd2X5oI2k+hyCGRCifss9NwNG3x9B5tOIwhdpv/L6rcZM2sH82bgAesAkD KRxA== X-Gm-Message-State: AElRT7FZEKGbhkoEsTXgqMLKF4DUpbONvVO87CEVO4Zl3uv2hrLQvuEc NL83M6E34TfMTmfFjl+usDnwwHoNw1wCITNkdGoptA== X-Received: by 2002:a24:5081:: with SMTP id m123-v6mr748104itb.118.1522181367291; Tue, 27 Mar 2018 13:09:27 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.103.24 with HTTP; Tue, 27 Mar 2018 13:09:26 -0700 (PDT) In-Reply-To: <20180327195957.3878-5-atull@kernel.org> References: <20180327195957.3878-1-atull@kernel.org> <20180327195957.3878-5-atull@kernel.org> From: Moritz Fischer Date: Tue, 27 Mar 2018 13:09:26 -0700 Message-ID: Subject: Re: [RESEND PATCH v3 4/4] fpga: region: change fpga_region_register to have one param To: Alan Tull Cc: Anatolij Gustschin , Matthew Gerlach , Joel Holdsworth , Florian Fainelli , Joshua Clayton , Dinh Nguyen , Linux Kernel Mailing List , linux-fpga@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alan, On Tue, Mar 27, 2018 at 12:59 PM, Alan Tull wrote: > Change fpga_region_register to only take one parameter: > > int fpga_region_register(struct fpga_region *region) > > The parent dev is added to struct fpga_region. > > This make it similar to fpga_bridge_register and fpga_mgr_register > which also just take their respective struct. > > The one caller of fpga_region_register is changed to alloc the > fpga_region struct, fill it in, and pass it to the register > function. > > Signed-off-by: Alan Tull Acked-by: Moritz Fischer > --- > v2: This patch added in this version of the patchset > v3: minor changes to make diffs smaller and more obviously correct > --- > Documentation/fpga/fpga-region.txt | 3 +-- > drivers/fpga/fpga-region.c | 8 +++++++- > drivers/fpga/of-fpga-region.c | 3 ++- > include/linux/fpga/fpga-region.h | 4 +++- > 4 files changed, 13 insertions(+), 5 deletions(-) > > diff --git a/Documentation/fpga/fpga-region.txt b/Documentation/fpga/fpga-region.txt > index 139a02ba1ff6..d38fa3b4154a 100644 > --- a/Documentation/fpga/fpga-region.txt > +++ b/Documentation/fpga/fpga-region.txt > @@ -42,8 +42,7 @@ The FPGA region API > To register or unregister a region: > ----------------------------------- > > - int fpga_region_register(struct device *dev, > - struct fpga_region *region); > + int fpga_region_register(struct fpga_region *region); > int fpga_region_unregister(struct fpga_region *region); > > An example of usage can be seen in the probe function of [3] > diff --git a/drivers/fpga/fpga-region.c b/drivers/fpga/fpga-region.c > index ebe1f872810d..660a91b9e246 100644 > --- a/drivers/fpga/fpga-region.c > +++ b/drivers/fpga/fpga-region.c > @@ -162,10 +162,16 @@ int fpga_region_program_fpga(struct fpga_region *region) > } > EXPORT_SYMBOL_GPL(fpga_region_program_fpga); > > -int fpga_region_register(struct device *dev, struct fpga_region *region) > +int fpga_region_register(struct fpga_region *region) > { > + struct device *dev = region->parent; > int id, ret = 0; > > + if (!dev) { > + pr_err("Attempt to register fpga region without parent\n"); > + return -EINVAL; > + } > + > id = ida_simple_get(&fpga_region_ida, 0, 0, GFP_KERNEL); > if (id < 0) > return id; > diff --git a/drivers/fpga/of-fpga-region.c b/drivers/fpga/of-fpga-region.c > index 35e7e8c4a0cb..a7b38aafeaa7 100644 > --- a/drivers/fpga/of-fpga-region.c > +++ b/drivers/fpga/of-fpga-region.c > @@ -428,12 +428,13 @@ static int of_fpga_region_probe(struct platform_device *pdev) > goto eprobe_mgr_put; > } > > + region->parent = dev; > region->mgr = mgr; > > /* Specify how to get bridges for this type of region. */ > region->get_bridges = of_fpga_region_get_bridges; > > - ret = fpga_region_register(dev, region); > + ret = fpga_region_register(region); > if (ret) > goto eprobe_mgr_put; > > diff --git a/include/linux/fpga/fpga-region.h b/include/linux/fpga/fpga-region.h > index b6520318ab9c..423c87e3e29a 100644 > --- a/include/linux/fpga/fpga-region.h > +++ b/include/linux/fpga/fpga-region.h > @@ -8,6 +8,7 @@ > /** > * struct fpga_region - FPGA Region structure > * @dev: FPGA Region device > + * @parent: parent device > * @mutex: enforces exclusive reference to region > * @bridge_list: list of FPGA bridges specified in region > * @mgr: FPGA manager > @@ -18,6 +19,7 @@ > */ > struct fpga_region { > struct device dev; > + struct device *parent; > struct mutex mutex; /* for exclusive reference to region */ > struct list_head bridge_list; > struct fpga_manager *mgr; > @@ -34,7 +36,7 @@ struct fpga_region *fpga_region_class_find( > int (*match)(struct device *, const void *)); > > int fpga_region_program_fpga(struct fpga_region *region); > -int fpga_region_register(struct device *dev, struct fpga_region *region); > +int fpga_region_register(struct fpga_region *region); > int fpga_region_unregister(struct fpga_region *region); > > #endif /* _FPGA_REGION_H */ > -- > 2.14.2 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-fpga" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Thanks, Moritz