<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/hwmon/applesmc.c, branch v6.19.11</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.19.11'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2021-10-12T14:22:41+00:00</updated>
<entry>
<title>hwmon: cleanup non-bool "valid" data fields</title>
<updated>2021-10-12T14:22:41+00:00</updated>
<author>
<name>Paul Fertser</name>
<email>fercerpav@gmail.com</email>
</author>
<published>2021-09-24T19:52:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=952a11ca32a6046ab86bf885a7805c935f71d5c8'/>
<id>urn:sha1:952a11ca32a6046ab86bf885a7805c935f71d5c8</id>
<content type='text'>
We have bool so use it consistently in all the drivers.

The following Coccinelle script was used:

@@
identifier T;
type t = { char, int };
@@
struct T {
...
-	t valid;
+	bool valid;
...
}

@@
identifier v;
@@
(
- v-&gt;valid = 0
+ v-&gt;valid = false
|
- v-&gt;valid = 1
+ v-&gt;valid = true
)

followed by sed to fixup the comments:
sed '/bool valid;/{s/!=0/true/;s/zero/false/}'

Few whitespace changes were fixed manually. All modified drivers were
compile-tested.

Signed-off-by: Paul Fertser &lt;fercerpav@gmail.com&gt;
Link: https://lore.kernel.org/r/20210924195202.27917-1-fercerpav@gmail.com
[groeck: Fixed up 'u8 valid' to 'boool valid' in atxp1.c]
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: replace snprintf in show functions with sysfs_emit</title>
<updated>2021-04-20T13:50:14+00:00</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2021-03-22T03:49:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=1f4d4af4d7a1c794a4f003f75fcfd38fafb5dff3'/>
<id>urn:sha1:1f4d4af4d7a1c794a4f003f75fcfd38fafb5dff3</id>
<content type='text'>
coccicheck complains about the use of snprintf() in sysfs
show functions.

drivers/hwmon/ina3221.c:701:8-16: WARNING: use scnprintf or sprintf

This results in a large number of patch submissions. Fix it all in
one go using the following coccinelle rules. Use sysfs_emit instead
of scnprintf or sprintf since that makes more sense.

@depends on patch@
identifier show, dev, attr, buf;
@@

