public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: atull <atull@opensource.altera.com>
To: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Cc: Pavel Machek <pavel@denx.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	jgunthorpe@obsidianresearch.com, hpa@zytor.com,
	Michal Simek <monstr@monstr.eu>,
	michal.simek@xilinx.com, rdunlap@infradead.org,
	linux-kernel <linux-kernel@vger.kernel.org>,
	devicetree@vger.kernel.org, robh+dt@kernel.org,
	Grant Likely <grant.likely@linaro.org>,
	iws@ovro.caltech.edu, linux-doc@vger.kernel.org,
	Mark Brown <broonie@kernel.org>,
	philip@balister.org, rubini@gnudd.com,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	jason@lakedaemon.net, kyle.teske@ni.com, nico@linaro.org,
	Felipe Balbi <balbi@ti.com>,
	m.chehab@samsung.com, davidb@codeaurora.org,
	Rob Landley <rob@landley.net>,
	davem@davemloft.net, cesarb@cesarb.net, sameo@linux.intel.com,
	akpm@linux-foundation.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Alan Tull <delicious.quinoa@gmail.com>
Subject: Re: [PATCH v2 2/3] fpga manager: framework core
Date: Fri, 24 Oct 2014 09:54:00 -0500	[thread overview]
Message-ID: <alpine.DEB.2.02.1410240906340.23446@atx-linux-37> (raw)
In-Reply-To: <B914D894-E486-4EF1-8F84-169E939C58B4@konsulko.com>

