Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1427002 > unrolled thread
| Started by | Davidlohr Bueso <dave@stgolabs.net> |
|---|---|
| First post | 2016-06-20 22:20 +0200 |
| Last post | 2016-06-22 10:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 06/12] HID,wacom: Employ atomic_fetch_inc() Davidlohr Bueso <dave@stgolabs.net> - 2016-06-20 22:20 +0200
Re: [PATCH 06/12] HID,wacom: Employ atomic_fetch_inc() Jiri Kosina <jikos@kernel.org> - 2016-06-22 10:20 +0200
| From | Davidlohr Bueso <dave@stgolabs.net> |
|---|---|
| Date | 2016-06-20 22:20 +0200 |
| Subject | [PATCH 06/12] HID,wacom: Employ atomic_fetch_inc() |
| Message-ID | <rMdPQ-4rx-11@gated-at.bofh.it> |
Now that we have fetch_inc() we can stop using inc_return() - 1.
These are very similar to the existing OP-RETURN primitives we already
have, except they return the value of the atomic variable _before_
modification.
Cc: Jiri Kosina <jikos@kernel.org>
Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
drivers/hid/wacom_sys.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
index 499cc8213cfe..88bde7687edd 100644
--- a/drivers/hid/wacom_sys.c
+++ b/drivers/hid/wacom_sys.c
@@ -1088,7 +1088,7 @@ static int wacom_initialize_battery(struct wacom *wacom)
if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) {
struct power_supply_desc *bat_desc = &wacom->battery_desc;
struct power_supply_desc *ac_desc = &wacom->ac_desc;
- n = atomic_inc_return(&battery_no) - 1;
+ n = atomic_fetch_inc(&battery_no);
bat_desc->properties = wacom_battery_props;
bat_desc->num_properties = ARRAY_SIZE(wacom_battery_props);
--
2.6.6
[toc] | [next] | [standalone]
| From | Jiri Kosina <jikos@kernel.org> |
|---|---|
| Date | 2016-06-22 10:20 +0200 |
| Message-ID | <rMLy9-Wz-5@gated-at.bofh.it> |
| In reply to | #1427002 |
On Mon, 20 Jun 2016, Davidlohr Bueso wrote:
> Now that we have fetch_inc() we can stop using inc_return() - 1.
>
> These are very similar to the existing OP-RETURN primitives we already
> have, except they return the value of the atomic variable _before_
> modification.
>
> Cc: Jiri Kosina <jikos@kernel.org>
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
Acked-by: Jiri Kosina <jkosina@suse.cz>
> ---
> drivers/hid/wacom_sys.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c
> index 499cc8213cfe..88bde7687edd 100644
> --- a/drivers/hid/wacom_sys.c
> +++ b/drivers/hid/wacom_sys.c
> @@ -1088,7 +1088,7 @@ static int wacom_initialize_battery(struct wacom *wacom)
> if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_BATTERY) {
> struct power_supply_desc *bat_desc = &wacom->battery_desc;
> struct power_supply_desc *ac_desc = &wacom->ac_desc;
> - n = atomic_inc_return(&battery_no) - 1;
> + n = atomic_fetch_inc(&battery_no);
>
> bat_desc->properties = wacom_battery_props;
> bat_desc->num_properties = ARRAY_SIZE(wacom_battery_props);
> --
> 2.6.6
>
--
Jiri Kosina
SUSE Labs
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web