ssize_t show(struct device *dev, struct device_attribute *attr, char *buf)
{
	&lt;...
  return
-		snprintf(buf, \( PAGE_SIZE \| PAGE_SIZE - 1 \),
+		sysfs_emit(buf,
		...);
	...&gt;
}

@depends on patch@
identifier show, dev, attr, buf, rc;
@@

ssize_t show(struct device *dev, struct device_attribute *attr, char *buf)
{
	&lt;...
  rc =
-		snprintf(buf, \( PAGE_SIZE \| PAGE_SIZE - 1 \),
+		sysfs_emit(buf,
		...);
	...&gt;
}

While at it, remove unnecessary braces and as well as unnecessary
else after return statements to address checkpatch warnings in the
resulting patch.

Cc: Zihao Tang &lt;tangzihao1@hisilicon.com&gt;
Cc: Jay Fang &lt;f.fangjian@huawei.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Assign boolean values to a bool variable</title>
<updated>2021-01-28T01:44:18+00:00</updated>
<author>
<name>Jiapeng Zhong</name>
<email>abaci-bugfix@linux.alibaba.com</email>
</author>
<published>2021-01-20T06:41:10+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=0bf6a1e85ddd4000f461086d08260452aaf30302'/>
<id>urn:sha1:0bf6a1e85ddd4000f461086d08260452aaf30302</id>
<content type='text'>
Fix the following coccicheck warnings:

./drivers/hwmon/applesmc.c:568:6-23: WARNING: Assignment of
0/1 to bool variable.

Reported-by: Abaci Robot &lt;abaci@linux.alibaba.com&gt;
Signed-off-by: Jiapeng Zhong &lt;abaci-bugfix@linux.alibaba.com&gt;
Link: https://lore.kernel.org/r/1611124870-125658-1-git-send-email-abaci-bugfix@linux.alibaba.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Add DMI product matches for Intel-based Xserves (non-RackMac*)</title>
<updated>2020-12-03T01:42:24+00:00</updated>
<author>
<name>Joe Jamison</name>
<email>joejamison717@gmail.com</email>
</author>
<published>2020-11-28T16:54:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6cbf7964b4af7952add97f440a6ceb6564451897'/>
<id>urn:sha1:6cbf7964b4af7952add97f440a6ceb6564451897</id>
<content type='text'>
This patch adds the DMI Product ID for Intel-based Xserve machines.
They use the same SMC accessible from the same data ports.

The 'Xserve' product ID only resolves to SMC-containing
Intel-based Xserves, as the PowerPC machines are identified
by the 'RackMac' identifier.

Tested on: Xserve3,1

Tested-by: Joe Jamison &lt;joe@smaklab.com&gt; # Xserve3,1
Signed-off-by: Joe Jamison &lt;joe@smaklab.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Re-work SMC comms</title>
<updated>2020-11-12T15:00:59+00:00</updated>
<author>
<name>Brad Campbell</name>
<email>brad@fnarfbargle.com</email>
</author>
<published>2020-11-12T03:08:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=4d64bb4ba5ecf4831448cdb2fe16d0ae91b2b40b'/>
<id>urn:sha1:4d64bb4ba5ecf4831448cdb2fe16d0ae91b2b40b</id>
<content type='text'>
Commit fff2d0f701e6 ("hwmon: (applesmc) avoid overlong udelay()")
introduced an issue whereby communication with the SMC became
unreliable with write errors like :

[  120.378614] applesmc: send_byte(0x00, 0x0300) fail: 0x40
[  120.378621] applesmc: LKSB: write data fail
[  120.512782] applesmc: send_byte(0x00, 0x0300) fail: 0x40
[  120.512787] applesmc: LKSB: write data fail

The original code appeared to be timing sensitive and was not reliable
with the timing changes in the aforementioned commit.

This patch re-factors the SMC communication to remove the timing
dependencies and restore function with the changes previously
committed.

Tested on : MacbookAir6,2 MacBookPro11,1 iMac12,2, MacBookAir1,1,
MacBookAir3,1

Fixes: fff2d0f701e6 ("hwmon: (applesmc) avoid overlong udelay()")
Reported-by: Andreas Kemnade &lt;andreas@kemnade.info&gt;
Tested-by: Andreas Kemnade &lt;andreas@kemnade.info&gt; # MacBookAir6,2
Acked-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Brad Campbell &lt;brad@fnarfbargle.com&gt;
Signed-off-by: Henrik Rydberg &lt;rydberg@bitmath.org&gt;
Link: https://lore.kernel.org/r/194a7d71-a781-765a-d177-c962ef296b90@fnarfbargle.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) check status earlier.</title>
<updated>2020-08-21T18:32:34+00:00</updated>
<author>
<name>Tom Rix</name>
<email>trix@redhat.com</email>
</author>
<published>2020-08-20T13:19:32+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cecf7560f00a8419396a2ed0f6e5d245ccb4feac'/>
<id>urn:sha1:cecf7560f00a8419396a2ed0f6e5d245ccb4feac</id>
<content type='text'>
clang static analysis reports this representative problem

applesmc.c:758:10: warning: 1st function call argument is an
  uninitialized value
        left = be16_to_cpu(*(__be16 *)(buffer + 6)) &gt;&gt; 2;
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

buffer is filled by the earlier call

	ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, ...

This problem is reported because a goto skips the status check.
Other similar problems use data from applesmc_read_key before checking
the status.  So move the checks to before the use.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Reviewed-by: Henrik Rydberg &lt;rydberg@bitmath.org&gt;
Link: https://lore.kernel.org/r/20200820131932.10590-1-trix@redhat.com
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) avoid overlong udelay()</title>
<updated>2020-05-27T16:18:13+00:00</updated>
<author>
<name>Arnd Bergmann</name>
<email>arnd@arndb.de</email>
</author>
<published>2020-05-27T13:51:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fff2d0f701e6753591609739f8ab9be1c8e80ebb'/>
<id>urn:sha1:fff2d0f701e6753591609739f8ab9be1c8e80ebb</id>
<content type='text'>
Building this driver with "clang -O3" produces a link error
after the compiler partially unrolls the loop and 256ms
becomes a compile-time constant that triggers the check
in udelay():

ld.lld: error: undefined symbol: __bad_udelay
&gt;&gt;&gt; referenced by applesmc.c
&gt;&gt;&gt;               hwmon/applesmc.o:(read_smc) in archive drivers/built-in.a

I can see no reason against using a sleeping function here,
as no part of the driver runs in atomic context, so instead use
usleep_range() with a wide range and use jiffies for the
end condition.

Signed-off-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Link: https://lore.kernel.org/r/20200527135207.1118624-1-arnd@arndb.de
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) switch to using input device polling mode</title>
<updated>2019-11-06T22:37:18+00:00</updated>
<author>
<name>Dmitry Torokhov</name>
<email>dmitry.torokhov@gmail.com</email>
</author>
<published>2019-10-02T21:43:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=58d5aa5c75ce5748a489c3b8916de9b448d954b7'/>
<id>urn:sha1:58d5aa5c75ce5748a489c3b8916de9b448d954b7</id>
<content type='text'>
Now that instances of input_dev support polling mode natively,
we no longer need to create input_polled_dev instance.

Signed-off-by: Dmitry Torokhov &lt;dmitry.torokhov@gmail.com&gt;
Link: https://lore.kernel.org/r/20191002214345.GA108728@dtor-ws
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 271</title>
<updated>2019-06-05T15:30:30+00:00</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2019-05-29T14:12:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=21eb0be9ace70fc8bccf767617ba018e02d0bb82'/>
<id>urn:sha1:21eb0be9ace70fc8bccf767617ba018e02d0bb82</id>
<content type='text'>
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license v2 as published
  by the free software foundation this program is distributed in the
  hope that it will be useful but without any warranty without even
  the implied warranty of merchantability or fitness for a particular
  purpose see the gnu general public license for more details you
  should have received a copy of the gnu general public license along
  with this program if not write to the free software foundation inc
  51 franklin street fifth floor boston ma 02110 1301 usa

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 4 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Reviewed-by: Richard Fontana &lt;rfontana@redhat.com&gt;
Reviewed-by: Alexios Zavras &lt;alexios.zavras@intel.com&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190529141334.424952652@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>hwmon: (applesmc) Replace S_&lt;PERMS&gt; with octal values</title>
<updated>2018-12-16T23:13:39+00:00</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2018-12-10T22:02:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=71ee4a400013ad187393b9cb32faee98d520516e'/>
<id>urn:sha1:71ee4a400013ad187393b9cb32faee98d520516e</id>
<content type='text'>
Replace S_&lt;PERMS&gt; with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Cc: Henrik Rydberg &lt;rydberg@bitmath.org&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
</content>
</entry>
</feed>
