public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: Chris Boot <bootc@bootc.net>
Cc: linux1394-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org,
	Clemens Ladisch <clemens@ladisch.de>
Subject: Re: [RFC][PATCH] firewire: Add function to get speed from opaque struct fw_request
Date: Tue, 7 Feb 2012 19:15:17 +0100	[thread overview]
Message-ID: <20120207191517.7b73978c@stein> (raw)
In-Reply-To: <1328566661-80768-1-git-send-email-bootc@bootc.net>

On Feb 06 Chris Boot wrote:
> [ Would something like the following be acceptable as an addition to the
> FireWire stack? This would be enough for me to get the speed of the
> request for my work on the SBP-2 target code. ]
[...]
> --- a/drivers/firewire/core-transaction.c
> +++ b/drivers/firewire/core-transaction.c
> @@ -820,6 +820,12 @@ void fw_send_response(struct fw_card *card,
>  }
>  EXPORT_SYMBOL(fw_send_response);
>  
> +int fw_request_speed(struct fw_request *request)
> +{
> +	return request->response.speed;
> +}
> +EXPORT_SYMBOL(fw_request_speed);
> +
>  static void handle_exclusive_region_request(struct fw_card *card,
>  					    struct fw_packet *p,
>  					    struct fw_request *request,
> diff --git a/include/linux/firewire.h b/include/linux/firewire.h
> index 84ccf8e..eded4e4 100644
> --- a/include/linux/firewire.h
> +++ b/include/linux/firewire.h
> @@ -340,6 +340,7 @@ int fw_core_add_address_handler(struct fw_address_handler *handler,
>  void fw_core_remove_address_handler(struct fw_address_handler *handler);
>  void fw_send_response(struct fw_card *card,
>  		      struct fw_request *request, int rcode);
> +int fw_request_speed(struct fw_request *request);
>  void fw_send_request(struct fw_card *card, struct fw_transaction *t,
>  		     int tcode, int destination_id, int generation, int speed,
>  		     unsigned long long offset, void *payload, size_t length,

Whenever you add a new exported function, please add a brief kerneldoc
comment right above its definition.  Can be a one-liner in this case.
Apart from this,

Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

You can queue this via your SBP-2 target patch series (at which I haven't
looked yet), followed right away by a change to your driver which uses the
new symbol.  Or even better, fold these two changes into one.

Not sure if four more characters should be spent on the symbol's name
(fw_get_request_speed).  If you already thought about it and preferred
fw_request_speed, keep it that way.

There are at least two alternatives to your proposal:

  - We could move the definition of struct fw_request from
    drivers/firewire/core-transaction.c to include/linux/firewire.h.
    That would make for a rather bad driver API though.

  - We could expand the function type fw_address_callback_t() by a speed
    argument.  The other users of the API (firewire-core itself,
    firewire-sbp2, firewire-net, firedtv, snd-firewire-lib, and other
    as yet unmerged firewire sound drivers) and any other perceivable
    future user of the API would not care of that speed though.

I.e. the proposed "get speed of request" helper seems better.
-- 
Stefan Richter
-=====-===-- --=- --===
http://arcgraph.de/sr/

  reply	other threads:[~2012-02-07 18:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 22:17 [RFC][PATCH] firewire: Add function to get speed from opaque struct fw_request Chris Boot
2012-02-07 18:15 ` Stefan Richter [this message]
2012-02-07 19:41   ` Chris Boot

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=20120207191517.7b73978c@stein \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=bootc@bootc.net \
    --cc=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /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