Grsecurity GPL Violations: Linus/FSF/SFConservancy won't defend. Claw back your copyrights. BSD-in-Practice was not the deal.

2021-01-01 Thread nipponmail

Silence is consent.

Are there FOSS developers making decent money via Patreon, GoFundMe, 
whatever?


Yes, Grsecurity is making good money.
They simply added a no-redistribution agreement to their patch of the 
Linux Kernel.
 ( 
https://perens.com/2017/06/28/warning-grsecurity-potential-contributory-infringement-risk-for-customers/ 
)



The FSF, Software Freedom Conservancy, and the Corporate Linux Kernel 
Developers all agree that this is fine (silence is consent).



https://twitter.com/spendergrsec/status/1293155787859206146
Importantly, neither the FSF nor the SFC, nor in fact any actual lawyer 
agrees with this bizarre claim from an anonymous troll. More info about 
the source of the claim can be found here: 
https://grsecurity.net/setting_the_record_straight_on_oss_v_perens_part1

Thanks for doing your part, "Dr" to continue the troll's harrassment


LOL. " #GRSecurity violates both the Linux kernel's copyright and the 
#GCC #copyright by forbidding redistribution of the patches (in their 
Access Agreement): which are non-seperable derivative works...



Contributors should blanket-revoke their contributions from all 
free-takers since they didn't agree to BSD-in-Practice. They should also 
claw-back any transferred copyrights from the FSF using the 30 year 
clawback provision in the US Copyright Act. Design of how a program 
works is a copyrightable aspect (Ex: How RMS designed GCC 30 years ago 
or so etc)


Had to repost this because the linux admins deleted the email:



https://lkml.org/lkml/2020/12/28/2518
The message you requested cannot be found.
The message you requested cannot be found. The message with the url 
http://feisty.lkml.org/lkml/2020/12/28/2518 does not exist in the 
database.


Grsecurity GPL Violations: Bring a CASE act claim every time GrSecurity 
releases a new infringing work?


(GRSecurity blatantly violates the clause in the Linux kernel and 
GCC copyright licenses regarding adding addtional terms between the 
licensee of the kernel / gcc and furthur down-the-line licensees, 
regarding derivative works)

(The linux kernel has 1000s of copyright holders)
(All who shake at the knees at the thought of initiating a federal 
Copyright lawsuit)


re

2021-01-01 Thread info6 .



Greetings
Compliment of the day and hope you are in good health in this time of pandemic 
crisis! You have been chosen to partake in a charity project in which you will 
get a cash donation of $16.5 million dollars to help victims Of Covid 19. And 
Less Privileges in your region. I look forward to your prompt reply.
Your sincerely,
Mrs. Mercy Taylor


[PATCH] media: media/pci: Fix memleak in empress_init

2021-01-01 Thread Dinghao Liu
When vb2_queue_init() fails, dev->empress_dev
should be released just like other error handling
paths.

Fixes: 2ada815fc48bb ("[media] saa7134: convert to vb2")
Signed-off-by: Dinghao Liu 
---
 drivers/media/pci/saa7134/saa7134-empress.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/pci/saa7134/saa7134-empress.c 
b/drivers/media/pci/saa7134/saa7134-empress.c
index 39e3c7f8c5b4..76a37fbd8458 100644
--- a/drivers/media/pci/saa7134/saa7134-empress.c
+++ b/drivers/media/pci/saa7134/saa7134-empress.c
@@ -282,8 +282,11 @@ static int empress_init(struct saa7134_dev *dev)
q->lock = >lock;
q->dev = >pci->dev;
err = vb2_queue_init(q);
-   if (err)
+   if (err) {
+   video_device_release(dev->empress_dev);
+   dev->empress_dev = NULL;
return err;
+   }
dev->empress_dev->queue = q;
dev->empress_dev->device_caps = V4L2_CAP_READWRITE | V4L2_CAP_STREAMING 
|
V4L2_CAP_VIDEO_CAPTURE;
-- 
2.17.1



Dearest in Mind,

2021-01-01 Thread Grace Obia
-- 

Dearest in Mind,

My name is Mrs. Katherine Rafael, a business woman an Ivorian Citizen
and born in 1961. I have a mission for you worth $3 500, 000,00 (Three
Million Five Hundred Thousand United State Dollars) which I intend
using for CHARITY.

I am a breast cancer woman and have told by doctor that I will die in
no distance future, now and want to donate this money for charity
through you by transferring this money to your account, to enable
people in your area benefit from it.

Could you be the one I will use in this noble transaction before I
will go for my surgery?


Mrs.Katherine Rafael


Re: [PATCH] Input: ar1021 - use IRQ_NOAUTOEN flags to replace disable_irq

2021-01-01 Thread Dmitry Torokhov
Hi Barry,

On Sat, Jan 02, 2021 at 05:29:02PM +1300, Barry Song wrote:
> disable_irq() after request_irq is unsafe as it gives a time gap which
> irq can come before disable_irq(). IRQ_NOAUTOEN is the common way to
> avoid enabling IRQ due to requesting IRQ.

Actually it is OK for the ISR to fire before the input device is
registered, input core allows that.

What I would like to see is to allow passing something like
IRQF_DISABLED to request_irq() so that we would not need neither
irq_set_status_flags() nor disable_irq().

Thanks.

-- 
Dmitry


[PATCH] Bluetooth: hci_qca: Fix memleak in qca_controller_memdump

2021-01-01 Thread Dinghao Liu
When __le32_to_cpu() fails, qca_memdump should be freed
just like when vmalloc() fails.

