lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANk1AXRksJum6s5yB5727136DBLHs4UPW7xaLn_dT5qMEfqm9A@mail.gmail.com>
Date:   Wed, 14 Feb 2018 15:13:54 -0600
From:   Alan Tull <atull@...nel.org>
To:     Moritz Fischer <mdf@...nel.org>
Cc:     Wu Hao <hao.wu@...el.com>, linux-fpga@...r.kernel.org,
        linux-kernel <linux-kernel@...r.kernel.org>,
        linux-api@...r.kernel.org, "Kang, Luwei" <luwei.kang@...el.com>,
        "Zhang, Yi Z" <yi.z.zhang@...el.com>,
        Xiao Guangrong <guangrong.xiao@...ux.intel.com>,
        Tim Whisonant <tim.whisonant@...el.com>,
        Enno Luebbers <enno.luebbers@...el.com>,
        Shiva Rao <shiva.rao@...el.com>,
        Christopher Rauer <christopher.rauer@...el.com>
Subject: Re: [PATCH v4 07/24] fpga: dfl: add feature device infrastructure

On Wed, Feb 14, 2018 at 3:03 PM, Moritz Fischer <mdf@...nel.org> wrote:

Hi Moritz,

> HI Hao,
>
> On Tue, Feb 13, 2018 at 05:24:36PM +0800, Wu Hao wrote:
>> From: Xiao Guangrong <guangrong.xiao@...ux.intel.com>
>>
>> This patch abstracts the common operations of the sub features, and defines
>> the feature_ops data structure, including init, uinit and ioctl function
>> pointers. And this patch adds some common helper functions for FME and AFU
>> drivers, e.g feature_dev_use_begin/end which are used to ensure exclusive
>> usage of the feature device file.
>>
>> Signed-off-by: Tim Whisonant <tim.whisonant@...el.com>
>> Signed-off-by: Enno Luebbers <enno.luebbers@...el.com>
>> Signed-off-by: Shiva Rao <shiva.rao@...el.com>
>> Signed-off-by: Christopher Rauer <christopher.rauer@...el.com>
>> Signed-off-by: Kang Luwei <luwei.kang@...el.com>
>> Signed-off-by: Zhang Yi <yi.z.zhang@...el.com>
>> Signed-off-by: Xiao Guangrong <guangrong.xiao@...ux.intel.com>
>> Signed-off-by: Wu Hao <hao.wu@...el.com>
>> ---
>> v2: rebased
>> v3: use const for feature_ops.
>>     replace pci related function.
>> v4: rebase and add more comments in code.
>> ---
>>  drivers/fpga/dfl.c | 59 +++++++++++++++++++++++++++++++++++++
>>  drivers/fpga/dfl.h | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
>>  2 files changed, 143 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/fpga/dfl.c b/drivers/fpga/dfl.c
>> index 38dc819..c0aad87 100644
>> --- a/drivers/fpga/dfl.c
>> +++ b/drivers/fpga/dfl.c
>> @@ -74,6 +74,65 @@ static enum fpga_id_type feature_dev_id_type(struct platform_device *pdev)
>>       return FPGA_ID_MAX;
>>  }
>>
>> +void fpga_dev_feature_uinit(struct platform_device *pdev)
>> +{
>> +     struct feature *feature;
>> +     struct feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
> See comment below w.r.t ordering declarations. Not a must for sure.
>> +
>> +     fpga_dev_for_each_feature(pdata, feature)
>> +             if (feature->ops) {
>> +                     feature->ops->uinit(pdev, feature);
>> +                     feature->ops = NULL;
>> +             }
>> +}
>> +EXPORT_SYMBOL_GPL(fpga_dev_feature_uinit);
>> +
>> +static int
>> +feature_instance_init(struct platform_device *pdev,
>> +                   struct feature_platform_data *pdata,
>> +                   struct feature *feature, struct feature_driver *drv)
>> +{
>> +     int ret;
>> +
>> +     WARN_ON(!feature->ioaddr);
>
> Not sure I understand correctly, is the !feature->ioaddr a use-case that
> happens? If not just return early.
>> +
>> +     ret = drv->ops->init(pdev, feature);
>> +     if (ret)
>> +             return ret;
>> +
>> +     feature->ops = drv->ops;
>> +
>> +     return ret;
>> +}
>> +
>> +int fpga_dev_feature_init(struct platform_device *pdev,
>> +                       struct feature_driver *feature_drvs)
>> +{
>> +     struct feature *feature;
>> +     struct feature_driver *drv = feature_drvs;
>> +     struct feature_platform_data *pdata = dev_get_platdata(&pdev->dev);
>> +     int ret;
> We don't have clear guidelines here, but some subsystems want reverse
> X-Mas tree declarations.

Sounds good!  I agree.

Alan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