All of lore.kernel.org
 help / color / mirror / Atom feed
From: noralf@tronnes.org (Noralf Trønnes)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver
Date: Fri, 29 May 2015 05:18:05 +0200	[thread overview]
Message-ID: <5567DA6D.8080207@tronnes.org> (raw)
In-Reply-To: <1432858055-8750-2-git-send-email-eric@anholt.net>


Den 29.05.2015 02:07, skrev Eric Anholt:
> This gives us a function for making mailbox property channel requests
> of the firmware, which is most notable in that it will let us get and
> set clock rates.
...
> +/**
> + * rpi_firmware_property_list - Submit firmware property list
> + * @of_node:	Pointer to the firmware Device Tree node.

Update kdoc to reflect change:
  * @fw: Pointer to firmware structure

> + * @data:	Buffer holding tags.
> + * @tag_size:	Size of tags buffer.
> + *
> + * Submits a set of concatenated tags to the VPU firmware through the
> + * mailbox property interface.
> + *
> + * The buffer header and the ending tag are added by this function and
> + * don't need to be supplied, just the actual tags for your operation.
> + * See struct rpi_firmware_property_tag_header for the per-tag
> + * structure.
> + */
> +int rpi_firmware_property_list(struct rpi_firmware *fw,
> +			       void *data, size_t tag_size)
> +{
...

> +/**
> + * rpi_firmware_property - Submit single firmware property
> + * @of_node:	Pointer to the firmware Device Tree node.

Same:
  * @fw: Pointer to firmware structure

> + * @tag:	One of enum_mbox_property_tag.
> + * @tag_data:	Tag data buffer.
> + * @buf_size:	Buffer size.
> + *
> + * Submits a single tag to the VPU firmware through the mailbox
> + * property interface.
> + *
> + * This is a convenience wrapper around
> + * rpi_firmware_property_list() to avoid some of the
> + * boilerplate in property calls.
> + */
> +int rpi_firmware_property(struct rpi_firmware *fw,
> +			  u32 tag, void *tag_data, size_t buf_size)
> +{
...

> +/*
> + * Returns the struct rpi_firmware if the firmware device is probed
> + * and available, otherwise NULL.
> + */

kdoc:
/**
  * rpi_firmware_get - Get pointer to rpi_firmware structure.
  * @of_node:    Pointer to the firmware Device Tree node.
  *
  * Returns NULL is the firmware device is not ready.
  */

> +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node)
> +{
> +	struct platform_device *pdev = of_find_device_by_node(firmware_node);
> +
> +	if (!pdev)
> +		return NULL;
> +
> +	if (!pdev->dev.driver)
> +		return NULL;
> +
> +	if (!try_module_get(pdev->dev.driver->owner))
> +		return NULL;
> +

Sigh, I think I was wrong about suggesting try_module_get here. A module 
can't be
unloaded if another loaded module depends on one it's exported symbols.
So this firmware module can't be unloaded if a client module is loaded.
So it shouldn't be necessary.

> +	return platform_get_drvdata(pdev);
> +}
> +EXPORT_SYMBOL_GPL(rpi_firmware_get);
> +
> +void rpi_firmware_put(struct rpi_firmware *fw)
> +{
> +	struct device *dev = fw->cl.dev;
> +
> +	module_put(dev->driver->owner);
> +}
> +EXPORT_SYMBOL_GPL(rpi_firmware_put);

So rpi_firmware_put() won't be needed then, sorry.

However the API feels much better now with this change.

WARNING: multiple messages have this Message-ID (diff)
From: "Noralf Trønnes" <noralf-L59+Z2yzLopAfugRpC6u6w@public.gmane.org>
To: Eric Anholt <eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rpi-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v5 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver
Date: Fri, 29 May 2015 05:18:05 +0200	[thread overview]
Message-ID: <5567DA6D.8080207@tronnes.org> (raw)
In-Reply-To: <1432858055-8750-2-git-send-email-eric-WhKQ6XTQaPysTnJN9+BGXg@public.gmane.org>


Den 29.05.2015 02:07, skrev Eric Anholt:
> This gives us a function for making mailbox property channel requests
> of the firmware, which is most notable in that it will let us get and
> set clock rates.
...
> +/**
> + * rpi_firmware_property_list - Submit firmware property list
> + * @of_node:	Pointer to the firmware Device Tree node.

Update kdoc to reflect change:
  * @fw: Pointer to firmware structure

> + * @data:	Buffer holding tags.
> + * @tag_size:	Size of tags buffer.
> + *
> + * Submits a set of concatenated tags to the VPU firmware through the
> + * mailbox property interface.
> + *
> + * The buffer header and the ending tag are added by this function and
> + * don't need to be supplied, just the actual tags for your operation.
> + * See struct rpi_firmware_property_tag_header for the per-tag
> + * structure.
> + */
> +int rpi_firmware_property_list(struct rpi_firmware *fw,
> +			       void *data, size_t tag_size)
> +{
...

> +/**
> + * rpi_firmware_property - Submit single firmware property
> + * @of_node:	Pointer to the firmware Device Tree node.

Same:
  * @fw: Pointer to firmware structure

> + * @tag:	One of enum_mbox_property_tag.
> + * @tag_data:	Tag data buffer.
> + * @buf_size:	Buffer size.
> + *
> + * Submits a single tag to the VPU firmware through the mailbox
> + * property interface.
> + *
> + * This is a convenience wrapper around
> + * rpi_firmware_property_list() to avoid some of the
> + * boilerplate in property calls.
> + */
> +int rpi_firmware_property(struct rpi_firmware *fw,
> +			  u32 tag, void *tag_data, size_t buf_size)
> +{
...

> +/*
> + * Returns the struct rpi_firmware if the firmware device is probed
> + * and available, otherwise NULL.
> + */

kdoc:
/**
  * rpi_firmware_get - Get pointer to rpi_firmware structure.
  * @of_node:    Pointer to the firmware Device Tree node.
  *
  * Returns NULL is the firmware device is not ready.
  */

> +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node)
> +{
> +	struct platform_device *pdev = of_find_device_by_node(firmware_node);
> +
> +	if (!pdev)
> +		return NULL;
> +
> +	if (!pdev->dev.driver)
> +		return NULL;
> +
> +	if (!try_module_get(pdev->dev.driver->owner))
> +		return NULL;
> +

Sigh, I think I was wrong about suggesting try_module_get here. A module 
can't be
unloaded if another loaded module depends on one it's exported symbols.
So this firmware module can't be unloaded if a client module is loaded.
So it shouldn't be necessary.

> +	return platform_get_drvdata(pdev);
> +}
> +EXPORT_SYMBOL_GPL(rpi_firmware_get);
> +
> +void rpi_firmware_put(struct rpi_firmware *fw)
> +{
> +	struct device *dev = fw->cl.dev;
> +
> +	module_put(dev->driver->owner);
> +}
> +EXPORT_SYMBOL_GPL(rpi_firmware_put);

So rpi_firmware_put() won't be needed then, sorry.

However the API feels much better now with this change.


--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: "Noralf Trønnes" <noralf@tronnes.org>
To: Eric Anholt <eric@anholt.net>, linux-arm-kernel@lists.infradead.org
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org
Subject: Re: [PATCH v5 2/3] ARM: bcm2835: Add the Raspberry Pi firmware driver
Date: Fri, 29 May 2015 05:18:05 +0200	[thread overview]
Message-ID: <5567DA6D.8080207@tronnes.org> (raw)
In-Reply-To: <1432858055-8750-2-git-send-email-eric@anholt.net>


Den 29.05.2015 02:07, skrev Eric Anholt:
> This gives us a function for making mailbox property channel requests
> of the firmware, which is most notable in that it will let us get and
> set clock rates.
...
> +/**
> + * rpi_firmware_property_list - Submit firmware property list
> + * @of_node:	Pointer to the firmware Device Tree node.

Update kdoc to reflect change:
  * @fw: Pointer to firmware structure

> + * @data:	Buffer holding tags.
> + * @tag_size:	Size of tags buffer.
> + *
> + * Submits a set of concatenated tags to the VPU firmware through the
> + * mailbox property interface.
> + *
> + * The buffer header and the ending tag are added by this function and
> + * don't need to be supplied, just the actual tags for your operation.
> + * See struct rpi_firmware_property_tag_header for the per-tag
> + * structure.
> + */
> +int rpi_firmware_property_list(struct rpi_firmware *fw,
> +			       void *data, size_t tag_size)
> +{
...

> +/**
> + * rpi_firmware_property - Submit single firmware property
> + * @of_node:	Pointer to the firmware Device Tree node.

Same:
  * @fw: Pointer to firmware structure

> + * @tag:	One of enum_mbox_property_tag.
> + * @tag_data:	Tag data buffer.
> + * @buf_size:	Buffer size.
> + *
> + * Submits a single tag to the VPU firmware through the mailbox
> + * property interface.
> + *
> + * This is a convenience wrapper around
> + * rpi_firmware_property_list() to avoid some of the
> + * boilerplate in property calls.
> + */
> +int rpi_firmware_property(struct rpi_firmware *fw,
> +			  u32 tag, void *tag_data, size_t buf_size)
> +{
...

> +/*
> + * Returns the struct rpi_firmware if the firmware device is probed
> + * and available, otherwise NULL.
> + */

kdoc:
/**
  * rpi_firmware_get - Get pointer to rpi_firmware structure.
  * @of_node:    Pointer to the firmware Device Tree node.
  *
  * Returns NULL is the firmware device is not ready.
  */

> +struct rpi_firmware *rpi_firmware_get(struct device_node *firmware_node)
> +{
> +	struct platform_device *pdev = of_find_device_by_node(firmware_node);
> +
> +	if (!pdev)
> +		return NULL;
> +
> +	if (!pdev->dev.driver)
> +		return NULL;
> +
> +	if (!try_module_get(pdev->dev.driver->owner))
> +		return NULL;
> +

Sigh, I think I was wrong about suggesting try_module_get here. A module 
can't be
unloaded if another loaded module depends on one it's exported symbols.
So this firmware module can't be unloaded if a client module is loaded.
So it shouldn't be necessary.

> +	return platform_get_drvdata(pdev);
> +}
> +EXPORT_SYMBOL_GPL(rpi_firmware_get);
> +
> +void rpi_firmware_put(struct rpi_firmware *fw)
> +{
> +	struct device *dev = fw->cl.dev;
> +
> +	module_put(dev->driver->owner);
> +}
> +EXPORT_SYMBOL_GPL(rpi_firmware_put);

So rpi_firmware_put() won't be needed then, sorry.

However the API feels much better now with this change.



  reply	other threads:[~2015-05-29  3:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-29  0:07 [PATCH v5 1/3] dt/bindings: Add binding for the Raspberry Pi firmware driver Eric Anholt
2015-05-29  0:07 ` Eric Anholt
2015-05-29  0:07 ` [PATCH v5 2/3] ARM: bcm2835: Add " Eric Anholt
2015-05-29  0:07   ` Eric Anholt
2015-05-29  0:07   ` Eric Anholt
2015-05-29  3:18   ` Noralf Trønnes [this message]
2015-05-29  3:18     ` Noralf Trønnes
2015-05-29  3:18     ` Noralf Trønnes
2015-05-29  0:07 ` [PATCH v5 3/3] ARM: bcm2835: Add the firmware driver information to the RPi DT Eric Anholt
2015-05-29  0:07   ` Eric Anholt
2015-05-29  0:07   ` Eric Anholt

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=5567DA6D.8080207@tronnes.org \
    --to=noralf@tronnes.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.