Fixes: d841502c79e3f ("Bluetooth: hci_qca: Collect controller memory dump 
during SSR")
Signed-off-by: Dinghao Liu 
---
 drivers/bluetooth/hci_qca.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 4a963682c702..5dbcb7c42b80 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1024,7 +1024,9 @@ static void qca_controller_memdump(struct work_struct 
*work)
dump_size = __le32_to_cpu(dump->dump_size);
if (!(dump_size)) {
bt_dev_err(hu->hdev, "Rx invalid memdump size");
+   kfree(qca_memdump);
kfree_skb(skb);
+   qca->qca_memdump = NULL;
mutex_unlock(>hci_memdump_lock);
return;
}
-- 
2.17.1



[PATCH] Input: ar1021 - use IRQ_NOAUTOEN flags to replace disable_irq

2021-01-01 Thread Barry Song
disable_irq() after request_irq is unsafe as it gives a time gap which
irq can come before disable_irq(). IRQ_NOAUTOEN is the common way to
avoid enabling IRQ due to requesting IRQ.

Signed-off-by: Barry Song 
---
 drivers/input/touchscreen/ar1021_i2c.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ar1021_i2c.c 
b/drivers/input/touchscreen/ar1021_i2c.c
index c0d5c2413356..c9e98ed4520e 100644
--- a/drivers/input/touchscreen/ar1021_i2c.c
+++ b/drivers/input/touchscreen/ar1021_i2c.c
@@ -123,6 +123,11 @@ static int ar1021_i2c_probe(struct i2c_client *client,
 
input_set_drvdata(input, ar1021);
 
+   /*
+* Don't enable the IRQ automatically, we'll enable it in
+* ar1021_i2c_open()
+*/
+   irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
error = devm_request_threaded_irq(>dev, client->irq,
  NULL, ar1021_i2c_irq,
  IRQF_ONESHOT,
@@ -133,9 +138,6 @@ static int ar1021_i2c_probe(struct i2c_client *client,
return error;
}
 
-   /* Disable the IRQ, we'll enable it in ar1021_i2c_open() */
-   disable_irq(client->irq);
-
error = input_register_device(ar1021->input);
if (error) {
dev_err(>dev,
-- 
2.25.1



[PATCH] checkpatch: Improve blank line after declaration test

2021-01-01 Thread Joe Perches
Avoid multiple false positives by ignoring attributes.

Various attributes like volatile and cacheline_aligned_in_smp cause
checkpatch to emit invalid "Missing a blank line after declarations"
messages.

Use copies of $sline and $prevline, remove $Attribute and $Sparse, and
use the existing tests to avoid these false positives.

Miscellanea:

o Add volatile to $Attribute

This also reduces checkpatch runtime a bit by moving the indentation
comparison test to the start of the block to avoid multiple unnecessary
regex tests.

Signed-off-by: Joe Perches 
---
 scripts/checkpatch.pl | 52 ---
 1 file changed, 29 insertions(+), 23 deletions(-)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 00085308ed9d..cfa0a7393ef5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -382,6 +382,7 @@ our $InitAttribute = 
qr{$InitAttributeData|$InitAttributeConst|$InitAttributeIni
 # We need \b after 'init' otherwise 'initconst' will cause a false positive in 
a check
 our $Attribute = qr{
const|
+   volatile|
__percpu|
__nocast|
__safe|
@@ -3783,43 +3784,48 @@ sub process {
}
 
 # check for missing blank lines after declarations
-   if ($sline =~ /^\+\s+\S/ && #Not at char 1
-   # actual declarations
-   ($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
+# (declarations must have the same indentation and not be at the start of line)
+   if (($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/) {
+   # use temporaries
+   my $sl = $sline;
+   my $pl = $prevline;
+   # remove $Attribute/$Sparse uses to simplify comparisons
+   $sl =~ s/\b(?:$Attribute|$Sparse)\b//g;
+   $pl =~ s/\b(?:$Attribute|$Sparse)\b//g;
+   if (($pl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# function pointer declarations
-$prevline =~ 
/^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
+$pl =~ 
/^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
# foo bar; where foo is some local typedef or #define
-$prevline =~ 
/^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
+$pl =~ 
/^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
-$prevline =~ /^\+\s+$declaration_macros/) &&
+$pl =~ /^\+\s+$declaration_macros/) &&
# for "else if" which can look like "$Ident $Ident"
-   !($prevline =~ /^\+\s+$c90_Keywords\b/ ||
+   !($pl =~ /^\+\s+$c90_Keywords\b/ ||
# other possible extensions of declaration lines
- $prevline =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
+ $pl =~ /(?:$Compare|$Assignment|$Operators)\s*$/ 
||
# not starting a section or a macro "\" extended line
- $prevline =~ /(?:\{\s*|\\)$/) &&
+ $pl =~ /(?:\{\s*|\\)$/) &&
# looks like a declaration
-   !($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
+   !($sl =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# function pointer declarations
- $sline =~ 
/^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
+ $sl =~ 
/^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
# foo bar; where foo is some local typedef or #define
- $sline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ 
||
+ $sl =~ 
/^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
- $sline =~ /^\+\s+$declaration_macros/ ||
+ $sl =~ /^\+\s+$declaration_macros/ ||
# start of struct or union or enum
- $sline =~ 
/^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
+ $sl =~ 
/^\+\s+(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
# start or end of block or continuation of declaration
- $sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
+ $sl =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
# bitfield continuation
- $sline =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
+ $sl =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
# other 

[PATCH v5 1/2] fpga: dfl: add the userspace I/O device support for DFL devices

2021-01-01 Thread Xu Yilun
This patch supports the DFL drivers be written in userspace. This is
realized by exposing the userspace I/O device interfaces.

The driver leverages the uio_pdrv_genirq, it adds the uio_pdrv_genirq
platform device with the DFL device's resources, and let the generic UIO
platform device driver provide support to userspace access to kernel
interrupts and memory locations.

The driver now supports the ether group feature. To support a new DFL
feature been directly accessed via UIO, its feature id should be added to
the driver's id_table.

Signed-off-by: Xu Yilun 
Reviewed-by: Tom Rix 
---
v2: switch to the new matching algorithem. It matches DFL devices which
 could not be handled by other DFL drivers.
refacor the code about device resources filling.
fix some comments.
v3: split the dfl.c changes out of this patch.
some minor fixes
v4: drop the idea of a generic matching algorithem, instead we specify
 each matching device in id_table.
to make clear that only one irq is supported, the irq handling code
 is refactored.
v5: refactor the irq resource code.
---
 drivers/fpga/Kconfig| 10 +
 drivers/fpga/Makefile   |  1 +
 drivers/fpga/dfl-uio-pdev.c | 91 +
 3 files changed, 102 insertions(+)
 create mode 100644 drivers/fpga/dfl-uio-pdev.c

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index 5ff9438..61445be 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -203,6 +203,16 @@ config FPGA_DFL_NIOS_INTEL_PAC_N3000
  the card. It also instantiates the SPI master (spi-altera) for
  the card's BMC (Board Management Controller).
 
+config FPGA_DFL_UIO_PDEV
+   tristate "FPGA DFL Driver for Userspace I/O platform devices"
+   depends on FPGA_DFL && UIO_PDRV_GENIRQ
+   help
+ Enable this to allow some DFL drivers be written in userspace. It
+ adds the uio_pdrv_genirq platform device with the DFL feature's
+ resources, and lets the generic UIO platform device driver provide
+ support for userspace access to kernel interrupts and memory
+ locations.
+
 config FPGA_DFL_PCI
tristate "FPGA DFL PCIe Device Driver"
depends on PCI && FPGA_DFL
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
index 18dc9885..8847fe0 100644
--- a/drivers/fpga/Makefile
+++ b/drivers/fpga/Makefile
@@ -45,6 +45,7 @@ dfl-afu-objs := dfl-afu-main.o dfl-afu-region.o 
dfl-afu-dma-region.o
 dfl-afu-objs += dfl-afu-error.o
 
 obj-$(CONFIG_FPGA_DFL_NIOS_INTEL_PAC_N3000)+= dfl-n3000-nios.o
+obj-$(CONFIG_FPGA_DFL_UIO_PDEV)+= dfl-uio-pdev.o
 
 # Drivers for FPGAs which implement DFL
 obj-$(CONFIG_FPGA_DFL_PCI) += dfl-pci.o
diff --git a/drivers/fpga/dfl-uio-pdev.c b/drivers/fpga/dfl-uio-pdev.c
new file mode 100644
index 000..a4cd581
--- /dev/null
+++ b/drivers/fpga/dfl-uio-pdev.c
@@ -0,0 +1,91 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * DFL driver for Userspace I/O platform devices
+ *
+ * Copyright (C) 2020 Intel Corporation, Inc.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_NAME "dfl-uio-pdev"
+
+static int dfl_uio_pdev_probe(struct dfl_device *ddev)
+{
+   struct platform_device_info pdevinfo = { 0 };
+   struct uio_info uio_pdata = { 0 };
+   struct platform_device *uio_pdev;
+   struct device *dev = >dev;
+   unsigned int num_res = 1;
+   struct resource res[2];
+
+   res[0].parent = >mmio_res;
+   res[0].flags = IORESOURCE_MEM;
+   res[0].start = ddev->mmio_res.start;
+   res[0].end = ddev->mmio_res.end;
+
+   if (ddev->num_irqs) {
+   if (ddev->num_irqs > 1)
+   dev_warn(>dev,
+"%d irqs for %s, but UIO only supports the 
first one\n",
+ddev->num_irqs, dev_name(>dev));
+
+   res[1].flags = IORESOURCE_IRQ;
+   res[1].start = ddev->irqs[0];
+   res[1].end = ddev->irqs[0];
+   num_res++;
+   }
+
+   uio_pdata.name = DRIVER_NAME;
+   uio_pdata.version = "0";
+
+   pdevinfo.name = "uio_pdrv_genirq";
+   pdevinfo.res = res;
+   pdevinfo.num_res = num_res;
+   pdevinfo.parent = >dev;
+   pdevinfo.id = PLATFORM_DEVID_AUTO;
+   pdevinfo.data = _pdata;
+   pdevinfo.size_data = sizeof(uio_pdata);
+
+   uio_pdev = platform_device_register_full();
+   if (!IS_ERR(uio_pdev))
+   dev_set_drvdata(dev, uio_pdev);
+
+   return PTR_ERR_OR_ZERO(uio_pdev);
+}
+
+static void dfl_uio_pdev_remove(struct dfl_device *ddev)
+{
+   struct platform_device *uio_pdev = dev_get_drvdata(>dev);
+
+   platform_device_unregister(uio_pdev);
+}
+
+#define FME_FEATURE_ID_ETH_GROUP   0x10
+
+static const struct dfl_device_id dfl_uio_pdev_ids[] = {
+   { FME_ID, FME_FEATURE_ID_ETH_GROUP },
+
+   /* Add your new id entries here to 

[PATCH v5 2/2] Documentation: fpga: dfl: Add description for DFL UIO support

2021-01-01 Thread Xu Yilun
This patch adds description for UIO support for dfl devices on DFL
bus.

Signed-off-by: Xu Yilun 
---
v2: no doc in v1, add it for v2.
v3: some documentation fixes.
v4: documentation change since the driver matching is changed.
v5: no change.
---
 Documentation/fpga/dfl.rst | 24 
 1 file changed, 24 insertions(+)

diff --git a/Documentation/fpga/dfl.rst b/Documentation/fpga/dfl.rst
index 0404fe6..b8497f3 100644
--- a/Documentation/fpga/dfl.rst
+++ b/Documentation/fpga/dfl.rst
@@ -7,6 +7,7 @@ Authors:
 - Enno Luebbers 
 - Xiao Guangrong 
 - Wu Hao 
+- Xu Yilun 
 
 The Device Feature List (DFL) FPGA framework (and drivers according to
 this framework) hides the very details of low layer hardwares and provides
@@ -502,6 +503,29 @@ FME Partial Reconfiguration Sub Feature driver (see 
drivers/fpga/dfl-fme-pr.c)
 could be a reference.
 
 
+UIO support for DFL devices
+===
+The purpose of an FPGA is to be reprogrammed with newly developed hardware
+components. New hardware can instantiate a new private feature in the DFL, and
+then get a DFL device in their system. In some cases users may need a userspace
+driver for the DFL device:
+
+* Users may need to run some diagnostic test for their hardwares.
+* Users may prototype the kernel driver in user space.
+* Some hardware is designed for specific purposes and does not fit into one of
+  the standard kernel subsystems.
+
+This requires the direct access to the MMIO space and interrupt handling in
+userspace. The dfl-uio-pdev module exposes the UIO device interfaces for this
+purpose. It adds the uio_pdrv_genirq platform device with the resources of
+the DFL feature, and lets the generic UIO platform device driver provide UIO
+support to userspace.
+
+FPGA_DFL_UIO_PDEV should be selected to enable the dfl-uio-pdev module driver.
+To support a new DFL feature been directly accessed via UIO, its feature id
+should be added to the driver's id_table.
+
+
 Open discussion
 ===
 FME driver exports one ioctl (DFL_FPGA_FME_PORT_PR) for partial reconfiguration
-- 
2.7.4



[PATCH v5 0/2] UIO support for dfl devices

2021-01-01 Thread Xu Yilun
This patchset supports some dfl device drivers written in userspace.

In the patchset v1, the "driver_override" interface should be used to bind
the DFL UIO driver to DFL devices. But there is concern that the
"driver_override" interface is not OK itself.

In v2, we use a new matching algorithem. The "driver_override" interface
is abandoned, the DFL UIO driver matches any DFL device which could not be
handled by other DFL drivers. So the DFL UIO driver could be used for new
DFL devices which are not supported by kernel. The concern is the UIO may
not be suitable as a default/generic driver for all dfl features, such as
features with multiple interrupts.

In v4, we specify each matching device in the id_table of the UIO driver,
just the same as other dfl drivers do. Now the UIO driver supports Ether
Group feature. To support more DFL features, their feature ids should be
added to the driver's id_table.


Main changes from v1:
- switch to the new matching algorithem. It matches DFL devices which could
  not be handled by other DFL drivers.
- refacor the code about device resources filling.
- add the documentation.

Main changes from v2:
- split the match ops changes in dfl.c to an independent patch.
- move the declarations needed for dfl-uio-pdev from include/linux/dfl.h
  to driver/fpga/dfl.h
- some minor fixes.

Main changes from v3:
- switch to specifying each matching device in the driver's id_table.
- refactor the irq handling code.

Main changes from v4:
- refactor the irq handling code.

Xu Yilun (2):
  fpga: dfl: add the userspace I/O device support for DFL devices
  Documentation: fpga: dfl: Add description for DFL UIO support

 Documentation/fpga/dfl.rst  | 24 
 drivers/fpga/Kconfig| 10 +
 drivers/fpga/Makefile   |  1 +
 drivers/fpga/dfl-uio-pdev.c | 91 +
 4 files changed, 126 insertions(+)
 create mode 100644 drivers/fpga/dfl-uio-pdev.c

-- 
2.7.4



[PATCH v2] spi: fix the divide by 0 error when calculating xfer waiting time

2021-01-01 Thread Xu Yilun
The xfer waiting time is the result of xfer->len / xfer->speed_hz. This
patch makes the assumption of 1khz xfer speed if the xfer->speed_hz is
not assigned and stays 0. This avoids the divide by 0 issue and ensures
a reasonable tolerant waiting time.

Signed-off-by: Xu Yilun 
---
v2: use the normal conditional statement instead of the ternery operator
change the default xfer speed from 1khz to 100khz
---
 drivers/spi/spi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 51d7c00..aacae88 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -1108,6 +1108,7 @@ static int spi_transfer_wait(struct spi_controller *ctlr,
 {
struct spi_statistics *statm = >statistics;
struct spi_statistics *stats = >spi->statistics;
+   u32 speed_hz = xfer->speed_hz;
unsigned long long ms;
 
if (spi_controller_is_slave(ctlr)) {
@@ -1116,8 +1117,11 @@ static int spi_transfer_wait(struct spi_controller *ctlr,
return -EINTR;
}
} else {
+   if (!speed_hz)
+   speed_hz = 10;
+
ms = 8LL * 1000LL * xfer->len;
-   do_div(ms, xfer->speed_hz);
+   do_div(ms, speed_hz);
ms += ms + 200; /* some tolerance */
 
if (ms > UINT_MAX)
-- 
2.7.4



Re: [PATCH] platform/x86: ideapad-laptop: Add has_touchpad_switch

2021-01-01 Thread Jiaxun Yang

在 2021/1/2 上午1:09, Barnabás Pőcze 写道:

Hi


2021. január 1., péntek 17:08 keltezéssel, Jiaxun Yang írta:


[...]

@@ -1006,6 +1018,10 @@ static int ideapad_acpi_add(struct platform_device *pdev)
if (!priv->has_hw_rfkill_switch)
write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);

+   /* The same for Touchpad */
+   if (!priv->has_touchpad_switch)
+   write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);
+

Shouldn't it be the other way around: `if (priv->has_touchpad_switch)`?

It is to prevent accidentally disable touchpad on machines that do have EC 
switch,
so it's intentional.
[...]

Sorry, but the explanation not fully clear to me. The commit message seems to
indicate that some models "do not use EC to switch touchpad", and I take that
means that reading from VPCCMD_R_TOUCHPAD will not reflect the actual state of 
the
touchpad and writing to VPCCMD_W_TOUCHPAD will not change the state of the 
touchpad.


I'm just trying to prevent removing functionality on machines that 
touchpad can be controlled
by EC but also equipped I2C HID touchpad. At least users will have a 
functional touchpad

after that.



But then why do you still write to VPCCMD_W_TOUCHPAD on devices where supposedly
this does not have any effect (at least not the desired one)? And the part of 
the
code I made my comment about only runs on machines on which the touchpad 
supposedly
cannot be controlled by the EC. What am I missing?

And there is the other problem: on some machines, this patch removes working
functionality.
Yeah that's a problem. I just don't want to repeat the story of rfkill 
whitelist, it ends up with

countless machine to be added.

Maybe I should specify HID of touchpad as well. Two machines that known 
to be problematic

all have ELAN0634 touchpad.

Thanks.

- Jiaxun




Regards,
Barnabás Pőcze




[PATCH 0/7] selftests: gpio: rework and port to GPIO uAPI v2

2021-01-01 Thread Kent Gibson
Initially I just wanted to port the selftests to the latest GPIO uAPI,
but on finding that, due to dependency issues, the selftests are not built
for the buildroot environments that I do most of my GPIO testing in, I
decided to take a closer look.

The first patch is essentially a rewrite of the exising test suite.
It uses a simplified abstraction of the uAPI interfaces to allow a common
test suite to test the gpio-mockup using either of the uAPI interfaces.
The simplified cdev interface is implemented in gpio-mockup.sh, with the
actual driving of the uAPI implemented in gpio-mockup-cdev.c.
The simplified sysfs interface replaces gpio-mockup-sysfs.sh and is
loaded over the cdev implementation when selected.

The new tests should also be simpler to extend to cover new mockup
interfaces, such as the one Bart has been working on.

I have dropped support for testing modules other than gpio-mockup from
the command line options, as the tests are very gpio-mockup specific so
I didn't see any calling for it.

I have also tried to emphasise in the test output that the tests are
covering the gpio-mockup itself.  They do perform some implicit testing
of gpiolib and the uAPI interfaces, and so can be useful as smoke tests
for those, but their primary focus is the gpio-mockup.

Patches 2 through 5 do some cleaning up that is now possible with the
new implementation, including enabling building in buildroot environments.
Patch 4 doesn't strictly clean up all the old gpio references that it
could - the gpio was the only Level 1 test, so the Level 1 tests could
potentially be removed, but I was unsure if there may be other
implications to removing a whole test level, or that it may be useful
as a placeholder in case other static LDLIBS tests are added in
the future??

Patch 6 finally gets around to porting the tests to the latest GPIO uAPI.

And Patch 7 updates the config to set the CONFIG_GPIO_CDEV option that
was added in v5.10.

Cheers,
Kent.

Kent Gibson (7):
  selftests: gpio: rework and simplify test implementation
  selftests: gpio: remove obsolete gpio-mockup-chardev.c
  selftests: remove obsolete build restriction for gpio
  selftests: remove obsolete gpio references from kselftest_deps.sh
  tools: gpio: remove uAPI v1 code no longer used by selftests
  selftests: gpio: port to GPIO uAPI v2
  selftests: gpio: add CONFIG_GPIO_CDEV to config

 tools/gpio/gpio-utils.c   |  89 
 tools/gpio/gpio-utils.h   |   6 -
 tools/testing/selftests/Makefile  |   9 -
 tools/testing/selftests/gpio/Makefile |  26 +-
 tools/testing/selftests/gpio/config   |   1 +
 .../testing/selftests/gpio/gpio-mockup-cdev.c | 198 
 .../selftests/gpio/gpio-mockup-chardev.c  | 323 
 .../selftests/gpio/gpio-mockup-sysfs.sh   | 168 ++-
 tools/testing/selftests/gpio/gpio-mockup.sh   | 469 --
 tools/testing/selftests/kselftest_deps.sh |   4 +-
 10 files changed, 573 insertions(+), 720 deletions(-)
 create mode 100644 tools/testing/selftests/gpio/gpio-mockup-cdev.c
 delete mode 100644 tools/testing/selftests/gpio/gpio-mockup-chardev.c

-- 
2.30.0



[PATCH 7/7] selftests: gpio: add CONFIG_GPIO_CDEV to config

2021-01-01 Thread Kent Gibson
GPIO CDEV is now optional and required for the selftests so add it to
the config.

Signed-off-by: Kent Gibson 
---
 tools/testing/selftests/gpio/config | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/gpio/config 
b/tools/testing/selftests/gpio/config
index abaa6902b7b6..ce100342c20b 100644
--- a/tools/testing/selftests/gpio/config
+++ b/tools/testing/selftests/gpio/config
@@ -1,2 +1,3 @@
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_CDEV=y
 CONFIG_GPIO_MOCKUP=m
-- 
2.30.0



[PATCH 2/7] selftests: gpio: remove obsolete gpio-mockup-chardev.c

2021-01-01 Thread Kent Gibson
GPIO selftests have changed to new gpio-mockup-cdev helper, so remove
old gpio-mockup-chardev helper.

Signed-off-by: Kent Gibson 
---
 .../selftests/gpio/gpio-mockup-chardev.c  | 323 --
 1 file changed, 323 deletions(-)
 delete mode 100644 tools/testing/selftests/gpio/gpio-mockup-chardev.c

diff --git a/tools/testing/selftests/gpio/gpio-mockup-chardev.c 
b/tools/testing/selftests/gpio/gpio-mockup-chardev.c
deleted file mode 100644
index 73ead8828d3a..
--- a/tools/testing/selftests/gpio/gpio-mockup-chardev.c
+++ /dev/null
@@ -1,323 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * GPIO chardev test helper
- *
- * Copyright (C) 2016 Bamvor Jian Zhang
- */
-
-#define _GNU_SOURCE
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "../../../gpio/gpio-utils.h"
-
-#define CONSUMER   "gpio-selftest"
-#defineGC_NUM  10
-enum direction {
-   OUT,
-   IN
-};
-
-static int get_debugfs(char **path)
-{
-   struct libmnt_context *cxt;
-   struct libmnt_table *tb;
-   struct libmnt_iter *itr = NULL;
-   struct libmnt_fs *fs;
-   int found = 0, ret;
-
-   cxt = mnt_new_context();
-   if (!cxt)
-   err(EXIT_FAILURE, "libmount context allocation failed");
-
-   itr = mnt_new_iter(MNT_ITER_FORWARD);
-   if (!itr)
-   err(EXIT_FAILURE, "failed to initialize libmount iterator");
-
-   if (mnt_context_get_mtab(cxt, ))
-   err(EXIT_FAILURE, "failed to read mtab");
-
-   while (mnt_table_next_fs(tb, itr, ) == 0) {
-   const char *type = mnt_fs_get_fstype(fs);
-
-   if (!strcmp(type, "debugfs")) {
-   found = 1;
-   break;
-   }
-   }
-   if (found) {
-   ret = asprintf(path, "%s/gpio", mnt_fs_get_target(fs));
-   if (ret < 0)
-   err(EXIT_FAILURE, "failed to format string");
-   }
-
-   mnt_free_iter(itr);
-   mnt_free_context(cxt);
-
-   if (!found)
-   return -1;
-
-   return 0;
-}
-
-static int gpio_debugfs_get(const char *consumer, int *dir, int *value)
-{
-   char *debugfs;
-   FILE *f;
-   char *line = NULL;
-   size_t len = 0;
-   char *cur;
-   int found = 0;
-
-   if (get_debugfs() != 0)
-   err(EXIT_FAILURE, "debugfs is not mounted");
-
-   f = fopen(debugfs, "r");
-   if (!f)
-   err(EXIT_FAILURE, "read from gpio debugfs failed");
-
-   /*
-* gpio-2   (|gpio-selftest   ) in  lo
-*/
-   while (getline(, , f) != -1) {
-   cur = strstr(line, consumer);
-   if (cur == NULL)
-   continue;
-
-   cur = strchr(line, ')');
-   if (!cur)
-   continue;
-
-   cur += 2;
-   if (!strncmp(cur, "out", 3)) {
-   *dir = OUT;
-   cur += 4;
-   } else if (!strncmp(cur, "in", 2)) {
-   *dir = IN;
-   cur += 4;
-   }
-
-   if (!strncmp(cur, "hi", 2))
-   *value = 1;
-   else if (!strncmp(cur, "lo", 2))
-   *value = 0;
-
-   found = 1;
-   break;
-   }
-   free(debugfs);
-   fclose(f);
-   free(line);
-
-   if (!found)
-   return -1;
-
-   return 0;
-}
-
-static struct gpiochip_info *list_gpiochip(const char *gpiochip_name, int *ret)
-{
-   struct gpiochip_info *cinfo;
-   struct gpiochip_info *current;
-   const struct dirent *ent;
-   DIR *dp;
-   char *chrdev_name;
-   int fd;
-   int i = 0;
-
-   cinfo = calloc(sizeof(struct gpiochip_info) * 4, GC_NUM + 1);
-   if (!cinfo)
-   err(EXIT_FAILURE, "gpiochip_info allocation failed");
-
-   current = cinfo;
-   dp = opendir("/dev");
-   if (!dp) {
-   *ret = -errno;
-   goto error_out;
-   } else {
-   *ret = 0;
-   }
-
-   while (ent = readdir(dp), ent) {
-   if (check_prefix(ent->d_name, "gpiochip")) {
-   *ret = asprintf(_name, "/dev/%s", ent->d_name);
-   if (*ret < 0)
-   goto error_out;
-
-   fd = open(chrdev_name, 0);
-   if (fd == -1) {
-   *ret = -errno;
-   fprintf(stderr, "Failed to open %s\n",
-   chrdev_name);
-   goto error_close_dir;
-   }
-   *ret = ioctl(fd, GPIO_GET_CHIPINFO_IOCTL, current);
-   if (*ret == -1) {
-  

[PATCH 6/7] selftests: gpio: port to GPIO uAPI v2

2021-01-01 Thread Kent Gibson
Add a port to the GPIO uAPI v2 interface and make it the default.

Signed-off-by: Kent Gibson 
---
 .../testing/selftests/gpio/gpio-mockup-cdev.c | 75 +--
 tools/testing/selftests/gpio/gpio-mockup.sh   | 11 ++-
 2 files changed, 76 insertions(+), 10 deletions(-)

diff --git a/tools/testing/selftests/gpio/gpio-mockup-cdev.c 
b/tools/testing/selftests/gpio/gpio-mockup-cdev.c
index 3bfd876a8b6a..e8e3d2ec662c 100644
--- a/tools/testing/selftests/gpio/gpio-mockup-cdev.c
+++ b/tools/testing/selftests/gpio/gpio-mockup-cdev.c
@@ -18,6 +18,44 @@
 
 #define CONSUMER   "gpio-mockup-cdev"
 
+static int request_line_v2(int cfd, unsigned int offset,
+  uint64_t flags, unsigned int val)
+{
+   struct gpio_v2_line_request req;
+   int ret;
+
+   memset(, 0, sizeof(req));
+   req.num_lines = 1;
+   req.offsets[0] = offset;
+   req.config.flags = flags;
+   strcpy(req.consumer, CONSUMER);
+   if (flags & GPIO_V2_LINE_FLAG_OUTPUT) {
+   req.config.num_attrs = 1;
+   req.config.attrs[0].mask = 1;
+   req.config.attrs[0].attr.id = 
GPIO_V2_LINE_ATTR_ID_OUTPUT_VALUES;
+   if (val)
+   req.config.attrs[0].attr.values = 1;
+   }
+   ret = ioctl(cfd, GPIO_V2_GET_LINE_IOCTL, );
+   if (ret == -1)
+   return -errno;
+   return req.fd;
+}
+
+
+static int get_value_v2(int lfd)
+{
+   struct gpio_v2_line_values vals;
+   int ret;
+
+   memset(, 0, sizeof(vals));
+   vals.mask = 1;
+   ret = ioctl(lfd, GPIO_V2_LINE_GET_VALUES_IOCTL, );
+   if (ret == -1)
+   return -errno;
+   return vals.bits & 0x1;
+}
+
 static int request_line_v1(int cfd, unsigned int offset,
   uint32_t flags, unsigned int val)
 {
@@ -57,6 +95,7 @@ static void usage(char *prog)
printf("   (default is to leave bias unchanged):\n");
printf("-l: set line active low (default is active high)\n");
printf("-s: set line value (default is to get line value)\n");
+   printf("-u: uAPI version to use (default is 2)\n");
exit(-1);
 }
 
@@ -78,29 +117,42 @@ int main(int argc, char *argv[])
 {
char *chip;
int opt, ret, cfd, lfd;
-   unsigned int offset, val;
+   unsigned int offset, val, abiv;
uint32_t flags_v1;
+   uint64_t flags_v2;
 
+   abiv = 2;
ret = 0;
flags_v1 = GPIOHANDLE_REQUEST_INPUT;
+   flags_v2 = GPIO_V2_LINE_FLAG_INPUT;
 
while ((opt = getopt(argc, argv, "lb:s:u:")) != -1) {
switch (opt) {
case 'l':
flags_v1 |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
+   flags_v2 |= GPIO_V2_LINE_FLAG_ACTIVE_LOW;
break;
case 'b':
-   if (strcmp("pull-up", optarg) == 0)
+   if (strcmp("pull-up", optarg) == 0) {
flags_v1 |= GPIOHANDLE_REQUEST_BIAS_PULL_UP;
-   else if (strcmp("pull-down", optarg) == 0)
+   flags_v2 |= GPIO_V2_LINE_FLAG_BIAS_PULL_UP;
+   } else if (strcmp("pull-down", optarg) == 0) {
flags_v1 |= GPIOHANDLE_REQUEST_BIAS_PULL_DOWN;
-   else if (strcmp("disabled", optarg) == 0)
+   flags_v2 |= GPIO_V2_LINE_FLAG_BIAS_PULL_DOWN;
+   } else if (strcmp("disabled", optarg) == 0) {
flags_v1 |= GPIOHANDLE_REQUEST_BIAS_DISABLE;
+   flags_v2 |= GPIO_V2_LINE_FLAG_BIAS_DISABLED;
+   }
break;
case 's':
val = atoi(optarg);
flags_v1 &= ~GPIOHANDLE_REQUEST_INPUT;
flags_v1 |= GPIOHANDLE_REQUEST_OUTPUT;
+   flags_v2 &= ~GPIO_V2_LINE_FLAG_INPUT;
+   flags_v2 |= GPIO_V2_LINE_FLAG_OUTPUT;
+   break;
+   case 'u':
+   abiv = atoi(optarg);
break;
default:
usage(argv[0]);
@@ -119,7 +171,10 @@ int main(int argc, char *argv[])
return -errno;
}
 
-   lfd = request_line_v1(cfd, offset, flags_v1, val);
+   if (abiv == 1)
+   lfd = request_line_v1(cfd, offset, flags_v1, val);
+   else
+   lfd = request_line_v2(cfd, offset, flags_v2, val);
 
close(cfd);
 
@@ -128,10 +183,14 @@ int main(int argc, char *argv[])
return lfd;
}
 
-   if (flags_v1 & GPIOHANDLE_REQUEST_OUTPUT)
+   if (flags_v2 & GPIO_V2_LINE_FLAG_OUTPUT) {
wait_signal();
-   else
-   ret = get_value_v1(lfd);
+   } else {
+   if (abiv == 1)
+  

[PATCH 4/7] selftests: remove obsolete gpio references from kselftest_deps.sh

2021-01-01 Thread Kent Gibson
GPIO Makefile has been greatly simplified so remove references to lines
which no longer exist.

Signed-off-by: Kent Gibson 
---
 tools/testing/selftests/kselftest_deps.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/testing/selftests/kselftest_deps.sh 
b/tools/testing/selftests/kselftest_deps.sh
index bbc04646346b..00e60d6eb16b 100755
--- a/tools/testing/selftests/kselftest_deps.sh
+++ b/tools/testing/selftests/kselftest_deps.sh
@@ -129,13 +129,11 @@ l2_tests=$(grep -r --include=Makefile ": LDLIBS" | \
grep -v "VAR_LDLIBS" | awk -F: '{print $1}')
 
 # Level 3
-# gpio,  memfd and others use pkg-config to find mount and fuse libs
+# memfd and others use pkg-config to find mount and fuse libs
 # respectively and save it in VAR_LDLIBS. If pkg-config doesn't find
 # any, VAR_LDLIBS set to default.
 # Use the default value and filter out pkg-config for dependency check.
 # e.g:
-# gpio/Makefile
-#  VAR_LDLIBS := $(shell pkg-config --libs mount) 2>/dev/null)
 # memfd/Makefile
 #  VAR_LDLIBS := $(shell pkg-config fuse --libs 2>/dev/null)
 
-- 
2.30.0



[PATCH 3/7] selftests: remove obsolete build restriction for gpio

2021-01-01 Thread Kent Gibson
Build restrictions related to the gpio-mockup-chardev helper are
no longer relevant so remove them.

Signed-off-by: Kent Gibson 
---
 tools/testing/selftests/Makefile | 9 -
 1 file changed, 9 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index d9c283503159..5411041e63a0 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -121,15 +121,6 @@ ARCH   ?= $(SUBARCH)
 export KSFT_KHDR_INSTALL_DONE := 1
 export BUILD
 
-# build and run gpio when output directory is the src dir.
-# gpio has dependency on tools/gpio and builds tools/gpio
-# objects in the src directory in all cases making the src
-# repo dirty even when objects are relocated.
-ifneq (1,$(DEFAULT_INSTALL_HDR_PATH))
-   TMP := $(filter-out gpio, $(TARGETS))
-   TARGETS := $(TMP)
-endif
-
 # set default goal to all, so make without a target runs all, even when
 # all isn't the first target in the file.
 .DEFAULT_GOAL := all
-- 
2.30.0



[PATCH 5/7] tools: gpio: remove uAPI v1 code no longer used by selftests

2021-01-01 Thread Kent Gibson
gpio-mockup-chardev helper has been obsoleted and removed, so also remove
the tools/gpio code that it, and nothing else, was using.

Signed-off-by: Kent Gibson 
---
 tools/gpio/gpio-utils.c | 89 -
 tools/gpio/gpio-utils.h |  6 ---
 2 files changed, 95 deletions(-)

diff --git a/tools/gpio/gpio-utils.c b/tools/gpio/gpio-utils.c
index 37187e056c8b..1639b4d832cd 100644
--- a/tools/gpio/gpio-utils.c
+++ b/tools/gpio/gpio-utils.c
@@ -32,74 +32,6 @@
  * following api will request gpio lines, do the operation and then
  * release these lines.
  */
-/**
- * gpiotools_request_linehandle() - request gpio lines in a gpiochip
- * @device_name:   The name of gpiochip without prefix "/dev/",
- * such as "gpiochip0"
- * @lines: An array desired lines, specified by offset
- * index for the associated GPIO device.
- * @num_lines: The number of lines to request.
- * @flag:  The new flag for requsted gpio. Reference
- * "linux/gpio.h" for the meaning of flag.
- * @data:  Default value will be set to gpio when flag is
- * GPIOHANDLE_REQUEST_OUTPUT.
- * @consumer_label:The name of consumer, such as "sysfs",
- * "powerkey". This is useful for other users to
- * know who is using.
- *
- * Request gpio lines through the ioctl provided by chardev. User
- * could call gpiotools_set_values() and gpiotools_get_values() to
- * read and write respectively through the returned fd. Call
- * gpiotools_release_linehandle() to release these lines after that.
- *
- * Return: On success return the fd;
- * On failure return the errno.
- */
-int gpiotools_request_linehandle(const char *device_name, unsigned int *lines,
-unsigned int num_lines, unsigned int flag,
-struct gpiohandle_data *data,
-const char *consumer_label)
-{
-   struct gpiohandle_request req;
-   char *chrdev_name;
-   int fd;
-   int i;
-   int ret;
-
-   ret = asprintf(_name, "/dev/%s", device_name);
-   if (ret < 0)
-   return -ENOMEM;
-
-   fd = open(chrdev_name, 0);
-   if (fd == -1) {
-   ret = -errno;
-   fprintf(stderr, "Failed to open %s, %s\n",
-   chrdev_name, strerror(errno));
-   goto exit_free_name;
-   }
-
-   for (i = 0; i < num_lines; i++)
-   req.lineoffsets[i] = lines[i];
-
-   req.flags = flag;
-   strcpy(req.consumer_label, consumer_label);
-   req.lines = num_lines;
-   if (flag & GPIOHANDLE_REQUEST_OUTPUT)
-   memcpy(req.default_values, data, sizeof(req.default_values));
-
-   ret = ioctl(fd, GPIO_GET_LINEHANDLE_IOCTL, );
-   if (ret == -1) {
-   ret = -errno;
-   fprintf(stderr, "Failed to issue %s (%d), %s\n",
-   "GPIO_GET_LINEHANDLE_IOCTL", ret, strerror(errno));
-   }
-
-   if (close(fd) == -1)
-   perror("Failed to close GPIO character device file");
-exit_free_name:
-   free(chrdev_name);
-   return ret < 0 ? ret : req.fd;
-}
 
 /**
  * gpiotools_request_line() - request gpio lines in a gpiochip
@@ -215,27 +147,6 @@ int gpiotools_get_values(const int fd, struct 
gpio_v2_line_values *values)
return ret;
 }
 
-/**
- * gpiotools_release_linehandle(): Release the line(s) of gpiochip
- * @fd:The fd returned by
- * gpiotools_request_linehandle().
- *
- * Return: On success return 0;
- * On failure return the errno.
- */
-int gpiotools_release_linehandle(const int fd)
-{
-   int ret;
-
-   ret = close(fd);
-   if (ret == -1) {
-   perror("Failed to close GPIO LINEHANDLE device file");
-   ret = -errno;
-   }
-
-   return ret;
-}
-
 /**
  * gpiotools_release_line(): Release the line(s) of gpiochip
  * @fd:The fd returned by
diff --git a/tools/gpio/gpio-utils.h b/tools/gpio/gpio-utils.h
index 6c69a9f1c253..8af7c8ee19ce 100644
--- a/tools/gpio/gpio-utils.h
+++ b/tools/gpio/gpio-utils.h
@@ -24,12 +24,6 @@ static inline int check_prefix(const char *str, const char 
*prefix)
strncmp(str, prefix, strlen(prefix)) == 0;
 }
 
-int gpiotools_request_linehandle(const char *device_name, unsigned int *lines,
-unsigned int num_lines, unsigned int flag,
-struct gpiohandle_data *data,
-const char *consumer_label);
-int gpiotools_release_linehandle(const int fd);
-
 int gpiotools_request_line(const char *device_name,
   unsigned int *lines,
   unsigned int num_lines,
-- 
2.30.0



[PATCH 1/7] selftests: gpio: rework and simplify test implementation

2021-01-01 Thread Kent Gibson
The GPIO mockup selftests are overly complicated with separate
implementations of the tests for sysfs and cdev uAPI, and with the cdev
implementation being dependent on tools/gpio and libmount.

Rework the test implementation to provide a common test suite with a
simplified pluggable uAPI interface.  The cdev implementation utilises
the GPIO uAPI directly to remove the dependence on tools/gpio.
The simplified uAPI interface removes the need for any file system mount
checks in C, and so removes the dependence on libmount.

The rework also fixes the sysfs test implementation which has been broken
since the device created in the multiple gpiochip case was split into
separate devices.

Fixes: commit 8a39f597bcfd ("gpio: mockup: rework device probing")
Signed-off-by: Kent Gibson 
---
 tools/testing/selftests/gpio/Makefile |  26 +-
 .../testing/selftests/gpio/gpio-mockup-cdev.c | 139 ++
 .../selftests/gpio/gpio-mockup-sysfs.sh   | 168 ++-
 tools/testing/selftests/gpio/gpio-mockup.sh   | 462 --
 4 files changed, 505 insertions(+), 290 deletions(-)
 create mode 100644 tools/testing/selftests/gpio/gpio-mockup-cdev.c

diff --git a/tools/testing/selftests/gpio/Makefile 
b/tools/testing/selftests/gpio/Makefile
index 32bdc978a711..e4363c64d40d 100644
--- a/tools/testing/selftests/gpio/Makefile
+++ b/tools/testing/selftests/gpio/Makefile
@@ -1,32 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
-VAR_CFLAGS := $(shell pkg-config --cflags mount 2>/dev/null)
-VAR_LDLIBS := $(shell pkg-config --libs mount 2>/dev/null)
-ifeq ($(VAR_LDLIBS),)
-VAR_LDLIBS := -lmount -I/usr/include/libmount
-endif
-
-CFLAGS += -O2 -g -std=gnu99 -Wall -I../../../../usr/include/ $(VAR_CFLAGS)
-LDLIBS += $(VAR_LDLIBS)
-
 TEST_PROGS := gpio-mockup.sh
 TEST_FILES := gpio-mockup-sysfs.sh
-TEST_PROGS_EXTENDED := gpio-mockup-chardev
-
-GPIODIR := $(realpath ../../../gpio)
-GPIOOBJ := gpio-utils.o
+TEST_GEN_PROGS_EXTENDED := gpio-mockup-cdev
 
-all: $(TEST_PROGS_EXTENDED)
-
-override define CLEAN
-   $(RM) $(TEST_PROGS_EXTENDED)
-   $(MAKE) -C $(GPIODIR) OUTPUT=$(GPIODIR)/ clean
-endef
-
-KSFT_KHDR_INSTALL := 1
 include ../lib.mk
 
-$(TEST_PROGS_EXTENDED): $(GPIODIR)/$(GPIOOBJ)
-
-$(GPIODIR)/$(GPIOOBJ):
-   $(MAKE) OUTPUT=$(GPIODIR)/ -C $(GPIODIR)
diff --git a/tools/testing/selftests/gpio/gpio-mockup-cdev.c 
b/tools/testing/selftests/gpio/gpio-mockup-cdev.c
new file mode 100644
index ..3bfd876a8b6a
--- /dev/null
+++ b/tools/testing/selftests/gpio/gpio-mockup-cdev.c
@@ -0,0 +1,139 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * GPIO mockup cdev test helper
+ *
+ * Copyright (C) 2020 Kent Gibson
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define CONSUMER   "gpio-mockup-cdev"
+
+static int request_line_v1(int cfd, unsigned int offset,
+  uint32_t flags, unsigned int val)
+{
+   struct gpiohandle_request req;
+   int ret;
+
+   memset(, 0, sizeof(req));
+   req.lines = 1;
+   req.lineoffsets[0] = offset;
+   req.flags = flags;
+   strcpy(req.consumer_label, CONSUMER);
+   if (flags & GPIOHANDLE_REQUEST_OUTPUT)
+   req.default_values[0] = val;
+
+   ret = ioctl(cfd, GPIO_GET_LINEHANDLE_IOCTL, );
+   if (ret == -1)
+   return -errno;
+   return req.fd;
+}
+
+static int get_value_v1(int lfd)
+{
+   struct gpiohandle_data vals;
+   int ret;
+
+   memset(, 0, sizeof(vals));
+   ret = ioctl(lfd, GPIOHANDLE_GET_LINE_VALUES_IOCTL, );
+   if (ret == -1)
+   return -errno;
+   return vals.values[0];
+}
+
+static void usage(char *prog)
+{
+   printf("Usage: %s [-l] [-b ] [-s ] [-u ]  
\n", prog);
+   printf("-b: set line bias to one of pull-down, pull-up, 
disabled\n");
+   printf("   (default is to leave bias unchanged):\n");
+   printf("-l: set line active low (default is active high)\n");
+   printf("-s: set line value (default is to get line value)\n");
+   exit(-1);
+}
+
+static int wait_signal(void)
+{
+   int sig;
+   sigset_t wset;
+
+   sigemptyset();
+   sigaddset(, SIGHUP);
+   sigaddset(, SIGINT);
+   sigaddset(, SIGTERM);
+   sigwait(, );
+
+   return sig;
+}
+
+int main(int argc, char *argv[])
+{
+   char *chip;
+   int opt, ret, cfd, lfd;
+   unsigned int offset, val;
+   uint32_t flags_v1;
+
+   ret = 0;
+   flags_v1 = GPIOHANDLE_REQUEST_INPUT;
+
+   while ((opt = getopt(argc, argv, "lb:s:u:")) != -1) {
+   switch (opt) {
+   case 'l':
+   flags_v1 |= GPIOHANDLE_REQUEST_ACTIVE_LOW;
+   break;
+   case 'b':
+   if (strcmp("pull-up", optarg) == 0)
+   flags_v1 |= GPIOHANDLE_REQUEST_BIAS_PULL_UP;
+   else if (strcmp("pull-down", 

Grsecurity GPL Violations: Bring a CASE act claim every time GrSecurity releases a new infringing work?

2021-01-01 Thread nipponmail
Should each Linux copyright owner of whom's copyright is being 
violated (By GrSecurity) bring a "small claims copyright" case every 
time GrSecurity sends a new infringing patch to a customer?


(GRSecurity blatantly violates the clause in the Linux kernel and 
GCC copyright licenses regarding adding addtional terms between the 
licensee of the kernel / gcc and furthur down-the-line licensees, 
regarding derivative works)

(The linux kernel has 1000s of copyright holders)
(All who shake at the knees at the thought of initiating a federal 
Copyright lawsuit)


(GrSecurity's main Programmer: Brad Spengler: has shining 
resplendent blue eyes; like sapphires, however)


> 
https://www.billboard.com/articles/business/9503848/congress-case-copyright-reforms-covid-19-relief-bill/
>The CASE Act creates a new small claims system in the US that 
allows copyright holders to pursue damages for copyright infringement 
without filing a federal lawsuit. These claims would be decided by 
copyright officers, not judges and juries, and could involve no more 
than $15,000 per work infringed upon, and $30,000 total


Does this new law create broader per-violation rights for the 
copyright holder? The then current copyright law makes it quite hard to 
go after violators: usually the lawsuit costs more than any hope of 
recovery. Every version you want to sue over, if you actually want to 
recover attorneys fees and statutory damages (not just whatever revenue 
you can proove (good luck)), has to be registered with the copyright 
office; same or similar violations subsequent to a registration by the 
same violator DO NOT grant you Attorney's fees and Statutory recovery; 
the same of a later version doesn't either.


It's hard to get any money out of a violator.
Especially how Free Software and Opensource copyright holders do 
things... (never registering their copyrights seemingly, always afraid, 
cowering before CoC's, being servants and slaves, doing it all for free, 
being kicked out of their own "societies)




Re: [PATCH 1/4] net: sfp: add workaround for Realtek RTL8672 and RTL9601C chips

2021-01-01 Thread Pali Rohár
On Thursday 31 December 2020 18:13:38 Andrew Lunn wrote:
> > > Looking at sfp_module_info(), adding a check for i2c_block_size < 2
> > > when determining what length to return. ethtool should do the right
> > > thing, know that the second page has not been returned to user space.
> > 
> > But if we limit length of eeprom then userspace would not be able to
> > access those TX_DISABLE, LOS and other bits from byte 110 at address A2.
> 
> Have you tested these bits to see if they actually work? If they don't
> work...

On Ubiquiti module that LOS bit does not work.

I think that on CarlitoxxPro module LOS bit worked. But I cannot test it
right now as I do not have access to testing OLT unit.

Adding Thomas to loop. Can you check if CarlitoxxPro GPON ONT module
supports LOS or other bits at byte offset 110 at address A2?


drivers/accessibility/speakup/speakup_acntpc.c:262:28: sparse: sparse: cast removes address space '__iomem' of expression

2021-01-01 Thread kernel test robot
Hi Samuel,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   eda809aef53426d044b519405d25d9da55319b76
commit: 2067fd92d75b6d9085a43caf050bca5d88c491b8 staging/speakup: Move out of 
staging
date:   5 months ago
config: riscv-randconfig-s031-20210102 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-184-g1b896707-dirty
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2067fd92d75b6d9085a43caf050bca5d88c491b8
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 2067fd92d75b6d9085a43caf050bca5d88c491b8
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 
CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 


"sparse warnings: (new ones prefixed by >>)"
>> drivers/accessibility/speakup/speakup_acntpc.c:262:28: sparse: sparse: cast 
>> removes address space '__iomem' of expression
>> drivers/accessibility/speakup/speakup_acntpc.c:262:28: sparse: sparse: 
>> incorrect type in argument 1 (different address spaces) @@ expected void 
>> const volatile [noderef] __iomem *addr @@ got void * @@
   drivers/accessibility/speakup/speakup_acntpc.c:262:28: sparse: expected 
void const volatile [noderef] __iomem *addr
   drivers/accessibility/speakup/speakup_acntpc.c:262:28: sparse: got void *
   drivers/accessibility/speakup/speakup_acntpc.c:273:36: sparse: sparse: cast 
removes address space '__iomem' of expression
   drivers/accessibility/speakup/speakup_acntpc.c:273:36: sparse: sparse: 
incorrect type in argument 1 (different address spaces) @@ expected void 
const volatile [noderef] __iomem *addr @@ got void * @@
   drivers/accessibility/speakup/speakup_acntpc.c:273:36: sparse: expected 
void const volatile [noderef] __iomem *addr
   drivers/accessibility/speakup/speakup_acntpc.c:273:36: sparse: got void *
   drivers/accessibility/speakup/speakup_acntpc.c: note: in included file 
(through arch/riscv/include/asm/io.h, include/linux/io.h, 
drivers/accessibility/speakup/spk_types.h, ...):
   include/asm-generic/io.h:556:16: sparse: sparse: cast removes address space 
'__iomem' of expression
   include/asm-generic/io.h:556:16: sparse: sparse: incorrect type in argument 
1 (different address spaces) @@ expected void const volatile [noderef] 
__iomem *addr @@ got void * @@
   include/asm-generic/io.h:556:16: sparse: expected void const volatile 
[noderef] __iomem *addr
   include/asm-generic/io.h:556:16: sparse: got void *
   include/asm-generic/io.h:556:16: sparse: sparse: cast removes address space 
'__iomem' of expression
   include/asm-generic/io.h:556:16: sparse: sparse: incorrect type in argument 
1 (different address spaces) @@ expected void const volatile [noderef] 
__iomem *addr @@ got void * @@
   include/asm-generic/io.h:556:16: sparse: expected void const volatile 
[noderef] __iomem *addr
   include/asm-generic/io.h:556:16: sparse: got void *
   include/asm-generic/io.h:580:9: sparse: sparse: cast removes address space 
'__iomem' of expression
   include/asm-generic/io.h:580:9: sparse: sparse: incorrect type in argument 2 
(different address spaces) @@ expected void volatile [noderef] __iomem 
*addr @@ got void * @@
   include/asm-generic/io.h:580:9: sparse: expected void volatile [noderef] 
__iomem *addr
   include/asm-generic/io.h:580:9: sparse: got void *
   include/asm-generic/io.h:556:16: sparse: sparse: cast removes address space 
'__iomem' of expression
   include/asm-generic/io.h:556:16: sparse: sparse: incorrect type in argument 
1 (different address spaces) @@ expected void const volatile [noderef] 
__iomem *addr @@ got void * @@
   include/asm-generic/io.h:556:16: sparse: expected void const volatile 
[noderef] __iomem *addr
   include/asm-generic/io.h:556:16: sparse: got void *
   include/asm-generic/io.h:556:16: sparse: sparse: cast removes address space 
'__iomem' of expression
   include/asm-generic/io.h:556:16: sparse: sparse: incorrect type in argument 
1 (different address spaces) @@ expected void const volatile [noderef] 
__iomem *addr @@ got void * @@
   include/asm-generic/io.h:556:16: sparse: expected void const volatile 
[noderef] __iomem *addr
   include/asm-generic/io.h:556:16: sparse: got void *
   include/asm-generic/io.h:580:9: sparse: sparse: cast removes address space 
'__iomem' of expression
   include/asm-generic/io.h:580:9: sparse: sparse: 

Re: [PATCH] HSI: Fix PM usage counter unbalance in ssi_hw_init

2021-01-01 Thread Sebastian Reichel
Hi,

On Mon, Nov 23, 2020 at 06:18:27PM +0800, Zhang Qilong wrote:
> pm_runtime_get_sync will increment pm usage counter
> even it failed. Forgetting to putting operation will
> result in reference leak here. We fix it by replacing
> it with pm_runtime_resume_and_get to keep usage counter
> balanced.
> 
> Fixes: b209e047bc743 ("HSI: Introduce OMAP SSI driver")
> Signed-off-by: Zhang Qilong 
> ---

Thanks, queued.

-- Sebastian

>  drivers/hsi/controllers/omap_ssi_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hsi/controllers/omap_ssi_core.c 
> b/drivers/hsi/controllers/omap_ssi_core.c
> index fa69b94debd9..b4ac2f8cb9f9 100644
> --- a/drivers/hsi/controllers/omap_ssi_core.c
> +++ b/drivers/hsi/controllers/omap_ssi_core.c
> @@ -424,7 +424,7 @@ static int ssi_hw_init(struct hsi_controller *ssi)
>   struct omap_ssi_controller *omap_ssi = hsi_controller_drvdata(ssi);
>   int err;
>  
> - err = pm_runtime_get_sync(ssi->device.parent);
> + err = pm_runtime_resume_and_get(ssi->device.parent);
>   if (err < 0) {
>   dev_err(>device, "runtime PM failed %d\n", err);
>   return err;
> -- 
> 2.25.4
> 


signature.asc
Description: PGP signature


drivers/dma/qcom/gpi.c:1254:15: warning: iteration 2 invokes undefined behavior

2021-01-01 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   eda809aef53426d044b519405d25d9da55319b76
commit: 5d0c3533a19f48e5e7e73806a3e4b29cd4364130 dmaengine: qcom: Add GPI dma 
driver
date:   5 weeks ago
config: arm64-randconfig-p002-20210102 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5d0c3533a19f48e5e7e73806a3e4b29cd4364130
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 5d0c3533a19f48e5e7e73806a3e4b29cd4364130
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=arm64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/dma/qcom/gpi.c: In function 'gpi_alloc_chan_resources':
>> drivers/dma/qcom/gpi.c:1254:15: warning: iteration 2 invokes undefined 
>> behavior [-Waggressive-loop-optimizations]
1254 |  struct gpii *gpii = gchan->gpii;
 |   ^~~~
   drivers/dma/qcom/gpi.c:1951:2: note: within this loop
1951 |  for (i = i - 1; i >= 0; i++) {
 |  ^~~


vim +1254 drivers/dma/qcom/gpi.c

  1251  
  1252  static int gpi_stop_chan(struct gchan *gchan)
  1253  {
> 1254  struct gpii *gpii = gchan->gpii;
  1255  int ret;
  1256  
  1257  ret = gpi_send_cmd(gpii, gchan, GPI_CH_CMD_STOP);
  1258  if (ret) {
  1259  dev_err(gpii->gpi_dev->dev, "Error with cmd:%s 
ret:%d\n",
  1260  TO_GPI_CMD_STR(GPI_CH_CMD_STOP), ret);
  1261  return ret;
  1262  }
  1263  
  1264  return 0;
  1265  }
  1266  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


Re: Generate the config file for kernel compilation non-interactively in script.

2021-01-01 Thread Hongyi Zhao
On Fri, Jan 1, 2021 at 2:32 PM Randy Dunlap  wrote:
>
> On 12/31/20 8:51 PM, Hongyi Zhao wrote:
> > Hi,
> >
> > I want to build the realtime Linux for ROS 2 according to the
> > guidelines here:
> > .
> >
> > For this purpose, I must enable the rt_preempt relative options in the
> > kernel withe the following method interactively:
> >
> > $ make menuconfig
> >
> > and set the following
> >
> > # Enable CONFIG_PREEMPT_RT
> >  -> General Setup
> >   -> Preemption Model (Fully Preemptible Kernel (Real-Time))
> >(X) Fully Preemptible Kernel (Real-Time)
> >
> > # Enable CONFIG_HIGH_RES_TIMERS
> >  -> General setup
> >   -> Timers subsystem
> >[*] High Resolution Timer Support
> >
> > # Enable CONFIG_NO_HZ_FULL
> >  -> General setup
> >   -> Timers subsystem
> >-> Timer tick handling (Full dynticks system (tickless))
> > (X) Full dynticks system (tickless)
> >
> > # Set CONFIG_HZ_1000 (note: this is no longer in the General Setup
> > menu, go back twice)
> >  -> Processor type and features
> >   -> Timer frequency (1000 HZ)
> >(X) 1000 HZ
> >
> > # Set CPU_FREQ_DEFAULT_GOV_PERFORMANCE [=y]
> >  ->  Power management and ACPI options
> >   -> CPU Frequency scaling
> >-> CPU Frequency scaling (CPU_FREQ [=y])
> > -> Default CPUFreq governor ( [=y])
> >  (X) performance
> >
> > But this is very inconvenient for doing the above job in script. Is
> > there an alternative method to generate the above configurations for
> > kernel compilation  non-interactively in script.
>
> Hi,
> You can use scripts/config in the kernel source tree.
> Something like this (I don't have RT kernel sources):
>
>
> scripts/config -e PREEMPT_RT
> scripts/config -e HIGH_RES_TIMERS
> scripts/config -e NO_HZ_FULL
> scripts/config -e HZ_1000
> scripts/config -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE

Based on the built-in help of this script:

$ bash scripts/config -h |& egrep -- '-e |--file|commands'
commands:
--enable|-e option   Enable option
commands can be repeated multiple times
--file config-file   .config file to change (default .config)

It's obviously that the above commands you suggested can be combined
into one as shown below:

$ scripts/config --file .config  -e PREEMPT_RT -e HIGH_RES_TIMERS -e
NO_HZ_FULL -e HZ_1000 -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE

or simply:

$ scripts/config -e PREEMPT_RT -e HIGH_RES_TIMERS -e NO_HZ_FULL -e
HZ_1000 -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE

BR,

>
>
> Note that if any of those have other Kconfig dependencies, those Kconfig
> symbols will also have to be enabled for this to work.
>
> And then run 'make oldconfig' to update the kernel .config file.
>
>
> HTH.
> --
> ~Randy
>


-- 
Assoc. Prof. Hongyi Zhao 
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China


Re: [PATCH v2 7/8] venus: venc: Handle reset encoder state

2021-01-01 Thread Fritz Koenig
How should we resolve this patch in relation to the "venus: venc: Init
the session only once in queue_setup" [1] patch?

"venus: venc: Init the session only once in queue_setup" comes after
and reworks |venc_start_streaming| substantially.  This patch
implements |venc_stop_streaming|, but maybe that is not needed with
the newer patch?  Can this one just be dropped, or does it need
rework?

-Fritz

[1]: https://lore.kernel.org/patchwork/patch/1349416/

On Wed, Nov 11, 2020 at 6:38 AM Stanimir Varbanov
 wrote:
>
> Redesign the encoder driver to be compliant with stateful encoder
> spec - specifically adds handling of Reset state.
>
> Signed-off-by: Stanimir Varbanov 
> ---
>  drivers/media/platform/qcom/venus/venc.c | 155 ++-
>  1 file changed, 122 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/media/platform/qcom/venus/venc.c 
> b/drivers/media/platform/qcom/venus/venc.c
> index 7512e4a16270..f1ae89d45a54 100644
> --- a/drivers/media/platform/qcom/venus/venc.c
> +++ b/drivers/media/platform/qcom/venus/venc.c
> @@ -907,6 +907,54 @@ static int venc_queue_setup(struct vb2_queue *q,
> return ret;
>  }
>
> +static void venc_release_session(struct venus_inst *inst)
> +{
> +   int ret, abort = 0;
> +
> +   mutex_lock(>lock);
> +
> +   ret = hfi_session_deinit(inst);
> +   abort = (ret && ret != -EINVAL) ? 1 : 0;
> +
> +   if (inst->session_error)
> +   abort = 1;
> +
> +   if (abort)
> +   hfi_session_abort(inst);
> +
> +   venus_pm_load_scale(inst);
> +   INIT_LIST_HEAD(>registeredbufs);
> +   mutex_unlock(>lock);
> +
> +   venus_pm_release_core(inst);
> +}
> +
> +static int venc_buf_init(struct vb2_buffer *vb)
> +{
> +   struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue);
> +
> +   inst->buf_count++;
> +
> +   return venus_helper_vb2_buf_init(vb);
> +}
> +
> +static void venc_buf_cleanup(struct vb2_buffer *vb)
> +{
> +   struct venus_inst *inst = vb2_get_drv_priv(vb->vb2_queue);
> +   struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
> +   struct venus_buffer *buf = to_venus_buffer(vbuf);
> +
> +   mutex_lock(>lock);
> +   if (vb->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
> +   if (!list_empty(>registeredbufs))
> +   list_del_init(>reg_list);
> +   mutex_unlock(>lock);
> +
> +   inst->buf_count--;
> +   if (!inst->buf_count)
> +   venc_release_session(inst);
> +}
> +
>  static int venc_verify_conf(struct venus_inst *inst)
>  {
> enum hfi_version ver = inst->core->res->hfi_version;
> @@ -938,49 +986,57 @@ static int venc_verify_conf(struct venus_inst *inst)
>  static int venc_start_streaming(struct vb2_queue *q, unsigned int count)
>  {
> struct venus_inst *inst = vb2_get_drv_priv(q);
> +   struct v4l2_m2m_ctx *m2m_ctx = inst->m2m_ctx;
> int ret;
>
> mutex_lock(>lock);
>
> -   if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
> +   v4l2_m2m_update_start_streaming_state(m2m_ctx, q);
> +
> +   if (V4L2_TYPE_IS_OUTPUT(q->type))
> inst->streamon_out = 1;
> else
> inst->streamon_cap = 1;
>
> -   if (!(inst->streamon_out & inst->streamon_cap)) {
> -   mutex_unlock(>lock);
> -   return 0;
> -   }
> +   if (inst->streamon_out && inst->streamon_cap &&
> +   inst->state == INST_UNINIT) {
> +   venus_helper_init_instance(inst);
>
> -   venus_helper_init_instance(inst);
> +   inst->sequence_cap = 0;
> +   inst->sequence_out = 0;
>
> -   inst->sequence_cap = 0;
> -   inst->sequence_out = 0;
> +   ret = venc_init_session(inst);
> +   if (ret)
> +   goto bufs_done;
>
> -   ret = venc_init_session(inst);
> -   if (ret)
> -   goto bufs_done;
> +   ret = venus_pm_acquire_core(inst);
> +   if (ret)
> +   goto deinit_sess;
>
> -   ret = venus_pm_acquire_core(inst);
> -   if (ret)
> -   goto deinit_sess;
> +   ret = venc_verify_conf(inst);
> +   if (ret)
> +   goto deinit_sess;
>
> -   ret = venc_set_properties(inst);
> -   if (ret)
> -   goto deinit_sess;
> +   ret = venus_helper_set_num_bufs(inst, inst->num_input_bufs,
> +   inst->num_output_bufs, 0);
> +   if (ret)
> +   goto deinit_sess;
>
> -   ret = venc_verify_conf(inst);
> -   if (ret)
> -   goto deinit_sess;
> +   ret = venus_helper_vb2_start_streaming(inst);
> +   if (ret)
> +   goto deinit_sess;
>
> -   ret = venus_helper_set_num_bufs(inst, inst->num_input_bufs,
> -   inst->num_output_bufs, 0);
> -   if (ret)
> -

Re: Generate the config file for kernel compilation non-interactively in script.

2021-01-01 Thread Hongyi Zhao
On Sat, Jan 2, 2021 at 12:28 AM Randy Dunlap  wrote:
>
> Hi,
>
> On 1/1/21 1:55 AM, Hongyi Zhao wrote:
> > On Fri, Jan 1, 2021 at 2:32 PM Randy Dunlap  wrote:
> >>
> >> On 12/31/20 8:51 PM, Hongyi Zhao wrote:
> >>> Hi,
> >>>
> >>> I want to build the realtime Linux for ROS 2 according to the
> >>> guidelines here:
> >>> .
> >>>
> >>> For this purpose, I must enable the rt_preempt relative options in the
> >>> kernel withe the following method interactively:
> >>>
> >>> $ make menuconfig
> >>>
> >>> and set the following
> >>>
> >>> # Enable CONFIG_PREEMPT_RT
> >>>  -> General Setup
> >>>   -> Preemption Model (Fully Preemptible Kernel (Real-Time))
> >>>(X) Fully Preemptible Kernel (Real-Time)
> >>>
> >>> # Enable CONFIG_HIGH_RES_TIMERS
> >>>  -> General setup
> >>>   -> Timers subsystem
> >>>[*] High Resolution Timer Support
> >>>
> >>> # Enable CONFIG_NO_HZ_FULL
> >>>  -> General setup
> >>>   -> Timers subsystem
> >>>-> Timer tick handling (Full dynticks system (tickless))
> >>> (X) Full dynticks system (tickless)
> >>>
> >>> # Set CONFIG_HZ_1000 (note: this is no longer in the General Setup
> >>> menu, go back twice)
> >>>  -> Processor type and features
> >>>   -> Timer frequency (1000 HZ)
> >>>(X) 1000 HZ
> >>>
> >>> # Set CPU_FREQ_DEFAULT_GOV_PERFORMANCE [=y]
> >>>  ->  Power management and ACPI options
> >>>   -> CPU Frequency scaling
> >>>-> CPU Frequency scaling (CPU_FREQ [=y])
> >>> -> Default CPUFreq governor ( [=y])
> >>>  (X) performance
> >>>
> >>> But this is very inconvenient for doing the above job in script. Is
> >>> there an alternative method to generate the above configurations for
> >>> kernel compilation  non-interactively in script.
> >>
> >> Hi,
> >> You can use scripts/config in the kernel source tree.
> >> Something like this (I don't have RT kernel sources):
> >>
> >>
> >> scripts/config -e PREEMPT_RT
> >> scripts/config -e HIGH_RES_TIMERS
> >> scripts/config -e NO_HZ_FULL
> >> scripts/config -e HZ_1000
> >> scripts/config -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE
> >
> > Wonderful. Thanks a lot for your instructions. I really have noticed
> > this tool but failed to figure out the corresponding translation rules
> > for the options used by menuconfig and this script.
> >
> > BTW, how do you figure out the above options/arguments corresponding
> > to the ones I've mentioned previously?
> >
>
> Oh, I just took the ones that you had listed and removed the leading
> "CONFIG_" from them.
>
> >>
> >> Note that if any of those have other Kconfig dependencies, those Kconfig
> >> symbols will also have to be enabled for this to work.
> >
> > How to know whether an option has other Kconfig dependencies and find
> > the corresponding symbols/arguments for feeding to scripts/config?
>
> Use one of the interactive config tools (nconfig, xconfig).
> They will show you dependencies, but you may have to enable other
> symbols first.
>
> Maybe it would be easier to do a temporary 'make allmodconfig'
> to have the symbols that you are interested in be enabled, then
> you can find them and look at their dependencies.

It sounds still complicated for manually operation of the above
mentioned procedure even by the virtue of scripts/config. The more
feasible way should be done with python package/binding/library
programmatically, but I'm not sure whether such stuff exists.

BR,
-- 
Assoc. Prof. Hongyi Zhao 
Theory and Simulation of Materials
Hebei Polytechnic University of Science and Technology engineering
NO. 552 North Gangtie Road, Xingtai, China


[PATCH] entry: Use different define for selector variable in SUD

2021-01-01 Thread Gabriel Krisman Bertazi
Michael Kerrisk suggested that, from an API perspective, it is a bad
idea to share the PR_SYS_DISPATCH_ defines between the prctl operation
and the selector variable.  Therefore, define two new constants to be
used by SUD's selector variable, and the corresponding documentation.

While this changes the API, it is backward compatible, as the values
remained the same and the old defines are still in place.  In addition,
SUD has never been part of a Linux release, it will show up for the
first time in 5.11.

Cc: Linux API 
Suggested-by: Michael Kerrisk (man-pages) 
Signed-off-by: Gabriel Krisman Bertazi 
---
 .../admin-guide/syscall-user-dispatch.rst  |  4 ++--
 include/uapi/linux/prctl.h |  2 ++
 kernel/entry/syscall_user_dispatch.c   |  4 ++--
 .../syscall_user_dispatch/sud_benchmark.c  |  8 +---
 .../selftests/syscall_user_dispatch/sud_test.c | 14 --
 5 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Documentation/admin-guide/syscall-user-dispatch.rst 
b/Documentation/admin-guide/syscall-user-dispatch.rst
index a380d6515774..fc13112e36e3 100644
--- a/Documentation/admin-guide/syscall-user-dispatch.rst
+++ b/Documentation/admin-guide/syscall-user-dispatch.rst
@@ -70,8 +70,8 @@ trampoline code on the vDSO, that trampoline is never 
intercepted.
 [selector] is a pointer to a char-sized region in the process memory
 region, that provides a quick way to enable disable syscall redirection
 thread-wide, without the need to invoke the kernel directly.  selector
-can be set to PR_SYS_DISPATCH_ON or PR_SYS_DISPATCH_OFF.  Any other
-value should terminate the program with a SIGSYS.
+can be set to PR_SYS_DISPATCH_FILTER_ALLOW or PR_SYS_DISPATCH_FILTER_BLOCK.
+Any other value should terminate the program with a SIGSYS.
 
 Security Notes
 --
diff --git a/include/uapi/linux/prctl.h b/include/uapi/linux/prctl.h
index 90deb41c8a34..a66c9fe41249 100644
--- a/include/uapi/linux/prctl.h
+++ b/include/uapi/linux/prctl.h
@@ -251,5 +251,7 @@ struct prctl_mm_map {
 #define PR_SET_SYSCALL_USER_DISPATCH   59
 # define PR_SYS_DISPATCH_OFF   0
 # define PR_SYS_DISPATCH_ON1
+# define PR_SYS_DISPATCH_FILTER_ALLOW  0
+# define PR_SYS_DISPATCH_FILTER_BLOCK  1
 
 #endif /* _LINUX_PRCTL_H */
diff --git a/kernel/entry/syscall_user_dispatch.c 
b/kernel/entry/syscall_user_dispatch.c
index b0338a5625d9..265c33b26dcf 100644
--- a/kernel/entry/syscall_user_dispatch.c
+++ b/kernel/entry/syscall_user_dispatch.c
@@ -50,10 +50,10 @@ bool syscall_user_dispatch(struct pt_regs *regs)
if (unlikely(__get_user(state, sd->selector)))
do_exit(SIGSEGV);
 
-   if (likely(state == PR_SYS_DISPATCH_OFF))
+   if (likely(state == PR_SYS_DISPATCH_FILTER_ALLOW))
return false;
 
-   if (state != PR_SYS_DISPATCH_ON)
+   if (state != PR_SYS_DISPATCH_FILTER_BLOCK)
do_exit(SIGSYS);
}
 
diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c 
b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
index 6689f1183dbf..7617bd9ba6e1 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_benchmark.c
@@ -22,6 +22,8 @@
 # define PR_SET_SYSCALL_USER_DISPATCH  59
 # define PR_SYS_DISPATCH_OFF   0
 # define PR_SYS_DISPATCH_ON1
+# define PR_SYS_DISPATCH_FILTER_ALLOW  0
+# define PR_SYS_DISPATCH_FILTER_BLOCK  1
 #endif
 
 #ifdef __NR_syscalls
@@ -55,8 +57,8 @@ unsigned long trapped_call_count = 0;
 unsigned long native_call_count = 0;
 
 char selector;
-#define SYSCALL_BLOCK   (selector = PR_SYS_DISPATCH_ON)
-#define SYSCALL_UNBLOCK (selector = PR_SYS_DISPATCH_OFF)
+#define SYSCALL_BLOCK   (selector = PR_SYS_DISPATCH_FILTER_BLOCK)
+#define SYSCALL_UNBLOCK (selector = PR_SYS_DISPATCH_FILTER_ALLOW)
 
 #define CALIBRATION_STEP 10
 #define CALIBRATE_TO_SECS 5
@@ -170,7 +172,7 @@ int main(void)
syscall(MAGIC_SYSCALL_1);
 
 #ifdef TEST_BLOCKED_RETURN
-   if (selector == PR_SYS_DISPATCH_OFF) {
+   if (selector == PR_SYS_DISPATCH_FILTER_ALLOW) {
fprintf(stderr, "Failed to return with selector blocked.\n");
exit(-1);
}
diff --git a/tools/testing/selftests/syscall_user_dispatch/sud_test.c 
b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
index 6498b050ef89..21e1550db118 100644
--- a/tools/testing/selftests/syscall_user_dispatch/sud_test.c
+++ b/tools/testing/selftests/syscall_user_dispatch/sud_test.c
@@ -18,6 +18,8 @@
 # define PR_SET_SYSCALL_USER_DISPATCH  59
 # define PR_SYS_DISPATCH_OFF   0
 # define PR_SYS_DISPATCH_ON1
+# define PR_SYS_DISPATCH_FILTER_ALLOW  0
+# define PR_SYS_DISPATCH_FILTER_BLOCK  1
 #endif
 
 #ifndef SYS_USER_DISPATCH
@@ -30,8 +32,8 @@
 # define MAGIC_SYSCALL_1 (0xff00)  /* Bad Linux syscall number */
 #endif
 
-#define 

Re: [GIT PULL] Power management updates for v5.11-rc2

2021-01-01 Thread Rafael J. Wysocki
On Fri, Jan 1, 2021 at 10:12 PM Linus Torvalds
 wrote:
>
> On Fri, Jan 1, 2021 at 8:51 AM Rafael J. Wysocki  wrote:
> >
> >  - Add new power capping facility called DTPM (Dynamic Thermal Power
> >Management), based on the existing power capping framework, to
> >allow aggregate power constraints to be applied to sets of devices
> >in a distributed manner, along with a CPU backend driver based on
> >the Energy Model (Daniel Lezcano).
>
> This seems very much a non-fix thing.

Well, that's right.

> Please explain why I should accept this outside the merge window.

This material has been in the works for quite a while and it missed
the merge window mostly due to unfavorable timing, so it is not a
last-minute thing.

It is self-contained and it doesn't interfere with the existing
features, so it is not likely to introduce regressions in my view.

I didn't think that there was much to gain by postponing it, because
it wouldn't change substantially between now and the next merge window
and the testing coverage of it in linux-next would be limited.  On the
other hand, having it in the tree would encourage people to build on
top of it, exercise it and provide feedback, so I decided to include
it here.

However, if you'd rather skip it this time, I'll be happy to resend
the pull request without it.

Rafael


Re: Linux 5.11-rc1

2021-01-01 Thread Sedat Dilek
On Fri, Jan 1, 2021 at 7:55 PM Sedat Dilek  wrote:
>
> On Fri, Jan 1, 2021 at 5:14 PM Pavel Machek  wrote:
> >
> > Hi!
> > > >
> > > > > $ dpkg -L kmod | grep bin | grep depmod
> > > > > /sbin/depmod
> > > > >
> > > > > $ which depmod
> > > > > [ empty ]
> > > > >
> > > > > $ echo $PATH
> > > > > /opt/proxychains-ng/bin:/home/dileks/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> > >
> > > Ok, I think this is a broken setup that has a separate /sbin but does
> > > not have it in the PATH.
> >
> > That's how it is supposed to work, AFAICT. It is so on Debian here,
> > for example.
> >
> > /sbin is for management commands, why would I have it in PATH when
> > running as normal user?
> >
>
> I am here on Debian/testing AMD64 and waiting for feedback [2].
>
> For now I have applied the diff from [1].
>
> - Sedat -
>
> [1] https://marc.info/?l=linux-kbuild=160919738006768=2
> [2] https://marc.info/?l=linux-kernel=160919729606750=2

Fixed upstream, see "depmod: handle the case of /sbin/depmod without
/sbin in PATH".

- Sedat -

[1] https://git.kernel.org/linus/cedd1862be7e666be87ec824dabc6a2b05618f36


[PATCH] docs: ALSA: Fix reference to mixart.rst

2021-01-01 Thread Jonathan Neuschäfer
MIXART.txt has been converted to ReST and renamed. Fix the reference
in alsa-configuration.rst.

Fixes: 3d8e81862ce4 ("ALSA: doc: ReSTize MIXART.txt")
Signed-off-by: Jonathan Neuschäfer 
---
 Documentation/sound/alsa-configuration.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/sound/alsa-configuration.rst 
b/Documentation/sound/alsa-configuration.rst
index fe52c314b7639..b36af65a08edf 100644
--- a/Documentation/sound/alsa-configuration.rst
+++ b/Documentation/sound/alsa-configuration.rst
@@ -1501,7 +1501,7 @@ Module for Digigram miXart8 sound cards.

 This module supports multiple cards.
 Note: One miXart8 board will be represented as 4 alsa cards.
-See MIXART.txt for details.
+See Documentation/sound/cards/mixart.rst for details.

 When the driver is compiled as a module and the hotplug firmware
 is supported, the firmware data is loaded via hotplug automatically.
--
2.29.2



Re: [xfs] db962cd266: Assertion_failed

2021-01-01 Thread Dave Chinner
On Fri, Jan 01, 2021 at 05:10:49PM +0800, Yafang Shao wrote:
> On Thu, Dec 31, 2020 at 10:46 AM kernel test robot
>  wrote:
.
> > [  552.905799] XFS: Assertion failed: !current->journal_info, file: 
> > fs/xfs/xfs_trans.h, line: 280
> > [  553.104459]  xfs_trans_reserve+0x225/0x320 [xfs]
> > [  553.110556]  xfs_trans_roll+0x6e/0xe0 [xfs]
> > [  553.116134]  xfs_defer_trans_roll+0x104/0x2a0 [xfs]
> > [  553.122489]  ? xfs_extent_free_create_intent+0x62/0xc0 [xfs]
> > [  553.129780]  xfs_defer_finish_noroll+0xb8/0x620 [xfs]
> > [  553.136299]  xfs_defer_finish+0x11/0xa0 [xfs]
> > [  553.142017]  xfs_itruncate_extents_flags+0x141/0x440 [xfs]
> > [  553.149053]  xfs_setattr_size+0x3da/0x480 [xfs]
> > [  553.154939]  ? setattr_prepare+0x6a/0x1e0
> > [  553.160250]  xfs_vn_setattr+0x70/0x120 [xfs]
> > [  553.165833]  notify_change+0x364/0x500
> > [  553.170820]  ? do_truncate+0x76/0xe0
> > [  553.175673]  do_truncate+0x76/0xe0
> > [  553.180184]  path_openat+0xe6c/0x10a0
> > [  553.184981]  do_filp_open+0x91/0x100
> > [  553.189707]  ? __check_object_size+0x136/0x160
> > [  553.195493]  do_sys_openat2+0x20d/0x2e0
> > [  553.200481]  do_sys_open+0x44/0x80
> > [  553.204926]  do_syscall_64+0x33/0x40
> > [  553.209588]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> 
> Thanks for the report.
> 
> At a first glance, it seems we should make a similar change as we did
> in xfs_trans_context_clear().
> 
> static inline void
> xfs_trans_context_set(struct xfs_trans *tp)
> {
> /*
>  * We have already handed over the context via xfs_trans_context_swap().
>  */
> if (current->journal_info)
> return;
> current->journal_info = tp;
> tp->t_pflags = memalloc_nofs_save();
> }

Ah, no.

Remember how I said "split out the wrapping of transaction
context setup in xfs_trans_reserve() from
the lifting of the context setting into xfs_trans_alloc()"?

Well, you did the former and dropped the latter out of the patch
set.

Now when a transaction rolls after xfs_trans_context_swap(), it
calls xfs_trans_reserve() and tries to do transaction context setup
work inside a transaction context that already exists.  IOWs, you
need to put the patch that lifts of the context setting up into
xfs_trans_alloc() back into the patchset before adding the
current->journal functionality patch.

Also, you need to test XFS code with CONFIG_XFS_DEBUG=y so that
asserts are actually built into the code and exercised, because this
ASSERT should have fired on the first rolling transaction that the
kernel executes...

Cheers,

Dave.
-- 
Dave Chinner
da...@fromorbit.com


[PATCH] docs: Include ext4 documentation via filesystems/

2021-01-01 Thread Jonathan Neuschäfer
The documentation for other filesystems is already included via
filesystems/index.rst. Include ext4 in the same way and remove it
from the top-level table of contents.

Signed-off-by: Jonathan Neuschäfer 
---
 Documentation/filesystems/index.rst |  1 +
 Documentation/index.rst | 11 ---
 2 files changed, 1 insertion(+), 11 deletions(-)

diff --git a/Documentation/filesystems/index.rst 
b/Documentation/filesystems/index.rst
index 7be9b46d85d9b..1f76b1cb33484 100644
--- a/Documentation/filesystems/index.rst
+++ b/Documentation/filesystems/index.rst
@@ -83,6 +83,7 @@ Documentation for filesystem implementations.
erofs
ext2
ext3
+   ext4/index
f2fs
gfs2
gfs2-uevents
diff --git a/Documentation/index.rst b/Documentation/index.rst
index 5888e8a7272fd..31f2adc8542dc 100644
--- a/Documentation/index.rst
+++ b/Documentation/index.rst
@@ -171,17 +171,6 @@ implementation.
x86/index
xtensa/index

-Filesystem Documentation
-
-
-The documentation in this section are provided by specific filesystem
-subprojects.
-
-.. toctree::
-   :maxdepth: 2
-
-   filesystems/ext4/index
-
 Other documentation
 ---

--
2.29.2



Re: [GIT PULL] SCSI fixes for 5.11-rc1

2021-01-01 Thread James Bottomley
On Fri, 2021-01-01 at 13:21 -0800, Linus Torvalds wrote:
> On Fri, Jan 1, 2021 at 12:19 PM James Bottomley
>  wrote:
> > Originally this change was slated for the merge window but a late
> > arriving build problem with CONFIG_PM=n derailed that.
> 
> So I've pulled this,

Thanks!

>  but we need to have a policy for reverting this
> quickly if it turns out to cause problems.

Sure, we'd have to revert the six patches plus the dependent PM fix.

> I'm not worried about any remaining build issues - but I'm simply
> worried about some missed case where code depended on the block layer
> passing commands through even while suspended.
> 
> The block bits would seem affect non-SCSI stuff too, how extensively
> have any random odd special case been tested?

The block bits have been in -next since 7 December, so it has had some
testing.  That said, REQ_PREEMPT doesn't affect much outside of SCSI
and IDE because we're where the original concept of at head insertion
for "special" error handling commands like request sense came from.

I'd expect the biggest field of potential problems to be in USB which
does both block/SCSI and PM.  That should have been well tested by the
PM people (as far as they can, as you know there are tons of non spec
devices out there in the space).

> So I'm not so much with you on the "the scary case is the spi domain
> validation case".  I'm more about "what about all the other random
> cases for random special drivers"

I picked on that because it's the least likely to get any testing for a
while.  However, you're right, there are other potential problem
consumers but hopefully any problem (if there is one) with the rest
will show up quickly.

James




[PATCH] dt-bindings: mips: lantiq: Document Lantiq Xway EBU bindings

2021-01-01 Thread Aleksander Jan Bajkowski
Document the Lantiq Xway SoC series External Bus Unit (EBU) bindings.

Signed-off-by: Aleksander Jan Bajkowski 
---
 .../bindings/mips/lantiq/lantiq,ebu.yaml  | 32 +++
 1 file changed, 32 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/mips/lantiq/lantiq,ebu.yaml

diff --git a/Documentation/devicetree/bindings/mips/lantiq/lantiq,ebu.yaml 
b/Documentation/devicetree/bindings/mips/lantiq/lantiq,ebu.yaml
new file mode 100644
index ..0fada1f085a9
--- /dev/null
+++ b/Documentation/devicetree/bindings/mips/lantiq/lantiq,ebu.yaml
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mips/lantiq/lantiq,ebu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lantiq Xway SoC series External Bus Unit (EBU)
+
+maintainers:
+  - John Crispin 
+
+properties:
+  compatible:
+items:
+  - enum:
+  - lantiq,ebu-xway
+
+  reg:
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+ebu@105300 {
+compatible = "lantiq,ebu-xway";
+reg = <0x105300 0x100>;
+};
-- 
2.20.1



Re: [PATCH 1/2] dt-bindings: memory: Renesas RPC-IF: Add support for RZ/G2 Series

2021-01-01 Thread Adam Ford
On Fri, Jan 1, 2021 at 12:58 PM Biju Das  wrote:
>
> Hi Adam,
>
> Thanks for the patch.
>
> > -Original Message-
> > From: Adam Ford 
> > Sent: 01 January 2021 11:39
> > To: linux-renesas-...@vger.kernel.org
> > Cc: af...@beaconembedded.com; Adam Ford ; Krzysztof
> > Kozlowski ; Rob Herring ; Geert
> > Uytterhoeven ; Magnus Damm
> > ; Sergei Shtylyov ;
> > linux-kernel@vger.kernel.org; devicet...@vger.kernel.org
> > Subject: [PATCH 1/2] dt-bindings: memory: Renesas RPC-IF: Add support for
> > RZ/G2 Series
> >
> > The RZ/G2 Series has the RPC-IF interface.
> > Update bindings to support: r8a774a1, r8a774b1, r8a774c0, and r8a774e1
> >
> > Signed-off-by: Adam Ford 
> > ---
> >  .../bindings/memory-controllers/renesas,rpc-if.yaml   | 4 
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/memory-
> > controllers/renesas,rpc-if.yaml
> > b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
> > index 6d6ba608fd22..050c66af8c2c 100644
> > --- a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-
> > if.yaml
> > +++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-
> > if.yaml
> > @@ -26,6 +26,10 @@ properties:
> >compatible:
> >  items:
> >- enum:
> > +  - renesas,r8a774a1-rpc-if   # RZ/G2M
> > +  - renesas,r8a774b1-rpc-if   # RZ/G2N
> > +  - renesas,r8a774c0-rpc-if   # RZ/G2E
> > +  - renesas,r8a774e1-rpc-if   # RZ/G2H
> >- renesas,r8a77970-rpc-if   # R-Car V3M
> >- renesas,r8a77980-rpc-if   # R-Car V3H
> >- renesas,r8a77995-rpc-if   # R-Car D3
>
> May be we need to update the below description as well to cover RZ/G2 device??
>
> - const: renesas,rcar-gen3-rpc-if   # a generic R-Car gen3 device

How do you want it to read?

adam
>
> Cheers,
> Biju
>
>
> > --
> > 2.25.1
>


[PATCH] scripts/jobserver-exec: Fix a typo ("envirnoment")

2021-01-01 Thread Jonathan Neuschäfer
Signed-off-by: Jonathan Neuschäfer 
---
 scripts/jobserver-exec | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/jobserver-exec b/scripts/jobserver-exec
index 0fdb31a790a81..1c779cd1ccb48 100755
--- a/scripts/jobserver-exec
+++ b/scripts/jobserver-exec
@@ -10,7 +10,7 @@ from __future__ import print_function
 import os, sys, errno
 import subprocess

-# Extract and prepare jobserver file descriptors from envirnoment.
+# Extract and prepare jobserver file descriptors from environment.
 claim = 0
 jobs = b""
 try:
--
2.29.2



Re: [GIT PULL] SCSI fixes for 5.11-rc1

2021-01-01 Thread pr-tracker-bot
The pull request you sent on Fri, 01 Jan 2021 12:19:11 -0800:

> git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/eda809aef53426d044b519405d25d9da55319b76

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html


Re: [GIT PULL] SCSI fixes for 5.11-rc1

2021-01-01 Thread Linus Torvalds
On Fri, Jan 1, 2021 at 12:19 PM James Bottomley
 wrote:
>
> Originally this change was slated for the merge window but a late
> arriving build problem with CONFIG_PM=n derailed that.

So I've pulled this, but we need to have a policy for reverting this
quickly if it turns out to cause problems.

I'm not worried about any remaining build issues - but I'm simply
worried about some missed case where code depended on the block layer
passing commands through even while suspended.

The block bits would seem affect non-SCSI stuff too, how extensively
have any random odd special case been tested?

So I'm not so much with you on the "the scary case is the spi domain
validation case".  I'm more about "what about all the other random
cases for random special drivers"

Linus


[PATCH] drm/mipi-dbi: Switch to new kerneldoc syntax for named variable macro argument

2021-01-01 Thread Jonathan Neuschäfer
The syntax without dots is available since commit 43756e347f21
("scripts/kernel-doc: Add support for named variable macro arguments").

The same HTML output is produced with and without this patch.

Signed-off-by: Jonathan Neuschäfer 
---
 include/drm/drm_mipi_dbi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/drm/drm_mipi_dbi.h b/include/drm/drm_mipi_dbi.h
index c2827ceaba0d2..f543d6e3e822c 100644
--- a/include/drm/drm_mipi_dbi.h
+++ b/include/drm/drm_mipi_dbi.h
@@ -172,7 +172,7 @@ int mipi_dbi_buf_copy(void *dst, struct drm_framebuffer *fb,
  * mipi_dbi_command - MIPI DCS command with optional parameter(s)
  * @dbi: MIPI DBI structure
  * @cmd: Command
- * @seq...: Optional parameter(s)
+ * @seq: Optional parameter(s)
  *
  * Send MIPI DCS command to the controller. Use mipi_dbi_command_read() for
  * get/read.
--
2.29.2



[PATCH] docs: binfmt-misc: Fix .rst formatting

2021-01-01 Thread Jonathan Neuschäfer
"name below" is not part of the /proc path and should not be formatted
in monospace.

"doesn``t" is rendered in HTML with a double backtick. Revert it back to
"doesn't".

Signed-off-by: Jonathan Neuschäfer 
---
 Documentation/admin-guide/binfmt-misc.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/admin-guide/binfmt-misc.rst 
b/Documentation/admin-guide/binfmt-misc.rst
index 7a864131e5ea7..59cd902e35497 100644
--- a/Documentation/admin-guide/binfmt-misc.rst
+++ b/Documentation/admin-guide/binfmt-misc.rst
@@ -23,7 +23,7 @@ Here is what the fields mean:

 - ``name``
is an identifier string. A new /proc file will be created with this
-   ``name below /proc/sys/fs/binfmt_misc``; cannot contain slashes ``/`` for
+   name below ``/proc/sys/fs/binfmt_misc``; cannot contain slashes ``/`` for
obvious reasons.
 - ``type``
is the type of recognition. Give ``M`` for magic and ``E`` for extension.
@@ -83,7 +83,7 @@ Here is what the fields mean:
   ``F`` - fix binary
 The usual behaviour of binfmt_misc is to spawn the
binary lazily when the misc format file is invoked.  However,
-   this doesn``t work very well in the face of mount namespaces and
+   this doesn't work very well in the face of mount namespaces and
changeroots, so the ``F`` mode opens the binary as soon as the
emulation is installed and uses the opened image to spawn the
emulator, meaning it is always available once installed,
--
2.29.2



Re: [GIT PULL] Power management updates for v5.11-rc2

2021-01-01 Thread Linus Torvalds
On Fri, Jan 1, 2021 at 8:51 AM Rafael J. Wysocki  wrote:
>
>  - Add new power capping facility called DTPM (Dynamic Thermal Power
>Management), based on the existing power capping framework, to
>allow aggregate power constraints to be applied to sets of devices
>in a distributed manner, along with a CPU backend driver based on
>the Energy Model (Daniel Lezcano).

This seems very much a non-fix thing.

Please explain why I should accept this outside the merge window.

 Linus


ld.lld: error: undefined symbol: sdw_intel_acpi_scan

2021-01-01 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f6e1ea19649216156576aeafa784e3b4cee45549
commit: a115ab9b8b93e7f0ff28a4fc869a3222ae921edd ASoC: SOF: Intel: add build 
support for SoundWire
date:   4 months ago
config: x86_64-randconfig-a014-20210102 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 
d1fd72343c6ff58a3b66bc0df56fed9ac21e4056)
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a115ab9b8b93e7f0ff28a4fc869a3222ae921edd
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a115ab9b8b93e7f0ff28a4fc869a3222ae921edd
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

>> ld.lld: error: undefined symbol: sdw_intel_acpi_scan
   >>> referenced by hda.c:137 (sound/soc/sof/intel/hda.c:137)
   >>> soc/sof/intel/hda.o:(hda_dsp_probe) in archive sound/built-in.a
   >>> referenced by intel-dsp-config.c:360 (sound/hda/intel-dsp-config.c:360)
   >>> hda/intel-dsp-config.o:(snd_intel_dsp_driver_probe) in archive 
sound/built-in.a
--
>> ld.lld: error: undefined symbol: sdw_intel_probe
   >>> referenced by hda.c:172 (sound/soc/sof/intel/hda.c:172)
   >>> soc/sof/intel/hda.o:(hda_dsp_probe) in archive sound/built-in.a
--
>> ld.lld: error: undefined symbol: sdw_intel_thread
   >>> referenced by hda.c:239 (sound/soc/sof/intel/hda.c:239)
   >>> soc/sof/intel/hda.o:(hda_dsp_interrupt_thread) in archive 
sound/built-in.a
--
>> ld.lld: error: undefined symbol: sdw_intel_process_wakeen_event
   >>> referenced by hda.c:263 (sound/soc/sof/intel/hda.c:263)
   >>> soc/sof/intel/hda.o:(hda_dsp_interrupt_thread) in archive 
sound/built-in.a
   >>> referenced by hda.c:263 (sound/soc/sof/intel/hda.c:263)
   >>> soc/sof/intel/hda.o:(hda_sdw_process_wakeen) in archive sound/built-in.a
--
>> ld.lld: error: undefined symbol: sdw_intel_enable_irq
   >>> referenced by hda.c:123 (sound/soc/sof/intel/hda.c:123)
   >>> soc/sof/intel/hda.o:(hda_dsp_remove) in archive sound/built-in.a
   >>> referenced by hda.c:123 (sound/soc/sof/intel/hda.c:123)
   >>> soc/sof/intel/hda.o:(hda_sdw_int_enable) in archive sound/built-in.a
--
>> ld.lld: error: undefined symbol: sdw_intel_exit
   >>> referenced by hda.c:205 (sound/soc/sof/intel/hda.c:205)
   >>> soc/sof/intel/hda.o:(hda_dsp_remove) in archive sound/built-in.a
--
>> ld.lld: error: undefined symbol: sdw_intel_startup
   >>> referenced by hda.c:193 (sound/soc/sof/intel/hda.c:193)
   >>> soc/sof/intel/hda.o:(hda_sdw_startup) in archive sound/built-in.a

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SOUNDWIRE_INTEL
   Depends on SOUNDWIRE && ACPI && SND_SOC
   Selected by
   - SND_SOC_SOF_INTEL_SOUNDWIRE && SOUND && !UML && SND && SND_SOC && 
SND_SOC_SOF_TOPLEVEL && SND_SOC_SOF_INTEL_TOPLEVEL && SND_SOC_SOF_INTEL_PCI

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org


.config.gz
Description: application/gzip


[PATCH] docs: gpio: intro: Improve HTML formatting

2021-01-01 Thread Jonathan Neuschäfer
Currently the HTML output for Documentation/driver-api/gpio/intro.rst
doesn't look right. The lines that start with LOW or HIGH are formatted
in bold, while the next line after each is not bold.

With this patch, the HTML looks better.

Signed-off-by: Jonathan Neuschäfer 
---
 Documentation/driver-api/gpio/intro.rst | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Documentation/driver-api/gpio/intro.rst 
b/Documentation/driver-api/gpio/intro.rst
index 74591489d0b55..94dd7185e76eb 100644
--- a/Documentation/driver-api/gpio/intro.rst
+++ b/Documentation/driver-api/gpio/intro.rst
@@ -106,11 +106,11 @@ don't. When you need open drain signaling but your 
hardware doesn't directly
 support it, there's a common idiom you can use to emulate it with any GPIO pin
 that can be used as either an input or an output:

- LOW:  gpiod_direction_output(gpio, 0) ... this drives the signal and overrides
-   the pullup.
+ **LOW**: ``gpiod_direction_output(gpio, 0)`` ... this drives the signal and
+ overrides the pullup.

- HIGH: gpiod_direction_input(gpio) ... this turns off the output, so the pullup
-   (or some other device) controls the signal.
+ **HIGH**: ``gpiod_direction_input(gpio)`` ... this turns off the output, so
+ the pullup (or some other device) controls the signal.

 The same logic can be applied to emulate open source signaling, by driving the
 high signal and configuring the GPIO as input for low. This open drain/open
--
2.29.2



Re: [PATCH] sh: check return code of request_irq

2021-01-01 Thread Miguel Ojeda
On Fri, Jan 1, 2021 at 2:50 PM John Paul Adrian Glaubitz
 wrote:
>
> Verified on my SH-7785LCR board. Boots fine.
>
> Tested-by: John Paul Adrian Glaubitz 

Thanks for testing, John!

I think Masahiro was concerned about the error case (I assume you
tested the happy path).

In any case, if no maintainer suggests something else, looks good to
me (and it is no worse than the status quo unless the `pr_err()` can
somehow kill it), so:

Reviewed-by: Miguel Ojeda 

Cheers,
Miguel


[GIT PULL] SCSI fixes for 5.11-rc1

2021-01-01 Thread James Bottomley
This is a load of driver fixes (12 ufs, 1 mpt3sas, 1 cxgbi).  The big
core two fixes are for power management ("block: Do not accept any
requests while suspended" and "block: Fix a race in the runtime power
management code") which finally sorts out the resume problems we've
occasionally been having.  To make the resume fix, there are seven
necessary precursors which effectively renames REQ_PREEMPT to REQ_PM,
so every "special" request in block is automatically a power management
exempt one.  All of the non-PM preempt cases are removed except for the
one in the SCSI Parallel Interface (spi) domain validation which is a
genuine case where we have to run requests at high priority to validate
the bus so this becomes an autopm get/put protected request.

Originally this change was slated for the merge window but a late
arriving build problem with CONFIG_PM=n derailed that.  However, we
still need the change to fix the PM suspend bugs.  You can validate the
REQ_PREEMPT -> REQ_PM nature of the six transformational patches by
inspecting the output of

git diff fa4d0f1992a9..a4d34da715e3

The biggest risk in this code is the spi domain validation change, so
I've tested it extensively on my several parallel systems here without
incident and it's now run for over a week in -next on either side of
the merge window.

Our backport for stable plan is currently to see if we can get the
lion's share of the power management problems with the first pm fix
since the second one depends on the REQ_PM rename.

The patch is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git scsi-fixes

The short changelog is:

Adrian Hunter (4):
  scsi: ufs-pci: Enable UFSHCD_CAP_RPM_AUTOSUSPEND for Intel controllers
  scsi: ufs-pci: Fix recovery from hibernate exit errors for Intel 
controllers
  scsi: ufs-pci: Ensure UFS device is in PowerDown mode for suspend-to-disk 
->poweroff()
  scsi: ufs-pci: Fix restore from S4 for Intel controllers

Alan Stern (1):
  scsi: block: Do not accept any requests while suspended

Bart Van Assche (7):
  scsi: block: Remove RQF_PREEMPT and BLK_MQ_REQ_PREEMPT
  scsi: core: Only process PM requests if rpm_status != RPM_ACTIVE
  scsi: scsi_transport_spi: Set RQF_PM for domain validation commands
  scsi: ide: Mark power management requests with RQF_PM instead of 
RQF_PREEMPT
  scsi: ide: Do not set the RQF_PREEMPT flag for sense requests
  scsi: block: Introduce BLK_MQ_REQ_PM
  scsi: block: Fix a race in the runtime power management code

Bean Huo (2):
  scsi: ufs: Fix wrong print message in dev_err()
  scsi: ufs: Remove unused macro definition POWER_DESC_MAX_SIZE

Dan Carpenter (1):
  scsi: mpt3sas: Signedness bug in _base_get_diag_triggers()

Randall Huang (1):
  scsi: ufs: Clear UAC for RPMB after ufshcd resets

Randy Dunlap (1):
  scsi: cxgb4i: Fix TLS dependency

Stanley Chu (4):
  scsi: ufs: Un-inline ufshcd_vops_device_reset function
  scsi: ufs: Re-enable WriteBooster after device reset
  scsi: ufs-mediatek: Keep VCC always-on for specific devices
  scsi: ufs: Allow regulators being always-on

Zhen Lei (1):
  scsi: ufs-mediatek: Use correct path to fix compile error

And the diffstat:

 block/blk-core.c  | 13 ---
 block/blk-mq-debugfs.c|  1 -
 block/blk-mq.c|  4 +-
 block/blk-pm.c| 15 ---
 block/blk-pm.h| 14 ---
 drivers/ide/ide-atapi.c   |  1 -
 drivers/ide/ide-io.c  |  7 +---
 drivers/ide/ide-pm.c  |  2 +-
 drivers/scsi/cxgbi/cxgb4i/Kconfig |  1 +
 drivers/scsi/mpt3sas/mpt3sas_base.c   |  2 +-
 drivers/scsi/scsi_lib.c   | 27 ++---
 drivers/scsi/scsi_transport_spi.c | 27 +
 drivers/scsi/ufs/ufs-mediatek-trace.h |  2 +-
 drivers/scsi/ufs/ufs-mediatek.c   | 21 ++
 drivers/scsi/ufs/ufs-mediatek.h   |  1 +
 drivers/scsi/ufs/ufs.h|  2 +-
 drivers/scsi/ufs/ufshcd-pci.c | 73 ++-
 drivers/scsi/ufs/ufshcd.c | 45 +
 drivers/scsi/ufs/ufshcd.h | 14 +++
 include/linux/blk-mq.h|  4 +-
 include/linux/blkdev.h| 18 ++---
 21 files changed, 208 insertions(+), 86 deletions(-)

With full diff below

James

---

diff --git a/block/blk-core.c b/block/blk-core.c
index 2db8bda43b6e..2d53e2ff48ff 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -424,11 +425,11 @@ EXPORT_SYMBOL(blk_cleanup_queue);
 /**
  * blk_queue_enter() - try to increase q->q_usage_counter
  * @q: request queue pointer
- * @flags: BLK_MQ_REQ_NOWAIT and/or BLK_MQ_REQ_PREEMPT
+ * @flags: BLK_MQ_REQ_NOWAIT and/or BLK_MQ_REQ_PM
  */
 int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t 

[PATCH] ovl: use a dedicated semaphore for dir upperfile caching

2021-01-01 Thread Icenowy Zheng
The function ovl_dir_real_file() currently uses the semaphore of the
inode to synchronize write to the upperfile cache field.

However, this function will get called by ovl_ioctl_set_flags(), which
utilizes the inode semaphore too. In this case ovl_dir_real_file() will
try to claim a lock that is owned by a function in its call stack, which
won't get released before ovl_dir_real_file() returns.

Define a dedicated semaphore for the upperfile cache, so that the
deadlock won't happen.

Fixes: 61536bed2149 ("ovl: support [S|G]ETFLAGS and FS[S|G]ETXATTR ioctls for 
directories")
Cc: sta...@vger.kernel.org # v5.10
Signed-off-by: Icenowy Zheng 
---
 fs/overlayfs/readdir.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/overlayfs/readdir.c b/fs/overlayfs/readdir.c
index 01620ebae1bd..f10701aabb71 100644
--- a/fs/overlayfs/readdir.c
+++ b/fs/overlayfs/readdir.c
@@ -56,6 +56,7 @@ struct ovl_dir_file {
struct list_head *cursor;
struct file *realfile;
struct file *upperfile;
+   struct semaphore upperfile_sem;
 };
 
 static struct ovl_cache_entry *ovl_cache_entry_from_node(struct rb_node *n)
@@ -883,7 +884,7 @@ struct file *ovl_dir_real_file(const struct file *file, 
bool want_upper)
ovl_path_upper(dentry, );
realfile = ovl_dir_open_realfile(file, );
 
-   inode_lock(inode);
+   down(>upperfile_sem);
if (!od->upperfile) {
if (IS_ERR(realfile)) {
inode_unlock(inode);
@@ -896,7 +897,7 @@ struct file *ovl_dir_real_file(const struct file *file, 
bool want_upper)
fput(realfile);
realfile = od->upperfile;
}
-   inode_unlock(inode);
+   up(>upperfile_sem);
}
}
 
@@ -959,6 +960,7 @@ static int ovl_dir_open(struct inode *inode, struct file 
*file)
od->realfile = realfile;
od->is_real = ovl_dir_is_real(file->f_path.dentry);
od->is_upper = OVL_TYPE_UPPER(type);
+   sema_init(>upperfile_sem, 1);
file->private_data = od;
 
return 0;
-- 
2.28.0


[PATCH] docs: gpio: Fix formatting in description of gpiod_*_array_* functions

2021-01-01 Thread Jonathan Neuschäfer
The gpiod_*_array_* functions take four arguments, not three.
Additionally, the formatting of the "value_bitmap" line results in
misformatted HTML, so fix that.

Signed-off-by: Jonathan Neuschäfer 
---
 Documentation/driver-api/gpio/consumer.rst | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/driver-api/gpio/consumer.rst 
b/Documentation/driver-api/gpio/consumer.rst
index 173e4c7b037d0..22271c342d923 100644
--- a/Documentation/driver-api/gpio/consumer.rst
+++ b/Documentation/driver-api/gpio/consumer.rst
@@ -361,12 +361,13 @@ corresponding chip driver. In that case a significantly 
improved performance
 can be expected. If simultaneous access is not possible the GPIOs will be
 accessed sequentially.

-The functions take three arguments:
+The functions take four arguments:
+
* array_size- the number of array elements
* desc_array- an array of GPIO descriptors
* array_info- optional information obtained from gpiod_get_array()
* value_bitmap  - a bitmap to store the GPIOs' values (get) or
- a bitmap of values to assign to the GPIOs (set)
+  a bitmap of values to assign to the GPIOs (set)

 The descriptor array can be obtained using the gpiod_get_array() function
 or one of its variants. If the group of descriptors returned by that function
--
2.29.2



ERROR: ".is_vmalloc_addr" undefined!

2021-01-01 Thread kernel test robot
Hi Ingo,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f6e1ea19649216156576aeafa784e3b4cee45549
commit: 186525bd6b83efc592672e2d6185e4d7c810d2b4 mm, x86/mm: Untangle address 
space layout definitions from basic pgtable type definitions
date:   1 year, 1 month ago
config: powerpc-randconfig-r012-20201231 (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=186525bd6b83efc592672e2d6185e4d7c810d2b4
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 186525bd6b83efc592672e2d6185e4d7c810d2b4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross 
ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All errors (new ones prefixed by >>):

   ERROR: ".kmem_cache_alloc" [net/nfc/nfc.ko] undefined!
   ERROR: ".__ubsan_handle_type_mismatch_v1" [net/nfc/nfc.ko] undefined!
   ERROR: ".find_next_zero_bit" [net/nfc/nfc.ko] undefined!
   ERROR: ".class_dev_iter_init" [net/nfc/nfc.ko] undefined!
   ERROR: ".nla_strlcpy" [net/nfc/nfc.ko] undefined!
   ERROR: ".skb_free_datagram" [net/nfc/nfc.ko] undefined!
   ERROR: ".add_wait_queue_exclusive" [net/nfc/nfc.ko] undefined!
   ERROR: ".del_timer" [net/nfc/nfc.ko] undefined!
   ERROR: ".printk" [net/nfc/nfc.ko] undefined!
   ERROR: ".sock_init_data" [net/nfc/nfc.ko] undefined!
   ERROR: ".__list_del_entry_valid" [net/nfc/nfc.ko] undefined!
   ERROR: ".class_dev_iter_next" [net/nfc/nfc.ko] undefined!
   ERROR: ".remove_wait_queue" [net/nfc/nfc.ko] undefined!
   ERROR: ".ida_alloc_range" [net/nfc/nfc.ko] undefined!
   ERROR: ".skb_copy_datagram_iter" [net/nfc/nfc.ko] undefined!
   ERROR: ".mutex_unlock" [net/nfc/nfc.ko] undefined!
   ERROR: ".ktime_get_with_offset" [net/nfc/nfc.ko] undefined!
   ERROR: ".sock_alloc_send_skb" [net/nfc/nfc.ko] undefined!
   ERROR: ".skb_recv_datagram" [net/nfc/nfc.ko] undefined!
   ERROR: ".skb_queue_head" [net/nfc/nfc.ko] undefined!
   ERROR: ".cancel_delayed_work_sync" [net/ceph/libceph.ko] undefined!
   ERROR: ".sg_init_table" [net/ceph/libceph.ko] undefined!
   ERROR: ".__put_page" [net/ceph/libceph.ko] undefined!
   ERROR: ".__warn_printk" [net/ceph/libceph.ko] undefined!
   ERROR: ".__ubsan_handle_out_of_bounds" [net/ceph/libceph.ko] undefined!
   ERROR: ".kmalloc_order" [net/ceph/libceph.ko] undefined!
   ERROR: ".set_normalized_timespec64" [net/ceph/libceph.ko] undefined!
   ERROR: ".__ubsan_handle_builtin_unreachable" [net/ceph/libceph.ko] undefined!
   ERROR: ".mod_delayed_work_on" [net/ceph/libceph.ko] undefined!
   ERROR: ".mempool_free" [net/ceph/libceph.ko] undefined!
   ERROR: ".kvmalloc_node" [net/ceph/libceph.ko] undefined!
   ERROR: ".request_key_tag" [net/ceph/libceph.ko] undefined!
   ERROR: ".crypto_skcipher_encrypt" [net/ceph/libceph.ko] undefined!
   ERROR: ".snprintf" [net/ceph/libceph.ko] undefined!
   ERROR: ".__mutex_init" [net/ceph/libceph.ko] undefined!
   ERROR: ".print_hex_dump" [net/ceph/libceph.ko] undefined!
   ERROR: ".cancel_delayed_work" [net/ceph/libceph.ko] undefined!
   ERROR: ".strlen" [net/ceph/libceph.ko] undefined!
   ERROR: ".iov_iter_kvec" [net/ceph/libceph.ko] undefined!
   ERROR: ".mempool_create" [net/ceph/libceph.ko] undefined!
   ERROR: ".down_write" [net/ceph/libceph.ko] undefined!
   ERROR: ".__ubsan_handle_divrem_overflow" [net/ceph/libceph.ko] undefined!
   ERROR: ".destroy_workqueue" [net/ceph/libceph.ko] undefined!
   ERROR: ".init_timer_key" [net/ceph/libceph.ko] undefined!
   ERROR: ".key_put" [net/ceph/libceph.ko] undefined!
   ERROR: ".wait_for_random_bytes" [net/ceph/libceph.ko] undefined!
   ERROR: ".sscanf" [net/ceph/libceph.ko] undefined!
   ERROR: ".schedule_timeout" [net/ceph/libceph.ko] undefined!
   ERROR: ".__init_rwsem" [net/ceph/libceph.ko] undefined!
   ERROR: ".__alloc_pages_nodemask" [net/ceph/libceph.ko] undefined!
   ERROR: ".flush_dcache_page" [net/ceph/libceph.ko] undefined!
   ERROR: ".__ubsan_handle_shift_out_of_bounds" [net/ceph/libceph.ko] undefined!
   ERROR: ".sock_recvmsg" [net/ceph/libceph.ko] undefined!
   ERROR: ".crc32c" [net/ceph/libceph.ko] undefined!
   ERROR: ".sg_alloc_table" [net/ceph/libceph.ko] undefined!
   ERROR: ".memcmp" [net/ceph/libceph.ko] undefined!
   ERROR: ".refcount_warn_saturate" [net/ceph/libceph.ko] undefined!
   ERROR: ".kmem_cache_free" [net/ceph/libceph.ko] undefined!
   ERROR: ".flush_workqueue" [net/ceph/libceph.ko] undefined!
   ERROR: ".in6_pton" [net/ceph/libceph.ko] undefined!
   ERROR: ".wait_for_completion_killable_timeout" 

[PATCH] drm/vkms: Decouple config data for configfs

2021-01-01 Thread Sumera Priyadarsini
Currently, data for the device instance is held by vkms_device.
Add a separate type, vkms_config to contain configuration details
for the device and various modes to be later used by configfs.
This config data stays constant once the device is created.

Accordingly, add vkms_create and vkms_destroy to initialize/destroy
device through configfs. Currently, they are being called from vkms_init
and vkms_exit, but will be evoked from configfs later on. When configfs
is added, device configuration- enabling/disabling features will
be tracked by configfs and only vkms device lifetime will be kept track of
by vkms_init and vkms_exit functions.

Modify usage of enable_cursor feature to reflect the changes in
relevant files.

Signed-off-by: Sumera Priyadarsini 
---
 drivers/gpu/drm/vkms/vkms_drv.c| 40 --
 drivers/gpu/drm/vkms/vkms_drv.h| 11 +---
 drivers/gpu/drm/vkms/vkms_output.c |  4 +--
 3 files changed, 42 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index aef29393b811..6b33975a5cb2 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -34,9 +34,9 @@
 #define DRIVER_MAJOR   1
 #define DRIVER_MINOR   0
 
-static struct vkms_device *vkms_device;
+static struct vkms_config *default_config;
 
-bool enable_cursor = true;
+static bool enable_cursor = true;
 module_param_named(enable_cursor, enable_cursor, bool, 0444);
 MODULE_PARM_DESC(enable_cursor, "Enable/Disable cursor support");
 
@@ -122,10 +122,11 @@ static int vkms_modeset_init(struct vkms_device *vkmsdev)
return vkms_output_init(vkmsdev, 0);
 }
 
-static int __init vkms_init(void)
+static int vkms_create(struct vkms_config *config)
 {
int ret;
struct platform_device *pdev;
+   struct vkms_device *vkms_device;
 
pdev = platform_device_register_simple(DRIVER_NAME, -1, NULL, 0);
if (IS_ERR(pdev))
@@ -143,6 +144,8 @@ static int __init vkms_init(void)
goto out_devres;
}
vkms_device->platform = pdev;
+   vkms_device->config = config;
+   config->dev = vkms_device;
 
ret = dma_coerce_mask_and_coherent(vkms_device->drm.dev,
   DMA_BIT_MASK(64));
@@ -179,21 +182,42 @@ static int __init vkms_init(void)
return ret;
 }
 
-static void __exit vkms_exit(void)
+static int __init vkms_init(void)
+{
+   struct vkms_config *config = kmalloc(sizeof(*config), GFP_KERNEL);
+
+   default_config = config;
+
+   config->cursor = enable_cursor;
+
+   return vkms_create(config);
+}
+
+static void vkms_destroy(struct vkms_config *config)
 {
struct platform_device *pdev;
 
-   if (!vkms_device) {
+   if (!config->dev) {
DRM_INFO("vkms_device is NULL.\n");
return;
}
 
-   pdev = vkms_device->platform;
+   pdev = config->dev->platform;
 
-   drm_dev_unregister(_device->drm);
-   drm_atomic_helper_shutdown(_device->drm);
+   drm_dev_unregister(>dev->drm);
+   drm_atomic_helper_shutdown(>dev->drm);
devres_release_group(>dev, NULL);
platform_device_unregister(pdev);
+
+   config->dev = NULL;
+}
+
+static void __exit vkms_exit(void)
+{
+   if (default_config->dev)
+   vkms_destroy(default_config);
+
+   kfree(default_config);
 }
 
 module_init(vkms_init);
diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 5ed91ff08cb3..2fa0c52f1dd8 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -19,8 +19,6 @@
 #define XRES_MAX  8192
 #define YRES_MAX  8192
 
-extern bool enable_cursor;
-
 struct vkms_composer {
struct drm_framebuffer fb;
struct drm_rect src, dst;
@@ -82,10 +80,17 @@ struct vkms_output {
spinlock_t composer_lock;
 };
 
+struct vkms_device;
+struct vkms_config {
+   bool cursor;
+   /* only set when instantiated */
+   struct vkms_device *dev;
+};
 struct vkms_device {
struct drm_device drm;
struct platform_device *platform;
struct vkms_output output;
+   const struct vkms_config *config;
 };
 
 #define drm_crtc_to_vkms_output(target) \
@@ -123,4 +128,4 @@ void vkms_set_composer(struct vkms_output *out, bool 
enabled);
 /* Writeback */
 int vkms_enable_writeback_connector(struct vkms_device *vkmsdev);
 
-#endif /* _VKMS_DRV_H_ */
+#endif /* _VKMS_DRV_H_ */
\ No newline at end of file
diff --git a/drivers/gpu/drm/vkms/vkms_output.c 
b/drivers/gpu/drm/vkms/vkms_output.c
index 4a1848b0318f..8f3ffb28b9d1 100644
--- a/drivers/gpu/drm/vkms/vkms_output.c
+++ b/drivers/gpu/drm/vkms/vkms_output.c
@@ -46,7 +46,7 @@ int vkms_output_init(struct vkms_device *vkmsdev, int index)
if (IS_ERR(primary))
return PTR_ERR(primary);
 
-   if (enable_cursor) {
+   if (vkmsdev->config->cursor) {
cursor = vkms_plane_init(vkmsdev, 

RE: [PATCH 1/2] dt-bindings: memory: Renesas RPC-IF: Add support for RZ/G2 Series

2021-01-01 Thread Biju Das
Hi Adam,

Thanks for the patch.

> -Original Message-
> From: Adam Ford 
> Sent: 01 January 2021 11:39
> To: linux-renesas-...@vger.kernel.org
> Cc: af...@beaconembedded.com; Adam Ford ; Krzysztof
> Kozlowski ; Rob Herring ; Geert
> Uytterhoeven ; Magnus Damm
> ; Sergei Shtylyov ;
> linux-kernel@vger.kernel.org; devicet...@vger.kernel.org
> Subject: [PATCH 1/2] dt-bindings: memory: Renesas RPC-IF: Add support for
> RZ/G2 Series
> 
> The RZ/G2 Series has the RPC-IF interface.
> Update bindings to support: r8a774a1, r8a774b1, r8a774c0, and r8a774e1
> 
> Signed-off-by: Adam Ford 
> ---
>  .../bindings/memory-controllers/renesas,rpc-if.yaml   | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/memory-
> controllers/renesas,rpc-if.yaml
> b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-if.yaml
> index 6d6ba608fd22..050c66af8c2c 100644
> --- a/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-
> if.yaml
> +++ b/Documentation/devicetree/bindings/memory-controllers/renesas,rpc-
> if.yaml
> @@ -26,6 +26,10 @@ properties:
>compatible:
>  items:
>- enum:
> +  - renesas,r8a774a1-rpc-if   # RZ/G2M
> +  - renesas,r8a774b1-rpc-if   # RZ/G2N
> +  - renesas,r8a774c0-rpc-if   # RZ/G2E
> +  - renesas,r8a774e1-rpc-if   # RZ/G2H
>- renesas,r8a77970-rpc-if   # R-Car V3M
>- renesas,r8a77980-rpc-if   # R-Car V3H
>- renesas,r8a77995-rpc-if   # R-Car D3

May be we need to update the below description as well to cover RZ/G2 device??

- const: renesas,rcar-gen3-rpc-if   # a generic R-Car gen3 device

Cheers,
Biju


> --
> 2.25.1



Re: Linux 5.11-rc1

2021-01-01 Thread Sedat Dilek
On Fri, Jan 1, 2021 at 5:14 PM Pavel Machek  wrote:
>
> Hi!
> > >
> > > > $ dpkg -L kmod | grep bin | grep depmod
> > > > /sbin/depmod
> > > >
> > > > $ which depmod
> > > > [ empty ]
> > > >
> > > > $ echo $PATH
> > > > /opt/proxychains-ng/bin:/home/dileks/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> >
> > Ok, I think this is a broken setup that has a separate /sbin but does
> > not have it in the PATH.
>
> That's how it is supposed to work, AFAICT. It is so on Debian here,
> for example.
>
> /sbin is for management commands, why would I have it in PATH when
> running as normal user?
>

I am here on Debian/testing AMD64 and waiting for feedback [2].

For now I have applied the diff from [1].

- Sedat -

[1] https://marc.info/?l=linux-kbuild=160919738006768=2
[2] https://marc.info/?l=linux-kernel=160919729606750=2


RE: [RFC please help] membarrier: Rewrite sync_core_before_usermode()

2021-01-01 Thread David Laight
From: Andy Lutomirski
> Sent: 29 December 2020 00:36
...
> I mean that the mapping from the name "sync_core" to its semantics is
> x86 only.  The string "sync_core" appears in the kernel only in
> arch/x86, membarrier code, membarrier docs, and a single SGI driver
> that is x86-only.  Sure, the idea of serializing things is fairly
> generic, but exactly what operations serialize what, when things need
> serialization, etc is quite architecture specific.
> 
> Heck, on 486 you serialize the instruction stream with JMP.

Did the 486 even have a memory cache?
Never mind separate I caches.
Without branch prediction or an I$ a jmp is enough.
No idea how the dual 486 box we had actually behaved.

For non-SMP the x86 cpus tend to still be compatible with
the original 8086 - so are pretty much fully coherent.
ISTR the memory writes will invalidate I$ lines.

But there was some hardware compatibility that meant a load
of Pentium-75 systems were 'scavenged' from development for
a customer - we got faster P-266 boxes as replacements.

OTOH we never did work out how to do the required 'barrier'
when switching a Via C3 to and from 16-bit mode.
Sometimes it worked, other times the cpu went AWOL.
Best guess was that it sometimes executed pre-decoded
instructions for the wrong mode when returning from the
function call that flipped modes.

Then there is the P-Pro era Intel doc that says that IOR/IOW
aren't sequenced wrt memory accesses.
Fortunately all x86 processors have sequenced them.
Which is what the current docs say.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)


[PATCH] dt-bindings: mips: lantiq: Document Lantiq Xway CGU bindings

2021-01-01 Thread Aleksander Jan Bajkowski
Document the Lantiq Xway SoC series Clock Generation Unit (CGU) bindings.

Signed-off-by: Aleksander Jan Bajkowski 
---
 .../bindings/mips/lantiq/lantiq,cgu.yaml  | 32 +++
 1 file changed, 32 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/mips/lantiq/lantiq,cgu.yaml

diff --git a/Documentation/devicetree/bindings/mips/lantiq/lantiq,cgu.yaml 
b/Documentation/devicetree/bindings/mips/lantiq/lantiq,cgu.yaml
new file mode 100644
index ..d5805725befb
--- /dev/null
+++ b/Documentation/devicetree/bindings/mips/lantiq/lantiq,cgu.yaml
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mips/lantiq/lantiq,cgu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Lantiq Xway SoC series Clock Generation Unit (CGU)
+
+maintainers:
+  - John Crispin 
+
+properties:
+  compatible:
+items:
+  - enum:
+  - lantiq,cgu-xway
+
+  reg:
+maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+cgu@103000 {
+compatible = "lantiq,cgu-xway";
+reg = <0x103000 0x1000>;
+};
-- 
2.20.1



Re: [PATCH v2 01/10] vfs: move cap_convert_nscap() call into vfs_setxattr()

2021-01-01 Thread Eric W. Biederman
Miklos Szeredi  writes:

> cap_convert_nscap() does permission checking as well as conversion of the
> xattr value conditionally based on fs's user-ns.
>
> This is needed by overlayfs and probably other layered fs (ecryptfs) and is
> what vfs_foo() is supposed to do anyway.

Well crap.

I just noticed this and it turns out this change is wrong.

The problem is that it reads the rootid from the v3 fscap, using
current_user_ns() and then writes it using the sb->s_user_ns.

So any time the stacked filesystems sb->s_user_ns do not match or
current_user_ns does not match sb->s_user_ns this could be a problem.

In a stacked filesystem a second pass through vfs_setxattr will result
in the rootid being translated a second time (with potentially the wrong
namespaces).  I think because of the security checks a we won't write
something we shouldn't be able to write to the filesystem.  Still we
will be writing the wrong v3 fscap which can go quite badly.

This doesn't look terribly difficult to fix.

Probably convert this into a fs independent form using uids in
init_user_ns at input and have cap_convert_nscap convert the v3 fscap
into the filesystem dependent form.  With some way for stackable
filesystems to just skip converting it from the filesystem independent
format.

Uids in xattrs that are expected to go directly to disk, but aren't
always suitable for going directly to disk are tricky.

Eric

> Signed-off-by: Miklos Szeredi 
> ---
>  fs/xattr.c | 17 +++--
>  include/linux/capability.h |  2 +-
>  security/commoncap.c   |  3 +--
>  3 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/fs/xattr.c b/fs/xattr.c
> index cd7a563e8bcd..fd57153b1f61 100644
> --- a/fs/xattr.c
> +++ b/fs/xattr.c
> @@ -276,8 +276,16 @@ vfs_setxattr(struct dentry *dentry, const char *name, 
> const void *value,
>  {
>   struct inode *inode = dentry->d_inode;
>   struct inode *delegated_inode = NULL;
> + const void  *orig_value = value;
>   int error;
>  
> + if (size && strcmp(name, XATTR_NAME_CAPS) == 0) {
> + error = cap_convert_nscap(dentry, , size);
> + if (error < 0)
> + return error;
> + size = error;
> + }
> +
>  retry_deleg:
>   inode_lock(inode);
>   error = __vfs_setxattr_locked(dentry, name, value, size, flags,
> @@ -289,6 +297,9 @@ vfs_setxattr(struct dentry *dentry, const char *name, 
> const void *value,
>   if (!error)
>   goto retry_deleg;
>   }
> + if (value != orig_value)
> + kfree(value);
> +
>   return error;
>  }
>  EXPORT_SYMBOL_GPL(vfs_setxattr);
> @@ -537,12 +548,6 @@ setxattr(struct dentry *d, const char __user *name, 
> const void __user *value,
>   if ((strcmp(kname, XATTR_NAME_POSIX_ACL_ACCESS) == 0) ||
>   (strcmp(kname, XATTR_NAME_POSIX_ACL_DEFAULT) == 0))
>   posix_acl_fix_xattr_from_user(kvalue, size);
> - else if (strcmp(kname, XATTR_NAME_CAPS) == 0) {
> - error = cap_convert_nscap(d, , size);
> - if (error < 0)
> - goto out;
> - size = error;
> - }
>   }
>  
>   error = vfs_setxattr(d, kname, kvalue, size, flags);
> diff --git a/include/linux/capability.h b/include/linux/capability.h
> index 1e7fe311cabe..b2f698915c0f 100644
> --- a/include/linux/capability.h
> +++ b/include/linux/capability.h
> @@ -270,6 +270,6 @@ static inline bool checkpoint_restore_ns_capable(struct 
> user_namespace *ns)
>  /* audit system wants to get cap info from files as well */
>  extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct 
> cpu_vfs_cap_data *cpu_caps);
>  
> -extern int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t 
> size);
> +extern int cap_convert_nscap(struct dentry *dentry, const void **ivalue, 
> size_t size);
>  
>  #endif /* !_LINUX_CAPABILITY_H */
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 59bf3c1674c8..baccd871 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -473,7 +473,7 @@ static bool validheader(size_t size, const struct 
> vfs_cap_data *cap)
>   *
>   * If all is ok, we return the new size, on error return < 0.
>   */
> -int cap_convert_nscap(struct dentry *dentry, void **ivalue, size_t size)
> +int cap_convert_nscap(struct dentry *dentry, const void **ivalue, size_t 
> size)
>  {
>   struct vfs_ns_cap_data *nscap;
>   uid_t nsrootid;
> @@ -516,7 +516,6 @@ int cap_convert_nscap(struct dentry *dentry, void 
> **ivalue, size_t size)
>   nscap->magic_etc = cpu_to_le32(nsmagic);
>   memcpy(>data, >data, sizeof(__le32) * 2 * VFS_CAP_U32);
>  
> - kvfree(*ivalue);
>   *ivalue = nscap;
>   return newsize;
>  }


Re: [PATCH] platform/x86: ideapad-laptop: Add has_touchpad_switch

2021-01-01 Thread Barnabás Pőcze
Hi


2021. január 1., péntek 17:08 keltezéssel, Jiaxun Yang írta:

> [...]
> > > @@ -1006,6 +1018,10 @@ static int ideapad_acpi_add(struct platform_device 
> > > *pdev)
> > >   if (!priv->has_hw_rfkill_switch)
> > >   write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);
> > >
> > > + /* The same for Touchpad */
> > > + if (!priv->has_touchpad_switch)
> > > + write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);
> > > +
> >
> > Shouldn't it be the other way around: `if (priv->has_touchpad_switch)`?
>
> It is to prevent accidentally disable touchpad on machines that do have EC 
> switch,
> so it's intentional.
> [...]

Sorry, but the explanation not fully clear to me. The commit message seems to
indicate that some models "do not use EC to switch touchpad", and I take that
means that reading from VPCCMD_R_TOUCHPAD will not reflect the actual state of 
the
touchpad and writing to VPCCMD_W_TOUCHPAD will not change the state of the 
touchpad.

But then why do you still write to VPCCMD_W_TOUCHPAD on devices where supposedly
this does not have any effect (at least not the desired one)? And the part of 
the
code I made my comment about only runs on machines on which the touchpad 
supposedly
cannot be controlled by the EC. What am I missing?

And there is the other problem: on some machines, this patch removes working
functionality.


Regards,
Barnabás Pőcze


RE: [PATCH] gpio: Kconfig: Update help description for GPIO_RCAR

2021-01-01 Thread Biju Das
Hi Prabhakar,

> -Original Message-
> From: Lad Prabhakar 
> Sent: 31 December 2020 15:39
> To: Linus Walleij ; Bartosz Golaszewski
> ; Geert Uytterhoeven 
> Cc: linux-g...@vger.kernel.org; linux-kernel@vger.kernel.org; linux-
> renesas-...@vger.kernel.org; Prabhakar ;
> Prabhakar Mahadev Lad 
> Subject: [PATCH] gpio: Kconfig: Update help description for GPIO_RCAR
> 
> The gpio-rcar driver supports R-Car Gen{1,2,3} and RZ/G{1,2} SoC's, update
> the description to reflect this.

Not sure we need to make this generic by  dropping {1,2,3}/{1,2} and use R-Car 
and RZ/G SoC's instead ???

Regards,
Biju

> 
> Signed-off-by: Lad Prabhakar 
> ---
>  drivers/gpio/Kconfig | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index
> c70f46e80a3b..47e545d71df1 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -486,11 +486,12 @@ config GPIO_PXA
> Say yes here to support the PXA GPIO device
> 
>  config GPIO_RCAR
> - tristate "Renesas R-Car GPIO"
> + tristate "Renesas R-Car Gen{1,2,3} and RZ/G{1,2} GPIO support"
>   depends on ARCH_RENESAS || COMPILE_TEST
>   select GPIOLIB_IRQCHIP
>   help
> -   Say yes here to support GPIO on Renesas R-Car SoCs.
> +   Say yes here to support GPIO on Renesas R-Car Gen{1,2,3} and
> +   RZ/G{1,2} SoCs.
> 
>  config GPIO_RDA
>   bool "RDA Micro GPIO controller support"
> --
> 2.17.1



RE: [PATCH] can: rcar: Update help description for CAN_RCAR config

2021-01-01 Thread Biju Das
Hi Prabhakar,

Thanks for the patch.

> -Original Message-
> From: Lad Prabhakar 
> Sent: 31 December 2020 16:00
> To: Geert Uytterhoeven ; Wolfgang Grandegger
> ; Marc Kleine-Budde ; David S.
> Miller ; Jakub Kicinski ; Masahiro
> Yamada 
> Cc: linux-...@vger.kernel.org; net...@vger.kernel.org; linux-
> ker...@vger.kernel.org; linux-renesas-...@vger.kernel.org; Prabhakar
> ; Prabhakar Mahadev Lad  lad...@bp.renesas.com>
> Subject: [PATCH] can: rcar: Update help description for CAN_RCAR config
> 
> The rcar_can driver supports R-Car Gen{1,2,3} and RZ/G{1,2} SoC's, update
> the description to reflect this.

Not sure we need to make it generic like dropping {1,2,3}/{1,2} and  instead 
use R-Car and RZ/G SoC's??

Cheers,
Biju


> 
> Signed-off-by: Lad Prabhakar 
> ---
>  drivers/net/can/rcar/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/can/rcar/Kconfig b/drivers/net/can/rcar/Kconfig
> index 8d36101b78e3..6bb0e7c052ad 100644
> --- a/drivers/net/can/rcar/Kconfig
> +++ b/drivers/net/can/rcar/Kconfig
> @@ -1,10 +1,10 @@
>  # SPDX-License-Identifier: GPL-2.0
>  config CAN_RCAR
> - tristate "Renesas R-Car CAN controller"
> + tristate "Renesas R-Car Gen{1,2,3} and RZ/G{1,2} CAN controller"
>   depends on ARCH_RENESAS || ARM
>   help
> Say Y here if you want to use CAN controller found on Renesas R-
> Car
> -   SoCs.
> +   Gen{1,2,3} and RZ/G{1,2} SoCs.
> 
> To compile this driver as a module, choose M here: the module will
> be called rcar_can.
> --
> 2.17.1



[PATCH 19/31] drm/panfrost: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code, and remove opp_table
from panfrost_devfreq.

Signed-off-by: Yangtao Li 
---
 drivers/gpu/drm/panfrost/panfrost_devfreq.c | 34 ++---
 drivers/gpu/drm/panfrost/panfrost_devfreq.h |  1 -
 2 files changed, 10 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.c 
b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
index f44d28fad085..c42fa9eb43b1 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.c
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.c
@@ -92,25 +92,26 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
struct thermal_cooling_device *cooling;
struct panfrost_devfreq *pfdevfreq = >pfdevfreq;
 
-   opp_table = dev_pm_opp_set_regulators(dev, pfdev->comp->supply_names,
+   opp_table = devm_pm_opp_set_regulators(dev, pfdev->comp->supply_names,
  pfdev->comp->num_supplies);
if (IS_ERR(opp_table)) {
ret = PTR_ERR(opp_table);
/* Continue if the optional regulator is missing */
if (ret != -ENODEV) {
DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n");
-   goto err_fini;
+   return ret;
}
-   } else {
-   pfdevfreq->regulators_opp_table = opp_table;
}
 
-   ret = dev_pm_opp_of_add_table(dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (ret) {
+   if (!IS_ERR(opp_table))
+   devm_pm_opp_put_regulators(dev, opp_table);
+
/* Optional, continue without devfreq */
if (ret == -ENODEV)
ret = 0;
-   goto err_fini;
+   return ret;
}
pfdevfreq->opp_of_table_added = true;
 
@@ -121,10 +122,8 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
cur_freq = clk_get_rate(pfdev->clock);
 
opp = devfreq_recommended_opp(dev, _freq, 0);
-   if (IS_ERR(opp)) {
-   ret = PTR_ERR(opp);
-   goto err_fini;
-   }
+   if (IS_ERR(opp))
+   return PTR_ERR(opp);
 
panfrost_devfreq_profile.initial_freq = cur_freq;
dev_pm_opp_put(opp);
@@ -133,8 +132,7 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
  DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL);
if (IS_ERR(devfreq)) {
DRM_DEV_ERROR(dev, "Couldn't initialize GPU devfreq\n");
-   ret = PTR_ERR(devfreq);
-   goto err_fini;
+   return PTR_ERR(devfreq);
}
pfdevfreq->devfreq = devfreq;
 
@@ -145,10 +143,6 @@ int panfrost_devfreq_init(struct panfrost_device *pfdev)
pfdevfreq->cooling = cooling;
 
return 0;
-
-err_fini:
-   panfrost_devfreq_fini(pfdev);
-   return ret;
 }
 
 void panfrost_devfreq_fini(struct panfrost_device *pfdev)
@@ -159,14 +153,6 @@ void panfrost_devfreq_fini(struct panfrost_device *pfdev)
devfreq_cooling_unregister(pfdevfreq->cooling);
pfdevfreq->cooling = NULL;
}
-
-   if (pfdevfreq->opp_of_table_added) {
-   dev_pm_opp_of_remove_table(>pdev->dev);
-   pfdevfreq->opp_of_table_added = false;
-   }
-
-   dev_pm_opp_put_regulators(pfdevfreq->regulators_opp_table);
-   pfdevfreq->regulators_opp_table = NULL;
 }
 
 void panfrost_devfreq_resume(struct panfrost_device *pfdev)
diff --git a/drivers/gpu/drm/panfrost/panfrost_devfreq.h 
b/drivers/gpu/drm/panfrost/panfrost_devfreq.h
index db6ea48e21f9..a51854cc8c06 100644
--- a/drivers/gpu/drm/panfrost/panfrost_devfreq.h
+++ b/drivers/gpu/drm/panfrost/panfrost_devfreq.h
@@ -15,7 +15,6 @@ struct panfrost_device;
 
 struct panfrost_devfreq {
struct devfreq *devfreq;
-   struct opp_table *regulators_opp_table;
struct thermal_cooling_device *cooling;
bool opp_of_table_added;
 
-- 
2.25.1



[PATCH 24/31] memory: tegra20: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code.

Signed-off-by: Yangtao Li 
---
 drivers/memory/tegra/tegra20-emc.c | 29 +
 1 file changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/memory/tegra/tegra20-emc.c 
b/drivers/memory/tegra/tegra20-emc.c
index 686aaf477d8a..223d9d97eb8f 100644
--- a/drivers/memory/tegra/tegra20-emc.c
+++ b/drivers/memory/tegra/tegra20-emc.c
@@ -911,31 +911,31 @@ static int tegra_emc_interconnect_init(struct tegra_emc 
*emc)
 static int tegra_emc_opp_table_init(struct tegra_emc *emc)
 {
u32 hw_version = BIT(tegra_sku_info.soc_process_id);
-   struct opp_table *clk_opp_table, *hw_opp_table;
+   struct opp_table *opp_table;
int err;
 
-   clk_opp_table = dev_pm_opp_set_clkname(emc->dev, NULL);
-   err = PTR_ERR_OR_ZERO(clk_opp_table);
+   opp_table = devm_pm_opp_set_clkname(emc->dev, NULL);
+   err = PTR_ERR_OR_ZERO(opp_table);
if (err) {
dev_err(emc->dev, "failed to set OPP clk: %d\n", err);
return err;
}
 
-   hw_opp_table = dev_pm_opp_set_supported_hw(emc->dev, _version, 1);
-   err = PTR_ERR_OR_ZERO(hw_opp_table);
+   opp_table = devm_pm_opp_set_supported_hw(emc->dev, _version, 1);
+   err = PTR_ERR_OR_ZERO(opp_table);
if (err) {
dev_err(emc->dev, "failed to set OPP supported HW: %d\n", err);
-   goto put_clk_table;
+   return err;
}
 
-   err = dev_pm_opp_of_add_table(emc->dev);
+   err = devm_pm_opp_of_add_table(emc->dev);
if (err) {
if (err == -ENODEV)
dev_err(emc->dev, "OPP table not found, please update 
your device tree\n");
else
dev_err(emc->dev, "failed to add OPP table: %d\n", err);
 
-   goto put_hw_table;
+   return err;
}
 
dev_info(emc->dev, "OPP HW ver. 0x%x, current clock rate %lu MHz\n",
@@ -943,19 +943,8 @@ static int tegra_emc_opp_table_init(struct tegra_emc *emc)
 
/* first dummy rate-set initializes voltage state */
err = dev_pm_opp_set_rate(emc->dev, clk_get_rate(emc->clk));
-   if (err) {
+   if (err)
dev_err(emc->dev, "failed to initialize OPP clock: %d\n", err);
-   goto remove_table;
-   }
-
-   return 0;
-
-remove_table:
-   dev_pm_opp_of_remove_table(emc->dev);
-put_hw_table:
-   dev_pm_opp_put_supported_hw(hw_opp_table);
-put_clk_table:
-   dev_pm_opp_put_clkname(clk_opp_table);
 
return err;
 }
-- 
2.25.1



[PATCH 23/31] memory: samsung: exynos5422-dmc: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code.

Signed-off-by: Yangtao Li 
---
 drivers/memory/samsung/exynos5422-dmc.c | 21 +
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c 
b/drivers/memory/samsung/exynos5422-dmc.c
index 62a83633f837..cab9fd74322b 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -343,7 +343,7 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc,
int idx;
unsigned long freq;
 
-   ret = dev_pm_opp_of_add_table(dmc->dev);
+   ret = devm_pm_opp_of_add_table(dmc->dev);
if (ret < 0) {
dev_err(dmc->dev, "Failed to get OPP table\n");
return ret;
@@ -353,20 +353,16 @@ static int exynos5_init_freq_table(struct exynos5_dmc 
*dmc,
 
dmc->opp = devm_kmalloc_array(dmc->dev, dmc->opp_count,
  sizeof(struct dmc_opp_table), GFP_KERNEL);
-   if (!dmc->opp) {
-   ret = -ENOMEM;
-   goto err_opp;
-   }
+   if (!dmc->opp)
+   return -ENOMEM;
 
idx = dmc->opp_count - 1;
for (i = 0, freq = ULONG_MAX; i < dmc->opp_count; i++, freq--) {
struct dev_pm_opp *opp;
 
opp = dev_pm_opp_find_freq_floor(dmc->dev, );
-   if (IS_ERR(opp)) {
-   ret = PTR_ERR(opp);
-   goto err_opp;
-   }
+   if (IS_ERR(opp))
+   return PTR_ERR(opp);
 
dmc->opp[idx - i].freq_hz = freq;
dmc->opp[idx - i].volt_uv = dev_pm_opp_get_voltage(opp);
@@ -375,11 +371,6 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc,
}
 
return 0;
-
-err_opp:
-   dev_pm_opp_of_remove_table(dmc->dev);
-
-   return ret;
 }
 
 /**
@@ -1571,8 +1562,6 @@ static int exynos5_dmc_remove(struct platform_device 
*pdev)
clk_disable_unprepare(dmc->mout_bpll);
clk_disable_unprepare(dmc->fout_bpll);
 
-   dev_pm_opp_remove_table(dmc->dev);
-
return 0;
 }
 
-- 
2.25.1



[PATCH 21/31] media: venus: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code.

Signed-off-by: Yangtao Li 
---
 .../media/platform/qcom/venus/pm_helpers.c| 21 ---
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c 
b/drivers/media/platform/qcom/venus/pm_helpers.c
index 59cbd6c39450..9684c25558ef 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -871,31 +871,23 @@ static int core_get_v4(struct device *dev)
if (legacy_binding)
return 0;
 
-   core->opp_table = dev_pm_opp_set_clkname(dev, "core");
+   core->opp_table = devm_pm_opp_set_clkname(dev, "core");
if (IS_ERR(core->opp_table))
return PTR_ERR(core->opp_table);
 
if (core->res->opp_pmdomain) {
-   ret = dev_pm_opp_of_add_table(dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (!ret) {
core->has_opp_table = true;
} else if (ret != -ENODEV) {
dev_err(dev, "invalid OPP table in device tree\n");
return ret;
} else {
-   dev_pm_opp_put_clkname(core->opp_table);
+   devm_pm_opp_put_clkname(dev, core->opp_table);
}
}
 
-   ret = vcodec_domains_get(dev);
-   if (ret) {
-   if (core->has_opp_table)
-   dev_pm_opp_of_remove_table(dev);
-   dev_pm_opp_put_clkname(core->opp_table);
-   return ret;
-   }
-
-   return 0;
+   return vcodec_domains_get(dev);
 }
 
 static void core_put_v4(struct device *dev)
@@ -906,11 +898,6 @@ static void core_put_v4(struct device *dev)
return;
 
vcodec_domains_put(dev);
-
-   if (core->has_opp_table)
-   dev_pm_opp_of_remove_table(dev);
-   dev_pm_opp_put_clkname(core->opp_table);
-
 }
 
 static int core_power_v4(struct device *dev, int on)
-- 
2.25.1



[PATCH 22/31] memory: samsung: exynos5422-dmc: fix return error in exynos5_init_freq_table

2021-01-01 Thread Yangtao Li
We can't always return -EINVAL, let's fix it.

Signed-off-by: Yangtao Li 
---
 drivers/memory/samsung/exynos5422-dmc.c | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/samsung/exynos5422-dmc.c 
b/drivers/memory/samsung/exynos5422-dmc.c
index c5ee4121a4d2..62a83633f837 100644
--- a/drivers/memory/samsung/exynos5422-dmc.c
+++ b/drivers/memory/samsung/exynos5422-dmc.c
@@ -353,16 +353,20 @@ static int exynos5_init_freq_table(struct exynos5_dmc 
*dmc,
 
dmc->opp = devm_kmalloc_array(dmc->dev, dmc->opp_count,
  sizeof(struct dmc_opp_table), GFP_KERNEL);
-   if (!dmc->opp)
+   if (!dmc->opp) {
+   ret = -ENOMEM;
goto err_opp;
+   }
 
idx = dmc->opp_count - 1;
for (i = 0, freq = ULONG_MAX; i < dmc->opp_count; i++, freq--) {
struct dev_pm_opp *opp;
 
opp = dev_pm_opp_find_freq_floor(dmc->dev, );
-   if (IS_ERR(opp))
+   if (IS_ERR(opp)) {
+   ret = PTR_ERR(opp);
goto err_opp;
+   }
 
dmc->opp[idx - i].freq_hz = freq;
dmc->opp[idx - i].volt_uv = dev_pm_opp_get_voltage(opp);
@@ -375,7 +379,7 @@ static int exynos5_init_freq_table(struct exynos5_dmc *dmc,
 err_opp:
dev_pm_opp_of_remove_table(dmc->dev);
 
-   return -EINVAL;
+   return ret;
 }
 
 /**
-- 
2.25.1



[PATCH 20/31] media: venus: fix error check in core_get_v4()

2021-01-01 Thread Yangtao Li
Don't call dev_pm_opp_put_clkname() when got invalid OPP table
in device tree, since we do this in core_put_v4().

Signed-off-by: Yangtao Li 
---
 drivers/media/platform/qcom/venus/pm_helpers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c 
b/drivers/media/platform/qcom/venus/pm_helpers.c
index a3850261d697..59cbd6c39450 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -881,8 +881,9 @@ static int core_get_v4(struct device *dev)
core->has_opp_table = true;
} else if (ret != -ENODEV) {
dev_err(dev, "invalid OPP table in device tree\n");
-   dev_pm_opp_put_clkname(core->opp_table);
return ret;
+   } else {
+   dev_pm_opp_put_clkname(core->opp_table);
}
}
 
-- 
2.25.1



drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set but not used

2021-01-01 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f6e1ea19649216156576aeafa784e3b4cee45549
commit: 6f007c6486d69967ac1d9e67df9ae9c77d49f1cc gve: Add support for raw 
addressing in the tx path
date:   3 weeks ago
config: i386-randconfig-r034-20210101 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
# 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=6f007c6486d69967ac1d9e67df9ae9c77d49f1cc
git remote add linus 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 6f007c6486d69967ac1d9e67df9ae9c77d49f1cc
# save the attached .config to linux build tree
make W=1 ARCH=i386 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot 

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/google/gve/gve_tx.c: In function 
'gve_tx_add_skb_no_copy':
>> drivers/net/ethernet/google/gve/gve_tx.c:507:25: warning: variable 'buf' set 
>> but not used [-Wunused-but-set-variable]
 507 |  struct gve_tx_dma_buf *buf;
 | ^~~


vim +/buf +507 drivers/net/ethernet/google/gve/gve_tx.c

   497  
   498  static int gve_tx_add_skb_no_copy(struct gve_priv *priv, struct 
gve_tx_ring *tx,
   499struct sk_buff *skb)
   500  {
   501  const struct skb_shared_info *shinfo = skb_shinfo(skb);
   502  int hlen, payload_nfrags, l4_hdr_offset;
   503  union gve_tx_desc *pkt_desc, *seg_desc;
   504  struct gve_tx_buffer_state *info;
   505  bool is_gso = skb_is_gso(skb);
   506  u32 idx = tx->req & tx->mask;
 > 507  struct gve_tx_dma_buf *buf;
   508  u64 addr;
   509  u32 len;
   510  int i;
   511  
   512  info = >info[idx];
   513  pkt_desc = >desc[idx];
   514  
   515  l4_hdr_offset = skb_checksum_start_offset(skb);
   516  /* If the skb is gso, then we want only up to the tcp header in 
the first segment
   517   * to efficiently replicate on each segment otherwise we want 
the linear portion
   518   * of the skb (which will contain the checksum because 
skb->csum_start and
   519   * skb->csum_offset are given relative to skb->head) in the 
first segment.
   520   */
   521  hlen = is_gso ? l4_hdr_offset + tcp_hdrlen(skb) : 
skb_headlen(skb);
   522  len = skb_headlen(skb);
   523  
   524  info->skb =  skb;
   525  
   526  addr = dma_map_single(tx->dev, skb->data, len, DMA_TO_DEVICE);
   527  if (unlikely(dma_mapping_error(tx->dev, addr))) {
   528  tx->dma_mapping_error++;
   529  goto drop;
   530  }
   531  buf = >buf;
   532  dma_unmap_len_set(buf, len, len);
   533  dma_unmap_addr_set(buf, dma, addr);
   534  
   535  payload_nfrags = shinfo->nr_frags;
   536  if (hlen < len) {
   537  /* For gso the rest of the linear portion of the skb 
needs to
   538   * be in its own descriptor.
   539   */
   540  payload_nfrags++;
   541  gve_tx_fill_pkt_desc(pkt_desc, skb, is_gso, 
l4_hdr_offset,
   542   1 + payload_nfrags, hlen, addr);
   543  
   544  len -= hlen;
   545  addr += hlen;
   546  idx = (tx->req + 1) & tx->mask;
   547  seg_desc = >desc[idx];
   548  gve_tx_fill_seg_desc(seg_desc, skb, is_gso, len, addr);
   549  } else {
   550  gve_tx_fill_pkt_desc(pkt_desc, skb, is_gso, 
l4_hdr_offset,
   551   1 + payload_nfrags, hlen, addr);
   552  }
   553  
   554  for (i = 0; i < shinfo->nr_frags; i++) {
   555  const skb_frag_t *frag = >frags[i];
   556  
   557  idx = (idx + 1) & tx->mask;
   558  seg_desc = >desc[idx];
   559  len = skb_frag_size(frag);
   560  addr = skb_frag_dma_map(tx->dev, frag, 0, len, 
DMA_TO_DEVICE);
   561  if (unlikely(dma_mapping_error(tx->dev, addr))) {
   562  tx->dma_mapping_error++;
   563  goto unmap_drop;
   564  }
   565  buf = >info[idx].buf;
   566  tx->info[idx].skb = NULL;
   567  dma_unmap_len_set(buf, len, len);
   568  dma_unmap_addr_set(buf, dma, addr);
   569  
   570  gve_tx_fill_seg_desc(seg_desc, skb, is_gso, len, addr);
   571  }
   572  
   573  ret

[PATCH 18/31] drm/lima: remove unneeded devm_devfreq_remove_device()

2021-01-01 Thread Yangtao Li
There is no need to manually release devm related resources.

Signed-off-by: Yangtao Li 
---
 drivers/gpu/drm/lima/lima_devfreq.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/gpu/drm/lima/lima_devfreq.c 
b/drivers/gpu/drm/lima/lima_devfreq.c
index d5937cf86504..7690c5c69f9f 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.c
+++ b/drivers/gpu/drm/lima/lima_devfreq.c
@@ -94,11 +94,6 @@ void lima_devfreq_fini(struct lima_device *ldev)
devfreq_cooling_unregister(devfreq->cooling);
devfreq->cooling = NULL;
}
-
-   if (devfreq->devfreq) {
-   devm_devfreq_remove_device(ldev->dev, devfreq->devfreq);
-   devfreq->devfreq = NULL;
-   }
 }
 
 int lima_devfreq_init(struct lima_device *ldev)
-- 
2.25.1



[PATCH 17/31] drm/lima: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code, and remove opp_table
from lima_devfreq.

Signed-off-by: Yangtao Li 
---
 drivers/gpu/drm/lima/lima_devfreq.c | 40 -
 drivers/gpu/drm/lima/lima_devfreq.h |  2 --
 2 files changed, 10 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/lima/lima_devfreq.c 
b/drivers/gpu/drm/lima/lima_devfreq.c
index 5686ad4aaf7c..d5937cf86504 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.c
+++ b/drivers/gpu/drm/lima/lima_devfreq.c
@@ -99,13 +99,6 @@ void lima_devfreq_fini(struct lima_device *ldev)
devm_devfreq_remove_device(ldev->dev, devfreq->devfreq);
devfreq->devfreq = NULL;
}
-
-   dev_pm_opp_of_remove_table(ldev->dev);
-
-   dev_pm_opp_put_regulators(devfreq->regulators_opp_table);
-   dev_pm_opp_put_clkname(devfreq->clkname_opp_table);
-   devfreq->regulators_opp_table = NULL;
-   devfreq->clkname_opp_table = NULL;
 }
 
 int lima_devfreq_init(struct lima_device *ldev)
@@ -125,15 +118,11 @@ int lima_devfreq_init(struct lima_device *ldev)
 
spin_lock_init(>lock);
 
-   opp_table = dev_pm_opp_set_clkname(dev, "core");
-   if (IS_ERR(opp_table)) {
-   ret = PTR_ERR(opp_table);
-   goto err_fini;
-   }
-
-   ldevfreq->clkname_opp_table = opp_table;
+   opp_table = devm_pm_opp_set_clkname(dev, "core");
+   if (IS_ERR(opp_table))
+   return PTR_ERR(opp_table);
 
-   opp_table = dev_pm_opp_set_regulators(dev,
+   opp_table = devm_pm_opp_set_regulators(dev,
  (const char *[]){ "mali" },
  1);
if (IS_ERR(opp_table)) {
@@ -141,24 +130,20 @@ int lima_devfreq_init(struct lima_device *ldev)
 
/* Continue if the optional regulator is missing */
if (ret != -ENODEV)
-   goto err_fini;
-   } else {
-   ldevfreq->regulators_opp_table = opp_table;
+   return ret;
}
 
-   ret = dev_pm_opp_of_add_table(dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (ret)
-   goto err_fini;
+   return ret;
 
lima_devfreq_reset(ldevfreq);
 
cur_freq = clk_get_rate(ldev->clk_gpu);
 
opp = devfreq_recommended_opp(dev, _freq, 0);
-   if (IS_ERR(opp)) {
-   ret = PTR_ERR(opp);
-   goto err_fini;
-   }
+   if (IS_ERR(opp))
+   return PTR_ERR(opp);
 
lima_devfreq_profile.initial_freq = cur_freq;
dev_pm_opp_put(opp);
@@ -167,8 +152,7 @@ int lima_devfreq_init(struct lima_device *ldev)
  DEVFREQ_GOV_SIMPLE_ONDEMAND, NULL);
if (IS_ERR(devfreq)) {
dev_err(dev, "Couldn't initialize GPU devfreq\n");
-   ret = PTR_ERR(devfreq);
-   goto err_fini;
+   return PTR_ERR(devfreq);
}
 
ldevfreq->devfreq = devfreq;
@@ -180,10 +164,6 @@ int lima_devfreq_init(struct lima_device *ldev)
ldevfreq->cooling = cooling;
 
return 0;
-
-err_fini:
-   lima_devfreq_fini(ldev);
-   return ret;
 }
 
 void lima_devfreq_record_busy(struct lima_devfreq *devfreq)
diff --git a/drivers/gpu/drm/lima/lima_devfreq.h 
b/drivers/gpu/drm/lima/lima_devfreq.h
index 2d9b3008ce77..c3bcae76ca07 100644
--- a/drivers/gpu/drm/lima/lima_devfreq.h
+++ b/drivers/gpu/drm/lima/lima_devfreq.h
@@ -15,8 +15,6 @@ struct lima_device;
 
 struct lima_devfreq {
struct devfreq *devfreq;
-   struct opp_table *clkname_opp_table;
-   struct opp_table *regulators_opp_table;
struct thermal_cooling_device *cooling;
 
ktime_t busy_time;
-- 
2.25.1



[PATCH 12/31] mmc: sdhci-msm: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code, and remove opp_table
from sdhci_msm_host.

Signed-off-by: Yangtao Li 
---
 drivers/mmc/host/sdhci-msm.c | 19 +++
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 094ef95f5ecc..490ba5d68f72 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -261,7 +261,6 @@ struct sdhci_msm_host {
struct clk_bulk_data bulk_clks[4]; /* core, iface, cal, sleep clocks */
unsigned long clk_rate;
struct mmc_host *mmc;
-   struct opp_table *opp_table;
bool use_14lpp_dll_reset;
bool tuning_done;
bool calibration_done;
@@ -2215,6 +2214,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
const struct sdhci_msm_offset *msm_offset;
const struct sdhci_msm_variant_info *var_info;
struct device_node *node = pdev->dev.of_node;
+   struct opp_table *opp_table;
 
host = sdhci_pltfm_init(pdev, _msm_pdata, sizeof(*msm_host));
if (IS_ERR(host))
@@ -2283,16 +2283,16 @@ static int sdhci_msm_probe(struct platform_device *pdev)
if (ret)
goto bus_clk_disable;
 
-   msm_host->opp_table = dev_pm_opp_set_clkname(>dev, "core");
-   if (IS_ERR(msm_host->opp_table)) {
-   ret = PTR_ERR(msm_host->opp_table);
+   opp_table = devm_pm_opp_set_clkname(>dev, "core");
+   if (IS_ERR(opp_table)) {
+   ret = PTR_ERR(opp_table);
goto bus_clk_disable;
}
 
/* OPP table is optional */
-   ret = dev_pm_opp_of_add_table(>dev);
+   ret = devm_pm_opp_of_add_table(>dev);
if (ret) {
-   dev_pm_opp_put_clkname(msm_host->opp_table);
+   devm_pm_opp_put_clkname(>dev, opp_table);
if (ret != -ENODEV) {
dev_err(>dev, "Invalid OPP table in Device 
tree\n");
goto bus_clk_disable;
@@ -2317,7 +2317,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)
ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
  msm_host->bulk_clks);
if (ret)
-   goto opp_cleanup;
+   goto bus_clk_disable;
 
/*
 * xo clock is needed for FLL feature of cm_dll.
@@ -2462,9 +2462,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 clk_disable:
clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
   msm_host->bulk_clks);
-opp_cleanup:
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(msm_host->opp_table);
 bus_clk_disable:
if (!IS_ERR(msm_host->bus_clk))
clk_disable_unprepare(msm_host->bus_clk);
@@ -2483,8 +2480,6 @@ static int sdhci_msm_remove(struct platform_device *pdev)
 
sdhci_remove_host(host, dead);
 
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(msm_host->opp_table);
pm_runtime_get_sync(>dev);
pm_runtime_disable(>dev);
pm_runtime_put_noidle(>dev);
-- 
2.25.1



[PATCH 14/31] spi: spi-qcom-qspi: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code, and remove opp_table
from qcom_qspi.

Signed-off-by: Yangtao Li 
---
 drivers/spi/spi-qcom-qspi.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c
index 915ae115d8c1..1a1ab153ff59 100644
--- a/drivers/spi/spi-qcom-qspi.c
+++ b/drivers/spi/spi-qcom-qspi.c
@@ -142,7 +142,6 @@ struct qcom_qspi {
struct clk_bulk_data *clks;
struct qspi_xfer xfer;
struct icc_path *icc_path_cpu_to_qspi;
-   struct opp_table *opp_table;
unsigned long last_speed;
/* Lock to protect data accessed by IRQs */
spinlock_t lock;
@@ -459,6 +458,7 @@ static int qcom_qspi_probe(struct platform_device *pdev)
struct device *dev;
struct spi_master *master;
struct qcom_qspi *ctrl;
+   struct opp_table *opp_table;
 
dev = >dev;
 
@@ -531,13 +531,13 @@ static int qcom_qspi_probe(struct platform_device *pdev)
master->handle_err = qcom_qspi_handle_err;
master->auto_runtime_pm = true;
 
-   ctrl->opp_table = dev_pm_opp_set_clkname(>dev, "core");
-   if (IS_ERR(ctrl->opp_table))
-   return PTR_ERR(ctrl->opp_table);
+   opp_table = devm_pm_opp_set_clkname(dev, "core");
+   if (IS_ERR(opp_table))
+   return PTR_ERR(opp_table);
/* OPP table is optional */
-   ret = dev_pm_opp_of_add_table(>dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (ret) {
-   dev_pm_opp_put_clkname(ctrl->opp_table);
+   devm_pm_opp_put_clkname(dev, opp_table);
if (ret != -ENODEV) {
dev_err(>dev, "invalid OPP table in device 
tree\n");
return ret;
@@ -553,8 +553,6 @@ static int qcom_qspi_probe(struct platform_device *pdev)
return 0;
 
pm_runtime_disable(dev);
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(ctrl->opp_table);
 
return ret;
 }
@@ -568,8 +566,6 @@ static int qcom_qspi_remove(struct platform_device *pdev)
spi_unregister_master(master);
 
pm_runtime_disable(>dev);
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(ctrl->opp_table);
 
return 0;
 }
-- 
2.25.1



[PATCH 16/31] drm/msm: convert to use devm_pm_opp_* API and remove dp_ctrl_put

2021-01-01 Thread Yangtao Li
1. Use devm_pm_opp_* to simplif code and avoid mem leak.
2. Remove opp_table from dpu_kms, dp_ctrl_private and msm_dsi_host,
since it does not need a global scope.
3. Remove dp_ctrl_put.

Signed-off-by: Yangtao Li 
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c   |  2 +-
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c   |  2 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.c |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 23 
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h |  2 --
 drivers/gpu/drm/msm/dp/dp_ctrl.c| 29 ++---
 drivers/gpu/drm/msm/dp/dp_ctrl.h|  1 -
 drivers/gpu/drm/msm/dp/dp_display.c |  5 +
 drivers/gpu/drm/msm/dsi/dsi_host.c  | 15 +
 9 files changed, 26 insertions(+), 55 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a5af223eaf50..47e51c632209 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -1560,7 +1560,7 @@ static void check_speed_bin(struct device *dev)
nvmem_cell_put(cell);
}
 
-   dev_pm_opp_set_supported_hw(dev, , 1);
+   devm_pm_opp_set_supported_hw(dev, , 1);
 }
 
 struct msm_gpu *a5xx_gpu_init(struct drm_device *dev)
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index e6703ae98760..bd159e6fac5a 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -1321,7 +1321,7 @@ static int a6xx_gmu_pwrlevels_probe(struct a6xx_gmu *gmu)
 * The GMU handles its own frequency switching so build a list of
 * available frequencies to send during initialization
 */
-   ret = dev_pm_opp_of_add_table(gmu->dev);
+   ret = devm_pm_opp_of_add_table(gmu->dev);
if (ret) {
DRM_DEV_ERROR(gmu->dev, "Unable to set the OPP table for the 
GMU\n");
return ret;
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 6cf9975e951e..e6c446c436e3 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -845,7 +845,7 @@ static void adreno_get_pwrlevels(struct device *dev,
if (!of_find_property(dev->of_node, "operating-points-v2", NULL))
ret = adreno_get_legacy_pwrlevels(dev);
else {
-   ret = dev_pm_opp_of_add_table(dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (ret)
DRM_DEV_ERROR(dev, "Unable to set the OPP table\n");
}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 6f19dfcb4965..cb7e4fddf268 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1082,19 +1082,20 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
struct msm_drm_private *priv = ddev->dev_private;
struct dpu_kms *dpu_kms;
struct dss_module_power *mp;
+   struct opp_table *opp_table;
int ret = 0;
 
dpu_kms = devm_kzalloc(>dev, sizeof(*dpu_kms), GFP_KERNEL);
if (!dpu_kms)
return -ENOMEM;
 
-   dpu_kms->opp_table = dev_pm_opp_set_clkname(dev, "core");
-   if (IS_ERR(dpu_kms->opp_table))
-   return PTR_ERR(dpu_kms->opp_table);
+   opp_table = devm_pm_opp_set_clkname(dev, "core");
+   if (IS_ERR(opp_table))
+   return PTR_ERR(opp_table);
/* OPP table is optional */
-   ret = dev_pm_opp_of_add_table(dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (ret) {
-   dev_pm_opp_put_clkname(dpu_kms->opp_table);
+   devm_pm_opp_put_clkname(dev, opp_table);
if (ret != -ENODEV) {
dev_err(dev, "invalid OPP table in device tree\n");
return ret;
@@ -1105,7 +1106,7 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
ret = msm_dss_parse_clock(pdev, mp);
if (ret) {
DPU_ERROR("failed to parse clocks, ret=%d\n", ret);
-   goto err;
+   return ret;
}
 
platform_set_drvdata(pdev, dpu_kms);
@@ -1113,7 +1114,7 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
ret = msm_kms_init(_kms->base, _funcs);
if (ret) {
DPU_ERROR("failed to init kms, ret=%d\n", ret);
-   goto err;
+   return ret;
}
dpu_kms->dev = ddev;
dpu_kms->pdev = pdev;
@@ -1122,10 +1123,7 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
dpu_kms->rpm_enabled = true;
 
priv->kms = _kms->base;
-   return ret;
-err:
-   dev_pm_opp_of_remove_table(dev);
-   dev_pm_opp_put_clkname(dpu_kms->opp_table);
+
return ret;
 }
 
@@ -1141,9 +1139,6 @@ static void 

[PATCH 15/31] drm/msm: fix potential mem leak

2021-01-01 Thread Yangtao Li
We should use dev_pm_opp_put_clkname() to free opp table each time
dev_pm_opp_of_add_table() got error.

Signed-off-by: Yangtao Li 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 ++
 drivers/gpu/drm/msm/dsi/dsi_host.c  |  8 +---
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 374b0e8471e6..6f19dfcb4965 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1093,9 +1093,12 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
return PTR_ERR(dpu_kms->opp_table);
/* OPP table is optional */
ret = dev_pm_opp_of_add_table(dev);
-   if (ret && ret != -ENODEV) {
-   dev_err(dev, "invalid OPP table in device tree\n");
-   goto put_clkname;
+   if (ret) {
+   dev_pm_opp_put_clkname(dpu_kms->opp_table);
+   if (ret != -ENODEV) {
+   dev_err(dev, "invalid OPP table in device tree\n");
+   return ret;
+   }
}
 
mp = _kms->mp;
@@ -1122,7 +1125,6 @@ static int dpu_bind(struct device *dev, struct device 
*master, void *data)
return ret;
 err:
dev_pm_opp_of_remove_table(dev);
-put_clkname:
dev_pm_opp_put_clkname(dpu_kms->opp_table);
return ret;
 }
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index ab281cba0f08..a282307f2799 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1891,10 +1891,12 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)
return PTR_ERR(msm_host->opp_table);
/* OPP table is optional */
ret = dev_pm_opp_of_add_table(>dev);
-   if (ret && ret != -ENODEV) {
-   dev_err(>dev, "invalid OPP table in device tree\n");
+   if (ret) {
dev_pm_opp_put_clkname(msm_host->opp_table);
-   return ret;
+   if (ret != -ENODEV) {
+   dev_err(>dev, "invalid OPP table in device 
tree\n");
+   return ret;
+   }
}
 
init_completion(_host->dma_comp);
-- 
2.25.1



[PATCH 13/31] spi: spi-qcom-qspi: fix potential mem leak in qcom_qspi_probe()

2021-01-01 Thread Yangtao Li
We should use dev_pm_opp_put_clkname() to free opp table each time
dev_pm_opp_of_add_table() got error.

Signed-off-by: Yangtao Li 
---
 drivers/spi/spi-qcom-qspi.c | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/spi/spi-qcom-qspi.c b/drivers/spi/spi-qcom-qspi.c
index 8863be370884..915ae115d8c1 100644
--- a/drivers/spi/spi-qcom-qspi.c
+++ b/drivers/spi/spi-qcom-qspi.c
@@ -536,9 +536,12 @@ static int qcom_qspi_probe(struct platform_device *pdev)
return PTR_ERR(ctrl->opp_table);
/* OPP table is optional */
ret = dev_pm_opp_of_add_table(>dev);
-   if (ret && ret != -ENODEV) {
-   dev_err(>dev, "invalid OPP table in device tree\n");
-   goto exit_probe_put_clkname;
+   if (ret) {
+   dev_pm_opp_put_clkname(ctrl->opp_table);
+   if (ret != -ENODEV) {
+   dev_err(>dev, "invalid OPP table in device 
tree\n");
+   return ret;
+   }
}
 
pm_runtime_use_autosuspend(dev);
@@ -551,8 +554,6 @@ static int qcom_qspi_probe(struct platform_device *pdev)
 
pm_runtime_disable(dev);
dev_pm_opp_of_remove_table(>dev);
-
-exit_probe_put_clkname:
dev_pm_opp_put_clkname(ctrl->opp_table);
 
return ret;
-- 
2.25.1



[PATCH 10/31] qcom-geni-se: remove opp_table

2021-01-01 Thread Yangtao Li
opp_table isn't used anymore, remove it.

Signed-off-by: Yangtao Li 
---
 include/linux/qcom-geni-se.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/qcom-geni-se.h b/include/linux/qcom-geni-se.h
index ec2ad4b0fe14..cddef864a760 100644
--- a/include/linux/qcom-geni-se.h
+++ b/include/linux/qcom-geni-se.h
@@ -47,7 +47,6 @@ struct geni_icc_path {
  * @num_clk_levels:Number of valid clock levels in clk_perf_tbl
  * @clk_perf_tbl:  Table of clock frequency input to serial engine clock
  * @icc_paths: Array of ICC paths for SE
- * @opp_table: Pointer to the OPP table
  */
 struct geni_se {
void __iomem *base;
@@ -57,7 +56,6 @@ struct geni_se {
unsigned int num_clk_levels;
unsigned long *clk_perf_tbl;
struct geni_icc_path icc_paths[3];
-   struct opp_table *opp_table;
 };
 
 /* Common SE registers */
-- 
2.25.1



[PATCH 11/31] mmc: sdhci-msm: fix potential mem leak in sdhci_msm_probe()

2021-01-01 Thread Yangtao Li
We should use dev_pm_opp_put_clkname() to free opp table each time
dev_pm_opp_of_add_table() got error.

Signed-off-by: Yangtao Li 
---
 drivers/mmc/host/sdhci-msm.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
index 9c7927b03253..094ef95f5ecc 100644
--- a/drivers/mmc/host/sdhci-msm.c
+++ b/drivers/mmc/host/sdhci-msm.c
@@ -2291,9 +2291,12 @@ static int sdhci_msm_probe(struct platform_device *pdev)
 
/* OPP table is optional */
ret = dev_pm_opp_of_add_table(>dev);
-   if (ret && ret != -ENODEV) {
-   dev_err(>dev, "Invalid OPP table in Device tree\n");
-   goto opp_put_clkname;
+   if (ret) {
+   dev_pm_opp_put_clkname(msm_host->opp_table);
+   if (ret != -ENODEV) {
+   dev_err(>dev, "Invalid OPP table in Device 
tree\n");
+   goto bus_clk_disable;
+   }
}
 
/* Vote for maximum clock rate for maximum performance */
@@ -2461,7 +2464,6 @@ static int sdhci_msm_probe(struct platform_device *pdev)
   msm_host->bulk_clks);
 opp_cleanup:
dev_pm_opp_of_remove_table(>dev);
-opp_put_clkname:
dev_pm_opp_put_clkname(msm_host->opp_table);
 bus_clk_disable:
if (!IS_ERR(msm_host->bus_clk))
-- 
2.25.1



[PATCH 09/31] spi: spi-qcom-qspi: fix potential mem leak in spi_geni_probe()

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code, and we don't need
to make opp_table glabal.

Let's remove opp_table from geni_se later.

Signed-off-by: Yangtao Li 
---
 drivers/spi/spi-geni-qcom.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index 2b5a164fecb9..e330c46a9243 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -590,6 +590,7 @@ static int spi_geni_probe(struct platform_device *pdev)
void __iomem *base;
struct clk *clk;
struct device *dev = >dev;
+   struct opp_table *opp_table;
 
irq = platform_get_irq(pdev, 0);
if (irq < 0)
@@ -615,13 +616,13 @@ static int spi_geni_probe(struct platform_device *pdev)
mas->se.wrapper = dev_get_drvdata(dev->parent);
mas->se.base = base;
mas->se.clk = clk;
-   mas->se.opp_table = dev_pm_opp_set_clkname(>dev, "se");
-   if (IS_ERR(mas->se.opp_table))
-   return PTR_ERR(mas->se.opp_table);
+   opp_table = devm_pm_opp_set_clkname(dev, "se");
+   if (IS_ERR(opp_table))
+   return PTR_ERR(opp_table);
/* OPP table is optional */
-   ret = dev_pm_opp_of_add_table(>dev);
+   ret = devm_pm_opp_of_add_table(dev);
if (ret) {
-   dev_pm_opp_put_clkname(mas->se.opp_table);
+   devm_pm_opp_put_clkname(dev, opp_table);
if (ret != -ENODEV) {
dev_err(>dev, "invalid OPP table in device 
tree\n");
return ret;
@@ -677,8 +678,6 @@ static int spi_geni_probe(struct platform_device *pdev)
free_irq(mas->irq, spi);
 spi_geni_probe_runtime_disable:
pm_runtime_disable(dev);
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(mas->se.opp_table);
return ret;
 }
 
@@ -692,8 +691,6 @@ static int spi_geni_remove(struct platform_device *pdev)
 
free_irq(mas->irq, spi);
pm_runtime_disable(>dev);
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(mas->se.opp_table);
return 0;
 }
 
-- 
2.25.1



[PATCH 08/31] spi: spi-qcom-qspi: fix potential mem leak in spi_geni_probe()

2021-01-01 Thread Yangtao Li
We should use dev_pm_opp_put_clkname() to free opp table each time
dev_pm_opp_of_add_table() got error.

Signed-off-by: Yangtao Li 
---
 drivers/spi/spi-geni-qcom.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c
index 512e925d5ea4..2b5a164fecb9 100644
--- a/drivers/spi/spi-geni-qcom.c
+++ b/drivers/spi/spi-geni-qcom.c
@@ -620,9 +620,12 @@ static int spi_geni_probe(struct platform_device *pdev)
return PTR_ERR(mas->se.opp_table);
/* OPP table is optional */
ret = dev_pm_opp_of_add_table(>dev);
-   if (ret && ret != -ENODEV) {
-   dev_err(>dev, "invalid OPP table in device tree\n");
-   goto put_clkname;
+   if (ret) {
+   dev_pm_opp_put_clkname(mas->se.opp_table);
+   if (ret != -ENODEV) {
+   dev_err(>dev, "invalid OPP table in device 
tree\n");
+   return ret;
+   }
}
 
spi->bus_num = -1;
@@ -675,7 +678,6 @@ static int spi_geni_probe(struct platform_device *pdev)
 spi_geni_probe_runtime_disable:
pm_runtime_disable(dev);
dev_pm_opp_of_remove_table(>dev);
-put_clkname:
dev_pm_opp_put_clkname(mas->se.opp_table);
return ret;
 }
-- 
2.25.1



[PATCH 07/31] serial: qcom_geni_serial: convert to use devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Use devm_pm_opp_* API to simplify code, and we don't need
to make opp_table glabal.

Let's remove opp_table from geni_se later.

Signed-off-by: Yangtao Li 
---
 drivers/tty/serial/qcom_geni_serial.c | 23 +--
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c 
b/drivers/tty/serial/qcom_geni_serial.c
index 5aada7ebae35..36a92df8ec11 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1352,6 +1352,7 @@ static int qcom_geni_serial_probe(struct platform_device 
*pdev)
int irq;
bool console = false;
struct uart_driver *drv;
+   struct opp_table *opp_table;
 
if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart"))
console = true;
@@ -1433,13 +1434,13 @@ static int qcom_geni_serial_probe(struct 
platform_device *pdev)
if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap"))
port->cts_rts_swap = true;
 
-   port->se.opp_table = dev_pm_opp_set_clkname(>dev, "se");
-   if (IS_ERR(port->se.opp_table))
-   return PTR_ERR(port->se.opp_table);
+   opp_table = devm_pm_opp_set_clkname(>dev, "se");
+   if (IS_ERR(opp_table))
+   return PTR_ERR(opp_table);
/* OPP table is optional */
-   ret = dev_pm_opp_of_add_table(>dev);
+   ret = devm_pm_opp_of_add_table(>dev);
if (ret) {
-   dev_pm_opp_put_clkname(port->se.opp_table);
+   devm_pm_opp_put_clkname(>dev, opp_table);
if (ret != -ENODEV) {
dev_err(>dev, "invalid OPP table in device 
tree\n");
return ret;
@@ -1453,7 +1454,7 @@ static int qcom_geni_serial_probe(struct platform_device 
*pdev)
 
ret = uart_add_one_port(drv, uport);
if (ret)
-   goto err;
+   return ret;
 
irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
@@ -1461,7 +1462,7 @@ static int qcom_geni_serial_probe(struct platform_device 
*pdev)
if (ret) {
dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
uart_remove_one_port(drv, uport);
-   goto err;
+   return ret;
}
 
/*
@@ -1478,15 +1479,11 @@ static int qcom_geni_serial_probe(struct 
platform_device *pdev)
if (ret) {
device_init_wakeup(>dev, false);
uart_remove_one_port(drv, uport);
-   goto err;
+   return ret;
}
}
 
return 0;
-err:
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(port->se.opp_table);
-   return ret;
 }
 
 static int qcom_geni_serial_remove(struct platform_device *pdev)
@@ -1494,8 +1491,6 @@ static int qcom_geni_serial_remove(struct platform_device 
*pdev)
struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
struct uart_driver *drv = port->private_data.drv;
 
-   dev_pm_opp_of_remove_table(>dev);
-   dev_pm_opp_put_clkname(port->se.opp_table);
dev_pm_clear_wake_irq(>dev);
device_init_wakeup(>dev, false);
uart_remove_one_port(drv, >uport);
-- 
2.25.1



[PATCH 06/31] serial: qcom_geni_serial: fix potential mem leak in qcom_geni_serial_probe()

2021-01-01 Thread Yangtao Li
We should use dev_pm_opp_put_clkname() to free opp table each time
dev_pm_opp_of_add_table() got error.

Signed-off-by: Yangtao Li 
---
 drivers/tty/serial/qcom_geni_serial.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/qcom_geni_serial.c 
b/drivers/tty/serial/qcom_geni_serial.c
index 291649f02821..5aada7ebae35 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1438,9 +1438,12 @@ static int qcom_geni_serial_probe(struct platform_device 
*pdev)
return PTR_ERR(port->se.opp_table);
/* OPP table is optional */
ret = dev_pm_opp_of_add_table(>dev);
-   if (ret && ret != -ENODEV) {
-   dev_err(>dev, "invalid OPP table in device tree\n");
-   goto put_clkname;
+   if (ret) {
+   dev_pm_opp_put_clkname(port->se.opp_table);
+   if (ret != -ENODEV) {
+   dev_err(>dev, "invalid OPP table in device 
tree\n");
+   return ret;
+   }
}
 
port->private_data.drv = drv;
@@ -1482,7 +1485,6 @@ static int qcom_geni_serial_probe(struct platform_device 
*pdev)
return 0;
 err:
dev_pm_opp_of_remove_table(>dev);
-put_clkname:
dev_pm_opp_put_clkname(port->se.opp_table);
return ret;
 }
-- 
2.25.1



[PATCH 05/31] opp: Add devres wrapper for dev_pm_opp_register_notifier

2021-01-01 Thread Yangtao Li
Add devres wrapper for dev_pm_opp_register_notifier() to simplify driver
code.

Signed-off-by: Yangtao Li 
---
 drivers/opp/core.c | 38 ++
 include/linux/pm_opp.h |  6 ++
 2 files changed, 44 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 6b83e373f0d8..ef3544f8cecd 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -2599,6 +2599,44 @@ int dev_pm_opp_unregister_notifier(struct device *dev,
 }
 EXPORT_SYMBOL(dev_pm_opp_unregister_notifier);
 
+static void devm_pm_opp_notifier_release(struct device *dev, void *res)
+{
+   struct notifier_block *nb = *(struct notifier_block **)res;
+
+   WARN_ON(dev_pm_opp_unregister_notifier(dev, nb));
+}
+
+/**
+ * devm_pm_opp_register_notifier() - Register OPP notifier for the device
+ * @dev:   Device for which notifier needs to be registered
+ * @nb:Notifier block to be registered
+ *
+ * Return: 0 on success or a negative error value.
+ *
+ * The notifier will be unregistered after the device is destroyed.
+ */
+int devm_pm_opp_register_notifier(struct device *dev, struct notifier_block 
*nb)
+{
+   struct notifier_block **ptr;
+   int ret;
+
+   ptr = devres_alloc(devm_pm_opp_notifier_release, sizeof(*ptr), 
GFP_KERNEL);
+   if (!ptr)
+   return -ENOMEM;
+
+   ret = dev_pm_opp_register_notifier(dev, nb);
+   if (ret) {
+   devres_free(ptr);
+   return ret;
+   }
+
+   *ptr = nb;
+   devres_add(dev, ptr);
+
+   return 0;
+}
+EXPORT_SYMBOL(devm_pm_opp_register_notifier);
+
 /**
  * dev_pm_opp_remove_table() - Free all OPPs associated with the device
  * @dev:   device pointer used to lookup OPP table.
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index e8bdac5f9555..c24bd34339d7 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -136,6 +136,7 @@ int dev_pm_opp_disable(struct device *dev, unsigned long 
freq);
 
 int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block 
*nb);
 int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block 
*nb);
+int devm_pm_opp_register_notifier(struct device *dev, struct notifier_block 
*nb);
 
 struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 
*versions, unsigned int count);
 void dev_pm_opp_put_supported_hw(struct opp_table *opp_table);
@@ -288,6 +289,11 @@ static inline int dev_pm_opp_register_notifier(struct 
device *dev, struct notifi
return -ENOTSUPP;
 }
 
+static inline int devm_pm_opp_register_notifier(struct device *dev, struct 
notifier_block *nb)
+{
+   return -ENOTSUPP;
+}
+
 static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct 
notifier_block *nb)
 {
return -ENOTSUPP;
-- 
2.25.1



[PATCH 04/31] opp: Add devres wrapper for dev_pm_opp_of_add_table

2021-01-01 Thread Yangtao Li
Add devres wrapper for dev_pm_opp_of_add_table() to simplify driver
code.

Signed-off-by: Yangtao Li 
---
 drivers/opp/of.c   | 36 
 include/linux/pm_opp.h |  6 ++
 2 files changed, 42 insertions(+)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 03cb387236c4..50df483c7dc3 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -998,6 +998,42 @@ int dev_pm_opp_of_add_table(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table);
 
+static void devm_pm_opp_of_table_release(void *data)
+{
+   dev_pm_opp_of_remove_table(data);
+}
+
+/**
+ * devm_pm_opp_of_add_table() - Initialize opp table from device tree
+ * @dev:   device pointer used to lookup OPP table.
+ *
+ * Register the initial OPP table with the OPP library for given device.
+ *
+ * The opp_table structure will be freed after the device is destroyed.
+ *
+ * Return:
+ * 0   On success OR
+ * Duplicate OPPs (both freq and volt are same) and opp->available
+ * -EEXIST Freq are same and volt are different OR
+ * Duplicate OPPs (both freq and volt are same) and !opp->available
+ * -ENOMEM Memory allocation failure
+ * -ENODEV when 'operating-points' property is not found or is invalid data
+ * in device node.
+ * -ENODATAwhen empty 'operating-points' property is found
+ * -EINVAL when invalid entries are found in opp-v2 table
+ */
+int devm_pm_opp_of_add_table(struct device *dev)
+{
+   int ret;
+
+   ret = dev_pm_opp_of_add_table(dev);
+   if (ret)
+   return ret;
+
+   return devm_add_action_or_reset(dev, devm_pm_opp_of_table_release, dev);
+}
+EXPORT_SYMBOL_GPL(devm_pm_opp_of_add_table);
+
 /**
  * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from 
device tree
  * @dev:   device pointer used to lookup OPP table.
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index e5260fc82ba1..e8bdac5f9555 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -398,6 +398,7 @@ static inline void dev_pm_opp_cpumask_remove_table(const 
struct cpumask *cpumask
 int dev_pm_opp_of_add_table(struct device *dev);
 int dev_pm_opp_of_add_table_indexed(struct device *dev, int index);
 void dev_pm_opp_of_remove_table(struct device *dev);
+int devm_pm_opp_of_add_table(struct device *dev);
 int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask);
 void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask);
 int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask 
*cpumask);
@@ -425,6 +426,11 @@ static inline void dev_pm_opp_of_remove_table(struct 
device *dev)
 {
 }
 
+static inline int devm_pm_opp_of_add_table(struct device *dev)
+{
+   return -ENOTSUPP;
+}
+
 static inline int dev_pm_opp_of_cpumask_add_table(const struct cpumask 
*cpumask)
 {
return -ENOTSUPP;
-- 
2.25.1



[PATCH 03/31] opp: Add devres wrapper for dev_pm_opp_set_supported_hw

2021-01-01 Thread Yangtao Li
Add devres wrapper for dev_pm_opp_set_supported_hw() to simplify driver
code.

Signed-off-by: Yangtao Li 
---
 drivers/opp/core.c | 38 ++
 include/linux/pm_opp.h |  8 
 2 files changed, 46 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 8709689a7152..6b83e373f0d8 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1674,6 +1674,44 @@ void dev_pm_opp_put_supported_hw(struct opp_table 
*opp_table)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_put_supported_hw);
 
+static void devm_pm_opp_supported_hw_release(void *data)
+{
+   dev_pm_opp_put_supported_hw(data);
+}
+
+/**
+ * devm_pm_opp_set_supported_hw() - Set supported platforms
+ * @dev: Device for which supported-hw has to be set.
+ * @versions: Array of hierarchy of versions to match.
+ * @count: Number of elements in the array.
+ *
+ * This is required only for the V2 bindings, and it enables a platform to
+ * specify the hierarchy of versions it supports. OPP layer will then enable
+ * OPPs, which are available for those versions, based on its 
'opp-supported-hw'
+ * property.
+ *
+ * The opp_table structure will be freed after the device is destroyed.
+ */
+struct opp_table *devm_pm_opp_set_supported_hw(struct device *dev,
+  const u32 *versions,
+  unsigned int count)
+{
+   struct opp_table *opp_table;
+   int err;
+
+   opp_table = dev_pm_opp_set_supported_hw(dev, versions, count);
+   if (IS_ERR(opp_table))
+   return opp_table;
+
+   err = devm_add_action_or_reset(dev, devm_pm_opp_supported_hw_release,
+  opp_table);
+   if (err)
+   opp_table = ERR_PTR(err);
+
+   return opp_table;
+}
+EXPORT_SYMBOL_GPL(devm_pm_opp_set_supported_hw);
+
 /**
  * dev_pm_opp_set_prop_name() - Set prop-extn name
  * @dev: Device for which the prop-name has to be set.
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 8a329247e08e..e5260fc82ba1 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -139,6 +139,7 @@ int dev_pm_opp_unregister_notifier(struct device *dev, 
struct notifier_block *nb
 
 struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 
*versions, unsigned int count);
 void dev_pm_opp_put_supported_hw(struct opp_table *opp_table);
+struct opp_table *devm_pm_opp_set_supported_hw(struct device *dev, const u32 
*versions, unsigned int count);
 struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char 
*name);
 void dev_pm_opp_put_prop_name(struct opp_table *opp_table);
 struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * 
const names[], unsigned int count);
@@ -301,6 +302,13 @@ static inline struct opp_table 
*dev_pm_opp_set_supported_hw(struct device *dev,
 
 static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) {}
 
+static inline struct opp_table *devm_pm_opp_set_supported_hw(struct device 
*dev,
+   const u32 *versions,
+   unsigned int count)
+{
+   return ERR_PTR(-ENOTSUPP);
+}
+
 static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct 
device *dev,
int (*set_opp)(struct dev_pm_set_opp_data *data))
 {
-- 
2.25.1



[PATCH 02/31] opp: Add devres wrapper for dev_pm_opp_set_regulators and dev_pm_opp_put_regulators

2021-01-01 Thread Yangtao Li
Add devres wrapper for dev_pm_opp_set_regulators()
dev_pm_opp_put_regulators () to simplify driver code.

Signed-off-by: Yangtao Li 
---
 drivers/opp/core.c | 50 ++
 include/linux/pm_opp.h |  9 
 2 files changed, 59 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 53fdf33732d5..8709689a7152 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1878,6 +1878,56 @@ void dev_pm_opp_put_regulators(struct opp_table 
*opp_table)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_put_regulators);
 
+static void devm_pm_opp_regulators_release(void *data)
+{
+   dev_pm_opp_put_regulators(data);
+}
+
+/**
+ * devm_pm_opp_set_regulators() - Set regulator names for the device
+ * @dev: Device for which regulator name is being set.
+ * @names: Array of pointers to the names of the regulator.
+ * @count: Number of regulators.
+ *
+ * In order to support OPP switching, OPP layer needs to know the name of the
+ * device's regulators, as the core would be required to switch voltages as
+ * well.
+ *
+ * This must be called before any OPPs are initialized for the device.
+ *
+ * The opp_table structure will be freed after the device is destroyed.
+ */
+struct opp_table *devm_pm_opp_set_regulators(struct device *dev,
+   const char * const names[],
+   unsigned int count)
+{
+   struct opp_table *opp_table;
+   int err;
+
+   opp_table = dev_pm_opp_set_regulators(dev, names, count);
+   if (IS_ERR(opp_table))
+   return opp_table;
+
+   err = devm_add_action_or_reset(dev, devm_pm_opp_regulators_release,
+  opp_table);
+   if (err)
+   opp_table = ERR_PTR(err);
+
+   return opp_table;
+}
+EXPORT_SYMBOL_GPL(devm_pm_opp_set_regulators);
+
+/**
+ * devm_pm_opp_put_regulators() - Releases resources blocked for regulator
+ * @dev: Device for which we do this operation.
+ * @opp_table: OPP table returned from dev_pm_opp_set_regulators().
+ */
+void devm_pm_opp_put_regulators(struct device *dev, struct opp_table 
*opp_table)
+{
+   devm_release_action(dev, devm_pm_opp_regulators_release, opp_table);
+}
+EXPORT_SYMBOL_GPL(devm_pm_opp_put_regulators);
+
 /**
  * dev_pm_opp_set_clkname() - Set clk name for the device
  * @dev: Device for which clk name is being set.
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 3418a2874f88..8a329247e08e 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -143,6 +143,8 @@ struct opp_table *dev_pm_opp_set_prop_name(struct device 
*dev, const char *name)
 void dev_pm_opp_put_prop_name(struct opp_table *opp_table);
 struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * 
const names[], unsigned int count);
 void dev_pm_opp_put_regulators(struct opp_table *opp_table);
+struct opp_table *devm_pm_opp_set_regulators(struct device *dev, const char * 
const names[], unsigned int count);
+void devm_pm_opp_put_regulators(struct device *dev, struct opp_table 
*opp_table);
 struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * 
name);
 void dev_pm_opp_put_clkname(struct opp_table *opp_table);
 struct opp_table *devm_pm_opp_set_clkname(struct device *dev, const char 
*name);
@@ -321,6 +323,13 @@ static inline struct opp_table 
*dev_pm_opp_set_regulators(struct device *dev, co
 
 static inline void dev_pm_opp_put_regulators(struct opp_table *opp_table) {}
 
+static inline struct opp_table *devm_pm_opp_set_regulators(struct device *dev, 
const char * const names[], unsigned int count)
+{
+   return ERR_PTR(-ENOTSUPP);
+}
+
+static inline void devm_pm_opp_put_regulators(struct device *dev, struct 
opp_table *opp_table) {}
+
 static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, 
const char * name)
 {
return ERR_PTR(-ENOTSUPP);
-- 
2.25.1



[PATCH 01/31] opp: Add devres wrapper for dev_pm_opp_set_clkname and dev_pm_opp_put_clkname

2021-01-01 Thread Yangtao Li
Add devres wrapper for dev_pm_opp_set_clkname() and
dev_pm_opp_put_clkname() to simplify driver code.

Signed-off-by: Yangtao Li 
---
 drivers/opp/core.c | 47 ++
 include/linux/pm_opp.h |  9 
 2 files changed, 56 insertions(+)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index 4268eb359915..53fdf33732d5 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1948,6 +1948,53 @@ void dev_pm_opp_put_clkname(struct opp_table *opp_table)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_put_clkname);
 
+static void devm_pm_opp_clkname_release(void *data)
+{
+   dev_pm_opp_put_clkname(data);
+}
+
+/**
+ * devm_pm_opp_set_clkname() - Set clk name for the device
+ * @dev: Device for which clk name is being set.
+ * @name: Clk name.
+ *
+ * In order to support OPP switching, OPP layer needs to get pointer to the
+ * clock for the device. Simple cases work fine without using this routine 
(i.e.
+ * by passing connection-id as NULL), but for a device with multiple clocks
+ * available, the OPP core needs to know the exact name of the clk to use.
+ *
+ * This must be called before any OPPs are initialized for the device.
+ *
+ * The opp_table structure will be freed after the device is destroyed.
+ */
+struct opp_table *devm_pm_opp_set_clkname(struct device *dev, const char *name)
+{
+   struct opp_table *opp_table;
+   int err;
+
+   opp_table = dev_pm_opp_set_clkname(dev, name);
+   if (IS_ERR(opp_table))
+   return opp_table;
+
+   err = devm_add_action_or_reset(dev, devm_pm_opp_clkname_release, 
opp_table);
+   if (err)
+   opp_table = ERR_PTR(err);
+
+   return opp_table;
+}
+EXPORT_SYMBOL_GPL(devm_pm_opp_set_clkname);
+
+/**
+ * devm_pm_opp_put_clkname() - Releases resources blocked for clk.
+ * @dev: Device for which we do this operation.
+ * @opp_table: OPP table returned from devm_pm_opp_set_clkname().
+ */
+void devm_pm_opp_put_clkname(struct device *dev, struct opp_table *opp_table)
+{
+   devm_release_action(dev, devm_pm_opp_clkname_release, opp_table);
+}
+EXPORT_SYMBOL_GPL(devm_pm_opp_put_clkname);
+
 /**
  * dev_pm_opp_register_set_opp_helper() - Register custom set OPP helper
  * @dev: Device for which the helper is getting registered.
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index 1435c054016a..3418a2874f88 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -145,6 +145,8 @@ struct opp_table *dev_pm_opp_set_regulators(struct device 
*dev, const char * con
 void dev_pm_opp_put_regulators(struct opp_table *opp_table);
 struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * 
name);
 void dev_pm_opp_put_clkname(struct opp_table *opp_table);
+struct opp_table *devm_pm_opp_set_clkname(struct device *dev, const char 
*name);
+void devm_pm_opp_put_clkname(struct device *dev, struct opp_table *opp_table);
 struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int 
(*set_opp)(struct dev_pm_set_opp_data *data));
 void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table);
 struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char 
**names, struct device ***virt_devs);
@@ -326,6 +328,13 @@ static inline struct opp_table 
*dev_pm_opp_set_clkname(struct device *dev, const
 
 static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {}
 
+static inline struct opp_table *devm_pm_opp_set_clkname(struct device *dev, 
const char *name)
+{
+   return ERR_PTR(-ENOTSUPP);
+}
+
+static inline void devm_pm_opp_put_clkname(struct device *dev, struct 
opp_table *opp_table) {}
+
 static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, 
const char **names, struct device ***virt_devs)
 {
return ERR_PTR(-ENOTSUPP);
-- 
2.25.1



[PATCH 00/31] Introduce devm_pm_opp_* API

2021-01-01 Thread Yangtao Li
Hi,

This patchset add devm_pm_opp_set_clkname, devm_pm_opp_put_clkname,
devm_pm_opp_set_regulators, devm_pm_opp_put_regulators,
devm_pm_opp_set_supported_hw, devm_pm_opp_of_add_table and
devm_pm_opp_register_notifier.

Yangtao Li (31):
  opp: Add devres wrapper for dev_pm_opp_set_clkname and
dev_pm_opp_put_clkname
  opp: Add devres wrapper for dev_pm_opp_set_regulators and
dev_pm_opp_put_regulators
  opp: Add devres wrapper for dev_pm_opp_set_supported_hw
  opp: Add devres wrapper for dev_pm_opp_of_add_table
  opp: Add devres wrapper for dev_pm_opp_register_notifier
  serial: qcom_geni_serial: fix potential mem leak in
qcom_geni_serial_probe()
  serial: qcom_geni_serial: convert to use devm_pm_opp_* API
  spi: spi-qcom-qspi: fix potential mem leak in spi_geni_probe()
  spi: spi-qcom-qspi: fix potential mem leak in spi_geni_probe()
  qcom-geni-se: remove opp_table
  mmc: sdhci-msm: fix potential mem leak in sdhci_msm_probe()
  mmc: sdhci-msm: convert to use devm_pm_opp_* API
  spi: spi-qcom-qspi: fix potential mem leak in qcom_qspi_probe()
  spi: spi-qcom-qspi: convert to use devm_pm_opp_* API
  drm/msm: fix potential mem leak
  drm/msm: convert to use devm_pm_opp_* API and remove dp_ctrl_put
  drm/lima: convert to use devm_pm_opp_* API
  drm/lima: remove unneeded devm_devfreq_remove_device()
  drm/panfrost: convert to use devm_pm_opp_* API
  media: venus: fix error check in core_get_v4()
  media: venus: convert to use devm_pm_opp_* API
  memory: samsung: exynos5422-dmc: fix return error in
exynos5_init_freq_table
  memory: samsung: exynos5422-dmc: convert to use devm_pm_opp_* API
  memory: tegra20: convert to use devm_pm_opp_* API
  memory: tegra30: convert to use devm_pm_opp_* API
  PM / devfreq: tegra30: convert to use devm_pm_opp_* API
  PM / devfreq: rk3399_dmc: convert to use devm_pm_opp_* API
  PM / devfreq: imx8m-ddrc: convert to use devm_pm_opp_* API
  PM / devfreq: imx-bus: convert to use devm_pm_opp_* API
  PM / devfreq: exynos: convert to use devm_pm_opp_* API
  PM / devfreq: convert to devm_pm_opp_register_notifier and remove
unused API

 drivers/devfreq/devfreq.c |  66 +--
 drivers/devfreq/exynos-bus.c  |  42 +
 drivers/devfreq/imx-bus.c |  14 +-
 drivers/devfreq/imx8m-ddrc.c  |  15 +-
 drivers/devfreq/rk3399_dmc.c  |  22 +--
 drivers/devfreq/tegra30-devfreq.c |  21 +--
 drivers/gpu/drm/lima/lima_devfreq.c   |  45 +
 drivers/gpu/drm/lima/lima_devfreq.h   |   2 -
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c |   2 +-
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c |   2 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.c   |   2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c   |  31 ++--
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h   |   2 -
 drivers/gpu/drm/msm/dp/dp_ctrl.c  |  29 +--
 drivers/gpu/drm/msm/dp/dp_ctrl.h  |   1 -
 drivers/gpu/drm/msm/dp/dp_display.c   |   5 +-
 drivers/gpu/drm/msm/dsi/dsi_host.c|  23 ++-
 drivers/gpu/drm/panfrost/panfrost_devfreq.c   |  34 +---
 drivers/gpu/drm/panfrost/panfrost_devfreq.h   |   1 -
 .../media/platform/qcom/venus/pm_helpers.c|  22 +--
 drivers/memory/samsung/exynos5422-dmc.c   |  13 +-
 drivers/memory/tegra/tegra20-emc.c|  29 +--
 drivers/memory/tegra/tegra30-emc.c|  29 +--
 drivers/mmc/host/sdhci-msm.c  |  27 ++-
 drivers/opp/core.c| 173 ++
 drivers/opp/of.c  |  36 
 drivers/spi/spi-geni-qcom.c   |  23 ++-
 drivers/spi/spi-qcom-qspi.c   |  25 ++-
 drivers/tty/serial/qcom_geni_serial.c |  31 ++--
 include/linux/devfreq.h   |  23 ---
 include/linux/pm_opp.h|  38 
 include/linux/qcom-geni-se.h  |   2 -
 32 files changed, 402 insertions(+), 428 deletions(-)

-- 
2.25.1



[GIT PULL] Power management updates for v5.11-rc2

2021-01-01 Thread Rafael J. Wysocki
Hi Linus,

Please pull from the tag

 git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git \
 pm-5.11-rc2

with top-most commit 0856ef671f314e27d42998470d07c6b428d23e64

 Merge branches 'pm-cpufreq', 'pm-cpuidle' and 'powercap'

on top of commit 5c8fe583cce542aa0b84adc939ce85293de36e5e

 Linux 5.11-rc1

to receive power management updates for 5.11-rc2.

These fix a crash in intel_pstate during resume from suspend-to-RAM
that may occur after recent changes and two resource leaks in error
paths in the operating performance points (OPP) framework, add a new
C-states table to intel_idle, update the cpuidle MAINTAINERS entry
to cover the governors too and add a new power capping facility
allowing aggregate power constraints to be applied to sets of devices
in a distributed manner.

Specifics:

 - Fix recently introduced crash in the intel_pstate driver that
   occurs if scale-invariance is disabled during resume from
   suspend-to-RAM due to inconsistent changes of APERF or MPERF
   MSR values made by the platform firmware (Rafael Wysocki).

 - Fix a memory leak and add a missing clk_put() in error paths in
   the OPP framework (Quanyang Wang, Viresh Kumar).

 - Add new C-states table for SnowRidge processors to the intel_idle
   driver (Artem Bityutskiy).

 - Update the MAINTAINERS entry for cpuidle to make it clear that
   the governors are covered by it too (Lukas Bulwahn).

 - Add new power capping facility called DTPM (Dynamic Thermal Power
   Management), based on the existing power capping framework, to
   allow aggregate power constraints to be applied to sets of devices
   in a distributed manner, along with a CPU backend driver based on
   the Energy Model (Daniel Lezcano).

Happy New Year!


---

Artem Bityutskiy (1):
  intel_idle: add SnowRidge C-state table

Daniel Lezcano (5):
  units: Add Watt units
  Documentation/powercap/dtpm: Add documentation for dtpm
  powercap/drivers/dtpm: Add API for dynamic thermal power management
  powercap/drivers/dtpm: Add CPU energy model based support
  powercap/drivers/dtpm: Fix __udivdi3 and __aeabi_uldivmod
unresolved symbols

Lukas Bulwahn (1):
  MAINTAINERS: include governors into CPU IDLE TIME MANAGEMENT FRAMEWORK

Quanyang Wang (1):
  opp: fix memory leak in _allocate_opp_table

Rafael J. Wysocki (1):
  cpufreq: intel_pstate: Fix fast-switch fallback path

Viresh Kumar (1):
  opp: Call the missing clk_put() on error

---

 Documentation/power/index.rst |   1 +
 Documentation/power/powercap/dtpm.rst | 212 +++
 MAINTAINERS   |   2 +-
 drivers/cpufreq/intel_pstate.c|   1 -
 drivers/idle/intel_idle.c |  41 ++-
 drivers/opp/core.c|   9 +-
 drivers/powercap/Kconfig  |  13 +
 drivers/powercap/Makefile |   2 +
 drivers/powercap/dtpm.c   | 473 ++
 drivers/powercap/dtpm_cpu.c   | 257 ++
 include/asm-generic/vmlinux.lds.h |  11 +
 include/linux/cpuhotplug.h|   1 +
 include/linux/dtpm.h  |  77 ++
 include/linux/units.h |   4 +
 14 files changed, 1099 insertions(+), 5 deletions(-)


Re: Generate the config file for kernel compilation non-interactively in script.

2021-01-01 Thread Randy Dunlap
Hi,

On 1/1/21 1:55 AM, Hongyi Zhao wrote:
> On Fri, Jan 1, 2021 at 2:32 PM Randy Dunlap  wrote:
>>
>> On 12/31/20 8:51 PM, Hongyi Zhao wrote:
>>> Hi,
>>>
>>> I want to build the realtime Linux for ROS 2 according to the
>>> guidelines here:
>>> .
>>>
>>> For this purpose, I must enable the rt_preempt relative options in the
>>> kernel withe the following method interactively:
>>>
>>> $ make menuconfig
>>>
>>> and set the following
>>>
>>> # Enable CONFIG_PREEMPT_RT
>>>  -> General Setup
>>>   -> Preemption Model (Fully Preemptible Kernel (Real-Time))
>>>(X) Fully Preemptible Kernel (Real-Time)
>>>
>>> # Enable CONFIG_HIGH_RES_TIMERS
>>>  -> General setup
>>>   -> Timers subsystem
>>>[*] High Resolution Timer Support
>>>
>>> # Enable CONFIG_NO_HZ_FULL
>>>  -> General setup
>>>   -> Timers subsystem
>>>-> Timer tick handling (Full dynticks system (tickless))
>>> (X) Full dynticks system (tickless)
>>>
>>> # Set CONFIG_HZ_1000 (note: this is no longer in the General Setup
>>> menu, go back twice)
>>>  -> Processor type and features
>>>   -> Timer frequency (1000 HZ)
>>>(X) 1000 HZ
>>>
>>> # Set CPU_FREQ_DEFAULT_GOV_PERFORMANCE [=y]
>>>  ->  Power management and ACPI options
>>>   -> CPU Frequency scaling
>>>-> CPU Frequency scaling (CPU_FREQ [=y])
>>> -> Default CPUFreq governor ( [=y])
>>>  (X) performance
>>>
>>> But this is very inconvenient for doing the above job in script. Is
>>> there an alternative method to generate the above configurations for
>>> kernel compilation  non-interactively in script.
>>
>> Hi,
>> You can use scripts/config in the kernel source tree.
>> Something like this (I don't have RT kernel sources):
>>
>>
>> scripts/config -e PREEMPT_RT
>> scripts/config -e HIGH_RES_TIMERS
>> scripts/config -e NO_HZ_FULL
>> scripts/config -e HZ_1000
>> scripts/config -e CPU_FREQ_DEFAULT_GOV_PERFORMANCE
> 
> Wonderful. Thanks a lot for your instructions. I really have noticed
> this tool but failed to figure out the corresponding translation rules
> for the options used by menuconfig and this script.
> 
> BTW, how do you figure out the above options/arguments corresponding
> to the ones I've mentioned previously?
> 

Oh, I just took the ones that you had listed and removed the leading
"CONFIG_" from them.

>>
>> Note that if any of those have other Kconfig dependencies, those Kconfig
>> symbols will also have to be enabled for this to work.
> 
> How to know whether an option has other Kconfig dependencies and find
> the corresponding symbols/arguments for feeding to scripts/config?

Use one of the interactive config tools (nconfig, xconfig).
They will show you dependencies, but you may have to enable other
symbols first.

Maybe it would be easier to do a temporary 'make allmodconfig'
to have the symbols that you are interested in be enabled, then
you can find them and look at their dependencies.

Or you could just read the Kconfig files, but that would probably
be painful.

>> And then run 'make oldconfig' to update the kernel .config file.
> 
> Thanks again.


-- 
~Randy



Re: Linux 5.11-rc1

2021-01-01 Thread Pavel Machek
Hi!
> >
> > > $ dpkg -L kmod | grep bin | grep depmod
> > > /sbin/depmod
> > >
> > > $ which depmod
> > > [ empty ]
> > >
> > > $ echo $PATH
> > > /opt/proxychains-ng/bin:/home/dileks/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
> 
> Ok, I think this is a broken setup that has a separate /sbin but does
> not have it in the PATH.

That's how it is supposed to work, AFAICT. It is so on Debian here,
for example.

/sbin is for management commands, why would I have it in PATH when
running as normal user?

Best regards,
Pavel
-- 
http://www.livejournal.com/~pavelmachek


signature.asc
Description: PGP signature


RE: [PATCH v2 1/2] dt-bindings: timer: Add bindings for Intel Keem Bay SoC timer

2021-01-01 Thread Ayyathurai, Vijayakannan
Hi Rob,

> From: Rob Herring 
> > From: Vijayakannan Ayyathurai 
> >
> > Add Device Tree bindings for the Timer IP, which used as clocksource and
> > clockevent device in the Intel Keem Bay SoC.
> >
> > Acked-by: Mark Gross 
> > Acked-by: Andy Shevchenko 
> > Signed-off-by: Vijayakannan Ayyathurai
> 
> > ---
> >  .../bindings/timer/intel,keembay-timer.yaml   | 52 +++
> >  1 file changed, 52 insertions(+)
> >  create mode 100644
> Documentation/devicetree/bindings/timer/intel,keembay-timer.yaml
> >
> 
> My bot found errors running 'make dt_binding_check' on your patch:
> 
> yamllint warnings/errors:
> 
> dtschema/dtc warnings/errors:
> Error: Documentation/devicetree/bindings/timer/intel,keembay-
> timer.example.dts:32.3-33.1 syntax error
> FATAL ERROR: Unable to parse input tree
> make[1]: *** [scripts/Makefile.lib:344:
> Documentation/devicetree/bindings/timer/intel,keembay-
> timer.example.dt.yaml] Error 1
> make: *** [Makefile:1370: dt_binding_check] Error 2
> 
> See https://patchwork.ozlabs.org/patch/1421313
> 
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
> 
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
> 
> pip3 install dtschema --upgrade
> 
> Please check and re-submit.

Thanks for the review. Let me check again and re-submit in the next version.

Thanks,
Vijay


Re: [PATCH] platform/x86: ideapad-laptop: Add has_touchpad_switch

2021-01-01 Thread Jiaxun Yang



On Fri, Jan 1, 2021, at 10:20 PM, Barnabás Pőcze wrote:
> Hi
> 
> 
> 2021. január 1., péntek 7:11 keltezéssel, Jiaxun Yang írta:
> 
> > Newer ideapads (e.g.: Yoga 14s, 720S 14) comes with I2C HID
> > Touchpad and do not use EC to switch touchpad. Reading VPCCMD_R_TOUCHPAD
> > will return zero thus touchpad may be blocked. Writing VPCCMD_W_TOUCHPAD
> > may cause a spurious key press.
> >
> > Add has_touchpad_switch to workaround these machines.
> >
> > Signed-off-by: Jiaxun Yang 
> > Cc: sta...@vger.kernel.org # 5.4+
> 
> Interestingly, the Lenovo Yoga 540-14IKB 80X8 has an HID-over-I2C touchpad,
> and yet it can be controlled by reading/writing the appropriate EC registers.
> 
> 
> > ---
> >  drivers/platform/x86/ideapad-laptop.c | 18 +-
> >  1 file changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/platform/x86/ideapad-laptop.c 
> > b/drivers/platform/x86/ideapad-laptop.c
> > index 7598cd46cf60..b6a4db37d0fc 100644
> > --- a/drivers/platform/x86/ideapad-laptop.c
> > +++ b/drivers/platform/x86/ideapad-laptop.c
> > @@ -92,6 +92,7 @@ struct ideapad_private {
> > struct dentry *debug;
> > unsigned long cfg;
> > bool has_hw_rfkill_switch;
> > +   bool has_touchpad_switch;
> > const char *fnesc_guid;
> >  };
> >
> > @@ -535,7 +536,9 @@ static umode_t ideapad_is_visible(struct kobject *kobj,
> > } else if (attr == _attr_fn_lock.attr) {
> > supported = acpi_has_method(priv->adev->handle, "HALS") &&
> > acpi_has_method(priv->adev->handle, "SALS");
> > -   } else
> > +   } else if (attr == _attr_touchpad.attr)
> > +   supported = priv->has_touchpad_switch;
> > +   else
> > supported = true;
> >
> > return supported ? attr->mode : 0;
> > @@ -867,6 +870,9 @@ static void ideapad_sync_touchpad_state(struct 
> > ideapad_private *priv)
> >  {
> > unsigned long value;
> >
> > +   if (!priv->has_touchpad_switch)
> > +   return;
> > +
> > /* Without reading from EC touchpad LED doesn't switch state */
> > if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, )) {
> > /* Some IdeaPads don't really turn off touchpad - they only
> > @@ -989,6 +995,12 @@ static int ideapad_acpi_add(struct platform_device 
> > *pdev)
> > priv->platform_device = pdev;
> > priv->has_hw_rfkill_switch = dmi_check_system(hw_rfkill_list);
> >
> > +   /* Most ideapads with I2C HID don't use EC touchpad switch */
> > +   if (acpi_dev_present("PNP0C50", NULL, -1))
> > +   priv->has_touchpad_switch = false;
> > +   else
> > +   priv->has_touchpad_switch = true;
> > +
> 
> `priv->has_touchpad_switch = !acpi_dev_present(...)`
> ?

Will fix.

> 
> 
> > ret = ideapad_sysfs_init(priv);
> > if (ret)
> > return ret;
> > @@ -1006,6 +1018,10 @@ static int ideapad_acpi_add(struct platform_device 
> > *pdev)
> > if (!priv->has_hw_rfkill_switch)
> > write_ec_cmd(priv->adev->handle, VPCCMD_W_RF, 1);
> >
> > +   /* The same for Touchpad */
> > +   if (!priv->has_touchpad_switch)
> > +   write_ec_cmd(priv->adev->handle, VPCCMD_W_TOUCHPAD, 1);
> > +
> 
> Shouldn't it be the other way around: `if (priv->has_touchpad_switch)`?

It is to prevent accidentally disable touchpad on machines that do have EC 
switch,
so it's intentional.

Thanks.

- Jiaxun

> 
> 
> 
> > for (i = 0; i < IDEAPAD_RFKILL_DEV_NUM; i++)
> > if (test_bit(ideapad_rfk_data[i].cfgbit, >cfg))
> > ideapad_register_rfkill(priv, i);
> > --
> > 2.30.0
> 
> 
> Regards,
> Barnabás Pőcze
>

-- 
- Jiaxun


Re: [PATCH 0/4] sched/idle: Fix missing need_resched() checks after rcu_idle_enter()

2021-01-01 Thread Paul E. McKenney
On Tue, Dec 22, 2020 at 05:19:51PM +0100, Rafael J. Wysocki wrote:
> On 12/22/2020 2:37 AM, Frederic Weisbecker wrote:
> > With Paul, we've been thinking that the idle loop wasn't twisted enough
> > yet to deserve 2020.
> > 
> > rcutorture, after some recent parameter changes, has been complaining
> > about a hung task.
> > 
> > It appears that rcu_idle_enter() may wake up a NOCB kthread but this
> > happens after the last generic need_resched() check. Some cpuidle drivers
> > fix it by chance but many others don't.
> > 
> > Here is a proposed bunch of fixes. I will need to also fix the
> > rcu_user_enter() case, likely using irq_work, since nohz_full requires
> > irq work to support self IPI.
> > 
> > Also more generally, this raise the question of local task wake_up()
> > under disabled interrupts. When a wake up occurs in a preempt disabled
> > section, it gets handled by the outer preempt_enable() call. There is no
> > similar mechanism when a wake up occurs with interrupts disabled. I guess
> > it is assumed to be handled, at worst, in the next tick. But a local irq
> > work would provide instant preemption once IRQs are re-enabled. Of course
> > this would only make sense in CONFIG_PREEMPTION, and when the tick is
> > disabled...
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
> > sched/idle
> > 
> > HEAD: f2fa6e4a070c1535b9edc9ee097167fd2b15d235
> > 
> > Thanks,
> > Frederic
> > ---
> > 
> > Frederic Weisbecker (4):
> >sched/idle: Fix missing need_resched() check after rcu_idle_enter()
> >cpuidle: Fix missing need_resched() check after rcu_idle_enter()
> >ARM: imx6q: Fix missing need_resched() check after rcu_idle_enter()
> >ACPI: processor: Fix missing need_resched() check after 
> > rcu_idle_enter()
> > 
> > 
> >   arch/arm/mach-imx/cpuidle-imx6q.c |  7 ++-
> >   drivers/acpi/processor_idle.c | 10 --
> >   drivers/cpuidle/cpuidle.c | 33 +
> >   kernel/sched/idle.c   | 18 --
> >   4 files changed, 51 insertions(+), 17 deletions(-)
> 
> Please feel free to add
> 
> Reviewed-by: Rafael J. Wysocki 
> 
> to all patches in the series.

I would guess that they will take some other path to mainline, but I have
queued these to cut down on rcutorture's whining.  ;-)

Thanx, Paul


Re: [PATCH v2 1/2] scsi: ufs: Fix a possible NULL pointer issue

2021-01-01 Thread Bart Van Assche
On 12/31/20 9:44 PM, Can Guo wrote:
> During system resume/suspend, hba could be NULL. In this case, do not touch
> eh_sem.
> 
> Fixes: 88a92d6ae4fe ("scsi: ufs: Serialize eh_work with system PM events and 
> async scan")
> 
> Signed-off-by: Can Guo 
> ---
>  drivers/scsi/ufs/ufshcd.c | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index e221add..34e2541 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -8896,8 +8896,11 @@ int ufshcd_system_suspend(struct ufs_hba *hba)
>   int ret = 0;
>   ktime_t start = ktime_get();
>  
> + if (!hba)
> + return 0;
> +
>   down(>eh_sem);
> - if (!hba || !hba->is_powered)
> + if (!hba->is_powered)
>   return 0;
>  
>   if ((ufs_get_pm_lvl_to_dev_pwr_mode(hba->spm_lvl) ==
> @@ -8945,10 +8948,8 @@ int ufshcd_system_resume(struct ufs_hba *hba)
>   int ret = 0;
>   ktime_t start = ktime_get();
>  
> - if (!hba) {
> - up(>eh_sem);
> + if (!hba)
>   return -EINVAL;
> - }
>  
>   if (!hba->is_powered || pm_runtime_suspended(hba->dev))
>   /*

Hi Can,

How can ufshcd_system_suspend() or ufshcd_system_resume() be called with a
NULL argument? In ufshcd_pci_probe() I see that pci_set_drvdata() is called
before pm_runtime_allow(). ufshcd_pci_remove() calls pm_runtime_forbid().

Thanks,

Bart.



[PATCH RESEND] media: dvbdev: Switch to new kerneldoc syntax for named variable macro argument

2021-01-01 Thread Jonathan Neuschäfer
The syntax without dots is available since commit 43756e347f21
("scripts/kernel-doc: Add support for named variable macro arguments").

The same HTML output is produced with and without this patch.

Signed-off-by: Jonathan Neuschäfer 
---
 include/media/dvbdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/media/dvbdev.h b/include/media/dvbdev.h
index e547cbeee4310..cc85df91ee7c6 100644
--- a/include/media/dvbdev.h
+++ b/include/media/dvbdev.h
@@ -421,7 +421,7 @@ void dvb_module_release(struct i2c_client *client);
  * dvb_attach - attaches a DVB frontend into the DVB core.
  *
  * @FUNCTION:  function on a frontend module to be called.
- * @ARGS...:   @FUNCTION arguments.
+ * @ARGS:  @FUNCTION arguments.
  *
  * This ancillary function loads a frontend module in runtime and runs
  * the @FUNCTION function there, with @ARGS.
--
2.28.0



Sie haben eine Spende von € 5.800.000,00.

2021-01-01 Thread Mrs. Mavis
Sie haben eine Spende von € 5.800.000,00. von Mavis Wanczyk antworten Sie mit 
diesem Code [MW530342019], um die Spende zu erhalten


Vous avez un don de 5 800 000,00 €. de Mavis Wanczyk répondez avec ce code 
[MW530342019] pour recevoir le don


Re: [PATCH] riscv: add BUILTIN_DTB support for MMU-enabled targets

2021-01-01 Thread Anup Patel
On Thu, Dec 31, 2020 at 3:23 PM Vitaly Wool  wrote:
>
> On Tue, Dec 29, 2020 at 6:05 AM Anup Patel  wrote:
> >
> > On Mon, Dec 28, 2020 at 10:08 PM Vitaly Wool  
> > wrote:
> > >
> > > On Mon, Dec 28, 2020 at 3:10 PM Anup Patel  wrote:
> > > >
> > > > On Mon, Dec 28, 2020 at 7:05 PM Vitaly Wool  
> > > > wrote:
> > > > >
> > > > > On Mon, Dec 28, 2020 at 12:59 PM Anup Patel  
> > > > > wrote:
> > > > > >
> > > > > > On Sat, Dec 26, 2020 at 10:03 PM Vitaly Wool 
> > > > > >  wrote:
> > > > > > >
> > > > > > > Sometimes, especially in a production system we may not want to
> > > > > > > use a "smart bootloader" like u-boot to load kernel, ramdisk and
> > > > > > > device tree from a filesystem on eMMC, but rather load the kernel
> > > > > > > from a NAND partition and just run it as soon as we can, and in
> > > > > > > this case it is convenient to have device tree compiled into the
> > > > > > > kernel binary. Since this case is not limited to MMU-less systems,
> > > > > > > let's support it for these which have MMU enabled too.
> > > > > > >
> > > > > > > Signed-off-by: Vitaly Wool 
> > > > > > > ---
> > > > > > >  arch/riscv/Kconfig   |  1 -
> > > > > > >  arch/riscv/mm/init.c | 12 ++--
> > > > > > >  2 files changed, 10 insertions(+), 3 deletions(-)
> > > > > > >
> > > > > > > diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
> > > > > > > index 2b41f6d8e458..9464b4e3a71a 100644
> > > > > > > --- a/arch/riscv/Kconfig
> > > > > > > +++ b/arch/riscv/Kconfig
> > > > > > > @@ -419,7 +419,6 @@ endmenu
> > > > > > >
> > > > > > >  config BUILTIN_DTB
> > > > > > > def_bool n
> > > > > > > -   depends on RISCV_M_MODE
> > > > > > > depends on OF
> > > > > > >
> > > > > > >  menu "Power management options"
> > > > > > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> > > > > > > index 87c305c566ac..5d1c7a3ec01c 100644
> > > > > > > --- a/arch/riscv/mm/init.c
> > > > > > > +++ b/arch/riscv/mm/init.c
> > > > > > > @@ -194,12 +194,20 @@ void __init setup_bootmem(void)
> > > > > > > setup_initrd();
> > > > > > >  #endif /* CONFIG_BLK_DEV_INITRD */
> > > > > > >
> > > > > > > +   /*
> > > > > > > +* If DTB is built in, no need to reserve its memblock.
> > > > > > > +* OTOH, initial_boot_params has to be set to properly 
> > > > > > > copy DTB
> > > > > > > +* before unflattening later on.
> > > > > > > +*/
> > > > > > > +   if (IS_ENABLED(CONFIG_BUILTIN_DTB))
> > > > > > > +   initial_boot_params = __va(dtb_early_pa);
> > > > > >
> > > > > > Don't assign initial_boot_params directly here because the
> > > > > > early_init_dt_scan() will do it.
> > > > >
> > > > > early_init_dt_scan will set initial_boot_params to dtb_early_va from
> > > > > the early mapping which will be gone by the time
> > > > > unflatten_and_copy_device_tree() is called.
> > > >
> > > > That's why we are doing early_init_dt_verify() again for the MMU-enabled
> > > > case which already takes care of your concern.
> > >
> > > I might be out in the woods here but... Do you mean the call to
> > > early_init_dt_verify() in setup_arch() which is compiled out
> > > completely in the CONFIG_BUILTIN_DTB case?
> > > Or is there any other call that I'm overlooking?
> >
> > Sorry for the confusion, what I meant was that we are calling
> > early_init_dt_verify() from setup_arch() for the MMU-enabled
> > with built-in DTB disabled case to update "initial_boot_params"
> > after the boot CPU has switched from early_pg_dir to swapper_pg_dir.
> >
> > For MMU-enabled with built-in DTB case, if setup_vm() sets the
> > dtb_early_va and dtb_early_pa correctly then early_init_dt_scan()
> > called from setup_arch() will automatically set correct value for
> > "initial_boot_params".
>
> Oh I think I get it now. You are suggesting to skip the temporary
> mapping for DT altogether since it is anyway in the kernel mapping
> range, aren't you?
> That does make sense indeed, thanks :)

Yes, that's what I am suggesting.

>
> > It is strange that early_init_dt_verify() is being compiled-out for you
> > because the early_init_dt_scan() called from setup_arch() also uses
> > early_init_dt_verify(). I quickly compiled the NoMMU kernel for K210
> > which also uses built-in DTB and I see that early_init_dt_verify()
> > is not being compiled-out when built-in DTB is enabled.
>
> I did not say that early_init_dt_verify() is compiled out, it's the
> call to it in setup_arch() that is compiled out if BUILTIN_DTB is
> selected. However, if I understand you correctly now, it should not
> matter if we don't set dtb_early_va to point to the temporary mapping.

Yes, dtb_early_va can point to some other location such as
built-in DTB.

For MMU-enabled with built-in DTB case, the setup_vm() should
skip the temporary mapping to DT and instead set dtb_early_va
and dtb_early_pa to point to the built-in DTB.

Regards,
Anup


Re: [sh] smp-shx3.c: error: ignoring return value of 'request_irq', declared with attribute warn_unused_result

2021-01-01 Thread John Paul Adrian Glaubitz
Hello Naresh!

On 12/9/20 6:26 PM, Naresh Kamboju wrote:
> Linux next 20201209 tag the arch 'sh' defconfig build failed to build with
> gcc-8, gcc-9 and gcc-10.
> 
> arch/sh/kernel/cpu/sh4a/smp-shx3.c: In function 'shx3_prepare_cpus':
> arch/sh/kernel/cpu/sh4a/smp-shx3.c:76:3: error: ignoring return value
> of 'request_irq', declared with attribute warn_unused_result
> [-Werror=unused-result]
>request_irq(104 + i, ipi_interrupt_handler,
>^~~
> IRQF_PERCPU, "IPI", (void *)(long)i);
> 
> 
> Reported-by: Naresh Kamboju 

I can't reproduce this issue on Linus' current tree as of today.

Maybe the issue has been fixed in the meantime?

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



Re: 5.11-rc1 TTM list corruption

2021-01-01 Thread Christian König

Hi Borislav,

my best guess is that this is an use after free.

Going to double check the code, but can you reproduce this issue reliable?

Thanks,
Christian.

Am 31.12.20 um 11:40 schrieb Borislav Petkov:

Hi folks,

got this when trying to suspend my workstation to disk, it was still
responsive so I could catch the splat:

[22020.334381] [ cut here ]
[22020.339057] list_del corruption. next->prev should be 8b7a9a40, but 
was 8881020bced0
[22020.347764] WARNING: CPU: 12 PID: 13134 at lib/list_debug.c:54 
__list_del_entry_valid+0x8a/0x90
[22020.356397] Modules linked in: fuse essiv authenc nft_counter nf_tables 
libcrc32c nfnetlink loop dm_crypt dm_mod amd64_edac edac_mce_amd kvm_amd 
snd_hda_codec_realtek snd_hda_codec_generic led_class kvm ledtrig_audio 
snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hda_core 
snd_pcm snd_timer irqbypass crct10dif_pclmul snd crc32_pclmul crc32c_intel 
ghash_clmulni_intel pcspkr k10temp soundcore gpio_amdpt gpio_generic 
acpi_cpufreq radeon aesni_intel glue_helper crypto_simd cryptd pinctrl_amd
[22020.400855] CPU: 12 PID: 13134 Comm: hib.sh Not tainted 5.11.0-rc1+ #2
[22020.400857] Hardware name: Micro-Star International Co., Ltd. MS-7B79/X470 
GAMING PRO (MS-7B79), BIOS 1.70 01/23/2019
[22020.400858] RIP: 0010:__list_del_entry_valid+0x8a/0x90
[22020.400861] Code: 46 00 0f 0b 31 c0 c3 48 89 f2 48 89 fe 48 c7 c7 78 30 0f 82 e8 
24 6c 46 00 0f 0b 31 c0 c3 48 c7 c7 b8 30 0f 82 e8 13 6c 46 00 <0f> 0b 31 c0 c3 
cc 48 85 d2 89 f8 74 20 48 8d 0c 16 0f b6 16 48 ff
[22020.400863] RSP: 0018:c90001fbbcf8 EFLAGS: 00010292
[22020.441503] RAX: 0054 RBX: 8b7a9a40 RCX: 
[22020.441505] RDX: 8887fef26600 RSI: 8887fef17450 RDI: 8887fef17450
[22020.441505] RBP: 3f82 R08: 8887fef17450 R09: c90001fbbb38
[22020.441506] R10: 0001 R11: 0001 R12: 
[22020.441507] R13: 0080 R14: 0480 R15: 019b
[22020.441508] FS:  7f51c72f9740() GS:8887fef0() 
knlGS:
[22020.490045] CS:  0010 DS:  ES:  CR0: 80050033
[22020.490046] CR2: 5557afb81018 CR3: 00012099e000 CR4: 003506e0
[22020.490047] Call Trace:
[22020.490048]  ttm_pool_shrink+0x61/0xd0
[22020.508965]  ttm_pool_shrinker_scan+0xa/0x20
[22020.508966]  shrink_slab.part.0.constprop.0+0x1a1/0x330
[22020.508970]  drop_slab_node+0x37/0x50
[22020.522011]  drop_slab+0x33/0x60
[22020.522012]  drop_caches_sysctl_handler+0x70/0x80
[22020.522015]  proc_sys_call_handler+0x140/0x220
[22020.534286]  new_sync_write+0x10b/0x190
[22020.534289]  vfs_write+0x1b7/0x290
[22020.534291]  ksys_write+0x60/0xe0
[22020.544762]  do_syscall_64+0x33/0x40
[22020.544765]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[22020.553320] RIP: 0033:0x7f51c73eaff3
[22020.553322] Code: 8b 15 a1 ee 0c 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 
1f 00 64 8b 04 25 18 00 00 00 85 c0 75 14 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff 
ff 77 55 c3 0f 1f 40 00 48 83 ec 28 48 89 54 24 18
[22020.553324] RSP: 002b:7ffd0a748ef8 EFLAGS: 0246 ORIG_RAX: 
0001
[22020.553325] RAX: ffda RBX: 0002 RCX: 7f51c73eaff3
[22020.553326] RDX: 0002 RSI: 56039fd0ee70 RDI: 0001
[22020.553327] RBP: 56039fd0ee70 R08: 000a R09: 0001
[22020.553327] R10: 56039fd0e770 R11: 0246 R12: 0002
[22020.611218] R13: 7f51c74bb6a0 R14: 0002 R15: 7f51c74bb8a0
[22020.611220] ---[ end trace f7ea94a6ddb98f71 ]---





Re: [PATCH RFC 10/39] KVM: x86/xen: support upcall vector

2021-01-01 Thread David Woodhouse
On Wed, 2020-12-02 at 18:34 +, Joao Martins wrote:
> > But if the kernel is going to short-circuit the IPIs and VIRQs, then
> > it's already going to have to handle the evtchn_pending/evtchn_mask
> > bitmaps, and actually injecting interrupts.
> > 
> 
> Right. I was trying to point that out in the discussion we had
> in next patch. But true be told, more about touting the idea of kernel
> knowing if a given event channel is registered for userspace handling,
> rather than fully handling the event channel.
> 
> I suppose we are able to provide both options to the VMM anyway
> i.e. 1) letting them handle it enterily in userspace by intercepting
> EVTCHNOP_send, or through the irq route if we want kernel to offload it.
> 
> > Given that it has to have that functionality anyway, it seems saner to
> > let the kernel have full control over it and to just expose
> > 'evtchn_send' to userspace.
> > 
> > The alternative is to have userspace trying to play along with the
> > atomic handling of those bitmasks too 
> 
> That part is not particularly hard -- having it done already.

Right, for 2-level it works out fairly well. I like your model of
installing { vcpu_id, port } into the KVM IRQ routing table and that's
enough for the kernel to raise the event channels that it *needs* to
know about, while userspace can do the others for itself. It's just
atomic test-and-set bitop stuff with no real need for coordination.

For FIFO event channels it gets more fun, because the updates aren't
truly atomic — they require a spinlock around the three operations that
the host has to perform when linking an event into a queue: 

 • Set the new port's LINKED bit
 • Set the previous head's LINK to point to the new port
 • Store the new port# as the head.

One option might be to declare that for FIFO, all updates for a given
queue *must* be handled either by the kernel, or by userspace, and
there's sharing of control.

Or maybe there's a way to keep the kernel side simple by avoiding the
tail handling completely. Surely we only really care about kernel
handling of the *fast* path, where a single event channel is triggered
and handled immediately? In the high-latency case where we're gathering
multiple events in a queue before the guest ever gets to process them, 
we might as well let that be handled by userspace, right?

So in that case, perhaps the kernel part could forget all the horrid
nonsense with tracking the tail of the queue. It would handle the event
in-kernel *only* in the case where the event is the *first* in the
queue, and the head was previously zero?

But even that isn't a simple atomic operation though; we still have to
mark the event LINKED, then update the head pointer to reference it.
And what if we set the 'LINKED' bit but then find that userspace has
already linked another port so ->head is no longer zero?

Can we just clear the LINKED bit and then punt the whole event for
userspace to (re)handle? Or raise a special event to userspace so it
knows it needs to go ahead and link the port even though its LINKED bit
has already been set?

None of the available options really fill me with joy; I'm somewhat
inclined just to declare that the kernel won't support acceleration of
FIFO event channels at all.

None of which matters a *huge* amount right now if I was only going to
leave that as a future optimisation anyway.

What it does actually mean in the short term is that as I update your
KVM_IRQ_ROUTING_XEN_EVTCHN support, I probably *won't* bother to add a
'priority' field to struct kvm_irq_routing_xen_evtchn to make it
extensible to FIFO event channels. We can always add that later.

Does that seem reasonable?


smime.p7s
Description: S/MIME cryptographic signature


Re: [patch 02/19] sh: Get rid of nmi_count()

2021-01-01 Thread John Paul Adrian Glaubitz
Hello Thomas!

On 11/13/20 3:02 PM, Thomas Gleixner wrote:
> nmi_count() is a historical leftover and SH is the only user. Replace it
> with regular per cpu accessors.
> 
> Signed-off-by: Thomas Gleixner 
> Cc: Yoshinori Sato 
> Cc: Rich Felker 
> Cc: linux...@vger.kernel.org
> ---
>  arch/sh/kernel/irq.c   |2 +-
>  arch/sh/kernel/traps.c |2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> --- a/arch/sh/kernel/irq.c
> +++ b/arch/sh/kernel/irq.c
> @@ -44,7 +44,7 @@ int arch_show_interrupts(struct seq_file
>  
>   seq_printf(p, "%*s: ", prec, "NMI");
>   for_each_online_cpu(j)
> - seq_printf(p, "%10u ", nmi_count(j));
> + seq_printf(p, "%10u ", per_cpu(irq_stat.__nmi_count, j);
>   seq_printf(p, "  Non-maskable interrupts\n");
>  
>   seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(_err_count));
> --- a/arch/sh/kernel/traps.c
> +++ b/arch/sh/kernel/traps.c
> @@ -186,7 +186,7 @@ BUILD_TRAP_HANDLER(nmi)
>   arch_ftrace_nmi_enter();
>  
>   nmi_enter();
> - nmi_count(cpu)++;
> + this_cpu_inc(irq_stat.__nmi_count);
>  
>   switch (notify_die(DIE_NMI, "NMI", regs, 0, vec & 0xff, SIGINT)) {
>   case NOTIFY_OK:
> 

Just booted my SH7785LCR board with a kernel based on Linus' latest tree
and can confirm that this change does not cause any regressions.

Adrian

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaub...@debian.org
`. `'   Freie Universitaet Berlin - glaub...@physik.fu-berlin.de
  `-GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913



  1   2   >