[-- Attachment #1: Type: text/plain, Size: 3664 bytes --]

On Fri, 24 Oct 2014, Pantelis Antoniou wrote:

> Hi Pavel,
> 
> > On Oct 24, 2014, at 1:52 PM, Pavel Machek <pavel@denx.de> wrote:
> > 
> > Hi!
> > 
> >> * /sys/class/fpga_manager/<fpga>/firmware
> >>  Name of FPGA image file to load using firmware class.
> >>  $ echo image.rbf > /sys/class/fpga_manager/<fpga>/firmware
> > 
> > I .. still don't think this is good idea. What about namespaces?
> > The path corresponds to path in which namespace?
> > 

Hi Pavel,

Sorry if my documentation is too brief here.  The context is the
firmware class.  The 'image.rbf' is a image file that is located
on the filesystem in the firmware search patch.
See Documentation/firmware_class/README.

Basically we need some way of loading a FPGA image to the FPGA.
I don't think any one way is going to meet everybody's needs so
I wanted to export enough functions from fpga-mgr.c that other
interfaces can by built.  I think firmware will work just fine
for some people and it is great in that it already exists in the
kernel.

If I missed your point, please let me know.

> 
> FWIW the overlays patchset uses binary configfs attribute to make this work.
> 

Hi Pantelis,

Yes I think you've mentioned that before.  So that would be another
way of giving a device tree overlay to configfs, right?  I should
that to the documentation in the patch header.

> >> +int fpga_mgr_write(struct fpga_manager *mgr, const char *buf, size_t count)
> >> +{
> >> +	int ret;
> >> +
> >> +	if (test_and_set_bit_lock(FPGA_MGR_BUSY, &mgr->flags))
> >> +		return -EBUSY;
> >> +
> >> +	dev_info(mgr->dev, "writing buffer to %s\n", mgr->name);
> >> +
> >> +	ret = __fpga_mgr_write(mgr, buf, count);
> >> +	clear_bit_unlock(FPGA_MGR_BUSY, &mgr->flags);
> >> +
> >> +	return ret;
> >> +}
> >> +EXPORT_SYMBOL_GPL(fpga_mgr_write);
> > 
> > Is the EBUSY -- userspace please try again, but you don't know when to
> > try again -- right interface? I mean, normally kernel would wait, so
> > that userland does not have to poll?
> > 

Yes, for fpga_mgr_write it may be more useful for this to be
a blocking call.

> >> +static ssize_t fpga_mgr_firmware_store(struct device *dev,
> >> +				       struct device_attribute *attr,
> >> +				       const char *buf, size_t count)
> >> +{
> >> +	struct fpga_manager *mgr = dev_get_drvdata(dev);
> >> +	unsigned int len;
> >> +	char image_name[NAME_MAX];
> >> +	int ret;
> >> +
> >> +	/* lose terminating \n */
> >> +	strcpy(image_name, buf);
> >> +	len = strlen(image_name);
> >> +	if (image_name[len - 1] == '\n')
> >> +		image_name[len - 1] = 0;
> >> +
> >> +	ret = fpga_mgr_firmware_write(mgr, image_name);
> >> +	if (ret)
> >> +		return ret;
> >> +
> >> +	return count;
> >> +}
> > 
> > This shows why the interface is not right... Valid filename may
> > contain \n, right? It may even end with \n.
> > 
> 
> I could argue that a valid firmware file is one that’s well formed and does not
> contain those characters.
> 
> I guess this is only for make echo file >foo work. You could specify that echo -n file >foo is
> required.
> 

I am accustomed to doing 'echo -n' for most of sysfs anyway.  Once in a
while I am a bonehead and forget the '-n' and spend a few minutes
wondering why this thing that worked last week suddenly rejects all
commands.  I'm just trying to make my user interface a bit user-friendly.

I will take out the '\n' stripping and update the documentation.  I didn't
realize this would be controversial.

Alan

> 
> > Best regards,
> > 									Pavel
> > -- 
> > (english) http://www.livejournal.com/~pavelmachek
> > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> 
> Regards
> 
> — Pantelis
> 
> 

  reply	other threads:[~2014-10-24 14:54 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 19:50 [PATCH v2 0/3] FPGA Framework with DT and sysfs support atull-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
2014-10-22 19:50 ` [PATCH v2 1/3] fpga manager: add sysfs interface document atull
2014-10-22 19:50 ` [PATCH v2 2/3] fpga manager: framework core atull
2014-10-24 10:52   ` Pavel Machek
2014-10-24 10:55     ` Pantelis Antoniou
2014-10-24 14:54       ` atull [this message]
2014-12-06 13:01         ` Grant Likely
2014-12-06 13:55           ` Pavel Machek
2014-12-08 17:50             ` Grant Likely
2014-12-08 17:56               ` Grant Likely
2014-12-08 17:56               ` Pantelis Antoniou
2014-12-08 18:30                 ` Grant Likely
2014-12-08 20:53               ` Rob Landley
2014-10-24 21:00     ` One Thousand Gnomes
2014-12-06 13:00     ` Grant Likely
2014-12-06 14:02       ` Pavel Machek
     [not found]       ` <CACxGe6sa=ysJAjx5TQZH5sKoas1PkoUUR4zT=Z35+uF6rrk-vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-12-08 22:55         ` One Thousand Gnomes
2014-12-09 13:11           ` Grant Likely
2014-12-09 13:42             ` Michal Simek
2014-12-09 16:07           ` atull
2014-12-09 21:02             ` One Thousand Gnomes
2014-12-09 22:12               ` atull
2014-12-12 12:14               ` Pavel Machek
2014-12-18 20:50         ` atull
2014-10-22 19:50 ` [PATCH v2 3/3] fpga manager: bus driver atull
2014-10-22 22:22   ` atull

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1410240906340.23446@atx-linux-37 \
    --to=atull@opensource.altera.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbi@ti.com \
    --cc=broonie@kernel.org \
    --cc=cesarb@cesarb.net \
    --cc=davem@davemloft.net \
    --cc=davidb@codeaurora.org \
    --cc=delicious.quinoa@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=iws@ovro.caltech.edu \
    --cc=jason@lakedaemon.net \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=kyle.teske@ni.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=michal.simek@xilinx.com \
    --cc=monstr@monstr.eu \
    --cc=nico@linaro.org \
    --cc=pantelis.antoniou@konsulko.com \
    --cc=pavel@denx.de \
    --cc=philip@balister.org \
    --cc=rdunlap@infradead.org \
    --cc=rob@landley.net \
    --cc=robh+dt@kernel.org \
    --cc=rubini@gnudd.com \
    --cc=s.trumtrar@pengutronix.de \
    --cc=sameo@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox