[GIT PULL 3/3] ARM: samsung: mach/soc pull for v5.13

2021-04-06 Thread Krzysztof Kozlowski
From: Krzysztof Kozlowski 

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
tags/samsung-soc-5.13

for you to fetch changes up to 6031008780efaada18087eba7ec84fe149f124a9:

  ARM: exynos: correct kernel doc in platsmp (2021-04-06 22:30:02 +0200)


Samsung mach/soc changes for v5.13

1. Update Krzysztof Kozlowski's email address in Maintainers.
2. Replace deprecated pwm_request() with pwm_get() in S3C24xx.
3. Correct kerneldoc.


Krzysztof Kozlowski (2):
  MAINTAINERS: use Krzysztof Kozlowski's Canonical address
  ARM: exynos: correct kernel doc in platsmp

Uwe Kleine-König (1):
  ARM: s3c: Use pwm_get() in favour of pwm_request() in RX1950

 MAINTAINERS | 24 
 arch/arm/mach-exynos/platsmp.c  | 28 +---
 arch/arm/mach-s3c/mach-rx1950.c | 11 ++-
 3 files changed, 31 insertions(+), 32 deletions(-)


[GIT PULL 2/3] arm64: dts: exynos: Pull for v5.13

2021-04-06 Thread Krzysztof Kozlowski
From: Krzysztof Kozlowski 

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
tags/samsung-dt64-5.13

for you to fetch changes up to 7d2636e9d6dd884ae2ec6127f29963d4da0dfe6e:

  arm64: dts: exynos: white-space cleanups (2021-03-19 11:34:55 +0100)


Samsung DTS ARM64 changes for v5.13

Two cleanups in DTS without expected impact.


Krzysztof Kozlowski (2):
  arm64: dts: exynos: re-order Slim SSS clocks to match dtschema
  arm64: dts: exynos: white-space cleanups

 arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi | 2 +-
 arch/arm64/boot/dts/exynos/exynos5433.dtsi| 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)


[GIT PULL 1/3] ARM: dts: samsung: Pull for v5.13

2021-04-06 Thread Krzysztof Kozlowski
From: Krzysztof Kozlowski 

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
tags/samsung-dt-5.13

for you to fetch changes up to 7f4ebf3e4ce10a1ed8ff2aee5d75568dc3522b2f:

  ARM: dts: exynos: Add front camera support to I9100 (2021-03-28 20:10:09 
+0200)


Samsung DTS ARM changes for v5.13

1. Configure battery charger and front camera on GT-I9100 phone.
2. Fix in several boards the Maxim PMIC/MUIC/fuel gauge interrupt flags
   to match real type of interrupt coming from the device.
3. Correct DTS with dtschema.  This brings back the commit adding input
   clock to CMU in Exynos4412 Odroid which was reverted some time ago
   due to unsupported deferred probes (now supported and tested).


Krzysztof Kozlowski (13):
  ARM: dts: exynos: correct fuel gauge interrupt trigger level on GT-I9100
  ARM: dts: exynos: correct fuel gauge interrupt trigger level on P4 Note 
family
  ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas 
family
  ARM: dts: exynos: correct MUIC interrupt trigger level on Midas family
  ARM: dts: exynos: correct PMIC interrupt trigger level on Midas family
  ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid X/U3 
family
  ARM: dts: exynos: correct PMIC interrupt trigger level on P4 Note family
  ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250
  ARM: dts: exynos: correct PMIC interrupt trigger level on Snow
  ARM: dts: s5pv210: correct fuel gauge interrupt trigger level on 
Fascinate family
  ARM: dts: exynos: add input clock to CMU in Exynos4412 Odroid
  ARM: dts: exynos: replace deprecated NTC/Murata compatibles
  ARM: dts: exynos: white-space cleanups

Timon Baetz (2):
  ARM: dts: exynos: add charger supply for I9100
  ARM: dts: exynos: Add front camera support to I9100

 arch/arm/boot/dts/exynos3250-monk.dts   |  4 +-
 arch/arm/boot/dts/exynos3250-rinato.dts |  4 +-
 arch/arm/boot/dts/exynos4210-i9100.dts  | 56 -
 arch/arm/boot/dts/exynos4412-midas.dtsi |  6 +--
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi |  5 ++-
 arch/arm/boot/dts/exynos4412-odroidx.dts|  3 +-
 arch/arm/boot/dts/exynos4412-p4note.dtsi|  4 +-
 arch/arm/boot/dts/exynos4412-ppmu-common.dtsi   | 48 ++---
 arch/arm/boot/dts/exynos5250-smdk5250.dts   |  2 +-
 arch/arm/boot/dts/exynos5250-snow-common.dtsi   |  2 +-
 arch/arm/boot/dts/exynos5410-pinctrl.dtsi   | 28 ++---
 arch/arm/boot/dts/s5pv210-fascinate4g.dts   |  2 +-
 12 files changed, 110 insertions(+), 54 deletions(-)


Re: [PATCH v2 04/10] tty: tty_jobctrl: Fix coding style issues of block comments

2021-04-06 Thread Xiaofei Tan

Hi Jiri,

On 2021/4/7 13:26, Jiri Slaby wrote:

On 06. 04. 21, 13:24, Xiaofei Tan wrote:

Fix coding style issues of block comments, reported by checkpatch.pl.
Besides, do some expression optimization for the sentenses.

Signed-off-by: Xiaofei Tan 
---
  drivers/tty/tty_jobctrl.c | 16 ++--
  1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/tty_jobctrl.c b/drivers/tty/tty_jobctrl.c
index 86070f7..7003b6b 100644
--- a/drivers/tty/tty_jobctrl.c
+++ b/drivers/tty/tty_jobctrl.c
@@ -204,8 +204,10 @@ int tty_signal_session_leader(struct tty_struct
*tty, int exit_session)
  spin_lock_irq(&p->sighand->siglock);
  if (p->signal->tty == tty) {
  p->signal->tty = NULL;
-/* We defer the dereferences outside fo
-   the tasklist lock */
+/*
+ * We defer the dereferences outside of
+ * the tasklist lock period


:). No, I meant "period" as this punctuation mark: .



Oh, my misunderstanding. I will send v3 later. thanks. :)


+ */
  refs++;
  }
  if (!p->signal->leader) {
@@ -328,9 +330,11 @@ void disassociate_ctty(int on_exit)
   */
  void no_tty(void)
  {
-/* FIXME: Review locking here. The tty_lock never covered any race
-   between a new association and proc_clear_tty but possible we need
-   to protect against this anyway */
+/*
+ * FIXME: Review locking here. The tty_lock never covered any race
+ * between a new association and proc_clear_tty but possibly we need
+ * to protect against this period anyway


The same here.



Sure


+ */
  struct task_struct *tsk = current;
disassociate_ctty(0);
@@ -536,7 +540,7 @@ static int tiocgsid(struct tty_struct *tty, struct
tty_struct *real_tty, pid_t _
  /*
   * (tty == real_tty) is a cheap way of
   * testing if the tty is NOT a master pty.
-*/
+ */
  if (tty == real_tty && current->signal->tty != real_tty)
  return -ENOTTY;








Re: your mail

2021-04-06 Thread Manivannan Sadhasivam
On Thu, Apr 01, 2021 at 02:16:09PM -0700, Bhaumik Bhatt wrote:
> Subject: [PATCH v8 0/9] Updates to MHI channel handling
> 

Subject is present in the body ;)

> MHI specification shows a state machine with support for STOP channel command
> and the validity of certain state transitions. MHI host currently does not
> provide any mechanism to stop a channel and restart it without resetting it.
> There are also times when the device moves on to a different execution
> environment while client drivers on the host are unaware of it and still
> attempt to reset the channels facing unnecessary timeouts.
> 
> This series addresses the above areas to provide support for stopping an MHI
> channel, resuming it back, improved documentation and improving upon channel
> state machine handling in general.
> 
> This set of patches was tested on arm64 and x86_64 architecture.
> 

Series applied to mhi-next!

Thanks,
Mani

> v8:
> -Split the state machine improvements patch to three patches as per review
> 
> v7:
> -Tested on x86_64 architecture
> -Drop the patch "Do not clear channel context more than once" as issue is 
> fixed
> differently using "bus: mhi: core: Fix double dma free()"
> -Update the commit text to better reflect changes on state machine 
> improvements
> 
> v6:
> -Dropped the patch which introduced start/stop transfer APIs for lack of users
> -Updated error handling and debug prints on channel handling improvements 
> patch
> -Improved commit text to better explain certain patches based on review 
> comments
> -Removed references to new APIs from the documentation improvement patch
> 
> v5:
> -Added reviewed-by tags from Hemant I missed earlier
> -Added patch to prevent kernel warnings on clearing channel context twice
> 
> v4:
> -Updated commit text/descriptions and addressed checkpatch checks
> -Added context validity check before starting/stopping channels from new API
> -Added patch to clear channel context configuration after reset/unprepare
> 
> v3:
> -Updated documentation for channel transfer APIs to highlight differences
> -Create separate patch for "allowing channel to be disabled from stopped 
> state"
> 
> v2:
> -Renamed the newly introduced APIs to mhi_start_transfer() / 
> mhi_stop_transfer()
> -Added improved documentation to avoid confusion with the new APIs
> -Removed the __ prefix from mhi_unprepare_channel() API for consistency.
> 
> Bhaumik Bhatt (9):
>   bus: mhi: core: Allow sending the STOP channel command
>   bus: mhi: core: Clear context for stopped channels from remove()
>   bus: mhi: core: Improvements to the channel handling state machine
>   bus: mhi: core: Update debug messages to use client device
>   bus: mhi: core: Hold device wake for channel update commands
>   bus: mhi: core: Clear configuration from channel context during reset
>   bus: mhi: core: Check channel execution environment before issuing
> reset
>   bus: mhi: core: Remove __ prefix for MHI channel unprepare function
>   bus: mhi: Improve documentation on channel transfer setup APIs
> 
>  drivers/bus/mhi/core/init.c |  22 -
>  drivers/bus/mhi/core/internal.h |  12 +++
>  drivers/bus/mhi/core/main.c | 190 
> 
>  include/linux/mhi.h |  18 +++-
>  4 files changed, 162 insertions(+), 80 deletions(-)
> 
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


[PATCH v6 4/4] usb: typec: Link all ports during connector registration

2021-04-06 Thread Heikki Krogerus
The connectors may be registered after the ports, so the
"connector" links need to be created for the ports also when
ever a new connector gets registered.

Signed-off-by: Heikki Krogerus 
---
 drivers/usb/typec/class.c   |  9 +++--
 drivers/usb/typec/class.h   |  4 +--
 drivers/usb/typec/port-mapper.c | 62 +++--
 3 files changed, 68 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index ff199e2d26c7b..f1c2d823c6509 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -1601,7 +1601,6 @@ static void typec_release(struct device *dev)
ida_destroy(&port->mode_ids);
typec_switch_put(port->sw);
typec_mux_put(port->mux);
-   free_pld(port->pld);
kfree(port->cap);
kfree(port);
 }
@@ -2027,7 +2026,9 @@ struct typec_port *typec_register_port(struct device 
*parent,
return ERR_PTR(ret);
}
 
-   port->pld = get_pld(&port->dev);
+   ret = typec_link_ports(port);
+   if (ret)
+   dev_warn(&port->dev, "failed to create symlinks (%d)\n", ret);
 
return port;
 }
@@ -2041,8 +2042,10 @@ EXPORT_SYMBOL_GPL(typec_register_port);
  */
 void typec_unregister_port(struct typec_port *port)
 {
-   if (!IS_ERR_OR_NULL(port))
+   if (!IS_ERR_OR_NULL(port)) {
+   typec_unlink_ports(port);
device_unregister(&port->dev);
+   }
 }
 EXPORT_SYMBOL_GPL(typec_unregister_port);
 
diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h
index 52294f7020a8b..aef03eb7e1523 100644
--- a/drivers/usb/typec/class.h
+++ b/drivers/usb/typec/class.h
@@ -79,7 +79,7 @@ extern const struct device_type typec_port_dev_type;
 extern struct class typec_mux_class;
 extern struct class typec_class;
 
-void *get_pld(struct device *dev);
-void free_pld(void *pld);
+int typec_link_ports(struct typec_port *connector);
+void typec_unlink_ports(struct typec_port *connector);
 
 #endif /* __USB_TYPEC_CLASS__ */
diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c
index 5bee7a97242fe..fae736eb0601e 100644
--- a/drivers/usb/typec/port-mapper.c
+++ b/drivers/usb/typec/port-mapper.c
@@ -34,7 +34,7 @@ static int acpi_pld_match(const struct acpi_pld_info *pld1,
return 0;
 }
 
-void *get_pld(struct device *dev)
+static void *get_pld(struct device *dev)
 {
 #ifdef CONFIG_ACPI
struct acpi_pld_info *pld;
@@ -53,7 +53,7 @@ void *get_pld(struct device *dev)
 #endif
 }
 
-void free_pld(void *pld)
+static void free_pld(void *pld)
 {
 #ifdef CONFIG_ACPI
ACPI_FREE(pld);
@@ -217,3 +217,61 @@ void typec_unlink_port(struct device *port)
class_for_each_device(&typec_class, NULL, port, port_match_and_unlink);
 }
 EXPORT_SYMBOL_GPL(typec_unlink_port);
+
+static int each_port(struct device *port, void *connector)
+{
+   struct port_node *node;
+   int ret;
+
+   node = create_port_node(port);
+   if (IS_ERR(node))
+   return PTR_ERR(node);
+
+   if (!connector_match(connector, node)) {
+   remove_port_node(node);
+   return 0;
+   }
+
+   ret = link_port(to_typec_port(connector), node);
+   if (ret) {
+   remove_port_node(node->pld);
+   return ret;
+   }
+
+   get_device(connector);
+
+   return 0;
+}
+
+int typec_link_ports(struct typec_port *con)
+{
+   int ret = 0;
+
+   con->pld = get_pld(&con->dev);
+   if (!con->pld)
+   return 0;
+
+   ret = usb_for_each_port(&con->dev, each_port);
+   if (ret)
+   typec_unlink_ports(con);
+
+   return ret;
+}
+
+void typec_unlink_ports(struct typec_port *con)
+{
+   struct port_node *node;
+   struct port_node *tmp;
+
+   mutex_lock(&con->port_list_lock);
+
+   list_for_each_entry_safe(node, tmp, &con->port_list, list) {
+   __unlink_port(con, node);
+   remove_port_node(node);
+   put_device(&con->dev);
+   }
+
+   mutex_unlock(&con->port_list_lock);
+
+   free_pld(con->pld);
+}
-- 
2.30.2



[PATCH v6 3/4] usb: Iterator for ports

2021-04-06 Thread Heikki Krogerus
Introducing usb_for_each_port(). It works the same way as
usb_for_each_dev(), but instead of going through every USB
device in the system, it walks through the USB ports in the
system.

Acked-by: Alan Stern 
Signed-off-by: Heikki Krogerus 
---
 drivers/usb/core/usb.c | 46 ++
 include/linux/usb.h|  9 +
 2 files changed, 55 insertions(+)

diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
index 2ce3667ec6fae..62368c4ed37af 100644
--- a/drivers/usb/core/usb.c
+++ b/drivers/usb/core/usb.c
@@ -398,6 +398,52 @@ int usb_for_each_dev(void *data, int (*fn)(struct 
usb_device *, void *))
 }
 EXPORT_SYMBOL_GPL(usb_for_each_dev);
 
+struct each_hub_arg {
+   void *data;
+   int (*fn)(struct device *, void *);
+};
+
+static int __each_hub(struct usb_device *hdev, void *data)
+{
+   struct each_hub_arg *arg = (struct each_hub_arg *)data;
+   struct usb_hub *hub;
+   int ret = 0;
+   int i;
+
+   hub = usb_hub_to_struct_hub(hdev);
+   if (!hub)
+   return 0;
+
+   mutex_lock(&usb_port_peer_mutex);
+
+   for (i = 0; i < hdev->maxchild; i++) {
+   ret = arg->fn(&hub->ports[i]->dev, arg->data);
+   if (ret)
+   break;
+   }
+
+   mutex_unlock(&usb_port_peer_mutex);
+
+   return ret;
+}
+
+/**
+ * usb_for_each_port - interate over all USB ports in the system
+ * @data: data pointer that will be handed to the callback function
+ * @fn: callback function to be called for each USB port
+ *
+ * Iterate over all USB ports and call @fn for each, passing it @data. If it
+ * returns anything other than 0, we break the iteration prematurely and return
+ * that value.
+ */
+int usb_for_each_port(void *data, int (*fn)(struct device *, void *))
+{
+   struct each_hub_arg arg = {data, fn};
+
+   return usb_for_each_dev(&arg, __each_hub);
+}
+EXPORT_SYMBOL_GPL(usb_for_each_port);
+
 /**
  * usb_release_dev - free a usb device structure when all users of it are 
finished.
  * @dev: device that's been disconnected
diff --git a/include/linux/usb.h b/include/linux/usb.h
index ddd2f5b2a2827..eaae24217e8a2 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -882,6 +882,15 @@ extern struct usb_host_interface *usb_find_alt_setting(
unsigned int iface_num,
unsigned int alt_num);
 
+#if IS_REACHABLE(CONFIG_USB)
+int usb_for_each_port(void *data, int (*fn)(struct device *, void *));
+#else
+static inline int usb_for_each_port(void *data, int (*fn)(struct device *, 
void *))
+{
+   return 0;
+}
+#endif
+
 /* port claiming functions */
 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1,
struct usb_dev_state *owner);
-- 
2.30.2



[PATCH v6 2/4] usb: Link the ports to the connectors they are attached to

2021-04-06 Thread Heikki Krogerus
Creating link to the USB Type-C connector for every new port
that is added when possible.

Signed-off-by: Heikki Krogerus 
---
 Documentation/ABI/testing/sysfs-bus-usb | 9 +
 drivers/usb/core/port.c | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-bus-usb 
b/Documentation/ABI/testing/sysfs-bus-usb
index bf2c1968525f0..8b4303a0ff51d 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -255,6 +255,15 @@ Description:
is permitted, "u2" if only u2 is permitted, "u1_u2" if both u1 
and
u2 are permitted.
 
+What:  /sys/bus/usb/devices/.../(hub interface)/portX/connector
+Date:  April 2021
+Contact:   Heikki Krogerus 
+Description:
+   Link to the USB Type-C connector when available. This link is
+   only created when USB Type-C Connector Class is enabled, and
+   only if the system firmware is capable of describing the
+   connection between a port and its connector.
+
 What:  /sys/bus/usb/devices/.../power/usb2_lpm_l1_timeout
 Date:  May 2013
 Contact:   Mathias Nyman 
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index dfcca9c876c73..3c382a4b648ec 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -9,6 +9,7 @@
 
 #include 
 #include 
+#include 
 
 #include "hub.h"
 
@@ -576,6 +577,7 @@ int usb_hub_create_port_device(struct usb_hub *hub, int 
port1)
}
 
find_and_link_peer(hub, port1);
+   typec_link_port(&port_dev->dev);
 
/*
 * Enable runtime pm and hold a refernce that hub_configure()
@@ -619,5 +621,6 @@ void usb_hub_remove_port_device(struct usb_hub *hub, int 
port1)
peer = port_dev->peer;
if (peer)
unlink_peers(port_dev, peer);
+   typec_unlink_port(&port_dev->dev);
device_unregister(&port_dev->dev);
 }
-- 
2.30.2



[PATCH v6 1/4] usb: typec: Port mapping utility

2021-04-06 Thread Heikki Krogerus
Adding functions that can be used to link/unlink ports -
USB ports, TBT3/USB4 ports, DisplayPorts and so on - to
the USB Type-C connectors they are attached to inside a
system. The symlink that is created for the port device is
named "connector".

Initially only ACPI is supported. ACPI port object shares
the _PLD (Physical Location of Device) with the USB Type-C
connector that it's attached to.

Signed-off-by: Heikki Krogerus 
---
 drivers/usb/typec/Makefile  |   2 +-
 drivers/usb/typec/class.c   |   7 +-
 drivers/usb/typec/class.h   |   9 ++
 drivers/usb/typec/port-mapper.c | 219 
 include/linux/usb/typec.h   |  13 ++
 5 files changed, 248 insertions(+), 2 deletions(-)
 create mode 100644 drivers/usb/typec/port-mapper.c

diff --git a/drivers/usb/typec/Makefile b/drivers/usb/typec/Makefile
index 1fb8b6668b1ba..a0adb8947a301 100644
--- a/drivers/usb/typec/Makefile
+++ b/drivers/usb/typec/Makefile
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_TYPEC)+= typec.o
-typec-y:= class.o mux.o bus.o
+typec-y:= class.o mux.o bus.o port-mapper.o
 obj-$(CONFIG_TYPEC)+= altmodes/
 obj-$(CONFIG_TYPEC_TCPM)   += tcpm/
 obj-$(CONFIG_TYPEC_UCSI)   += ucsi/
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index d3e1002386357..ff199e2d26c7b 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -18,7 +18,7 @@
 
 static DEFINE_IDA(typec_index_ida);
 
-static struct class typec_class = {
+struct class typec_class = {
.name = "typec",
.owner = THIS_MODULE,
 };
@@ -1601,6 +1601,7 @@ static void typec_release(struct device *dev)
ida_destroy(&port->mode_ids);
typec_switch_put(port->sw);
typec_mux_put(port->mux);
+   free_pld(port->pld);
kfree(port->cap);
kfree(port);
 }
@@ -1983,6 +1984,8 @@ struct typec_port *typec_register_port(struct device 
*parent,
 
ida_init(&port->mode_ids);
mutex_init(&port->port_type_lock);
+   mutex_init(&port->port_list_lock);
+   INIT_LIST_HEAD(&port->port_list);
 
port->id = id;
port->ops = cap->ops;
@@ -2024,6 +2027,8 @@ struct typec_port *typec_register_port(struct device 
*parent,
return ERR_PTR(ret);
}
 
+   port->pld = get_pld(&port->dev);
+
return port;
 }
 EXPORT_SYMBOL_GPL(typec_register_port);
diff --git a/drivers/usb/typec/class.h b/drivers/usb/typec/class.h
index d414be58d122e..52294f7020a8b 100644
--- a/drivers/usb/typec/class.h
+++ b/drivers/usb/typec/class.h
@@ -54,6 +54,11 @@ struct typec_port {
 
const struct typec_capability   *cap;
const struct typec_operations   *ops;
+
+   struct list_headport_list;
+   struct mutexport_list_lock; /* Port list lock */
+
+   void*pld;
 };
 
 #define to_typec_port(_dev_) container_of(_dev_, struct typec_port, dev)
@@ -72,5 +77,9 @@ extern const struct device_type typec_port_dev_type;
 #define is_typec_port(dev) ((dev)->type == &typec_port_dev_type)
 
 extern struct class typec_mux_class;
+extern struct class typec_class;
+
+void *get_pld(struct device *dev);
+void free_pld(void *pld);
 
 #endif /* __USB_TYPEC_CLASS__ */
diff --git a/drivers/usb/typec/port-mapper.c b/drivers/usb/typec/port-mapper.c
new file mode 100644
index 0..5bee7a97242fe
--- /dev/null
+++ b/drivers/usb/typec/port-mapper.c
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * USB Type-C Connector Class Port Mapping Utility
+ *
+ * Copyright (C) 2021, Intel Corporation
+ * Author: Heikki Krogerus 
+ */
+
+#include 
+#include 
+#include 
+
+#include "class.h"
+
+struct port_node {
+   struct list_head list;
+   struct device *dev;
+   void *pld;
+};
+
+static int acpi_pld_match(const struct acpi_pld_info *pld1,
+ const struct acpi_pld_info *pld2)
+{
+   if (!pld1 || !pld2)
+   return 0;
+
+   /*
+* To speed things up, first checking only the group_position. It seems
+* to often have the first unique value in the _PLD.
+*/
+   if (pld1->group_position == pld2->group_position)
+   return !memcmp(pld1, pld2, sizeof(struct acpi_pld_info));
+
+   return 0;
+}
+
+void *get_pld(struct device *dev)
+{
+#ifdef CONFIG_ACPI
+   struct acpi_pld_info *pld;
+   acpi_status status;
+
+   if (!has_acpi_companion(dev))
+   return NULL;
+
+   status = acpi_get_physical_device_location(ACPI_HANDLE(dev), &pld);
+   if (ACPI_FAILURE(status))
+   return NULL;
+
+   return pld;
+#else
+   return NULL;
+#endif
+}
+
+void free_pld(void *pld)
+{
+#ifdef CONFIG_ACPI
+   ACPI_FREE(pld);
+#endif
+}
+
+static int __link_port(struct typec_port *con, struct port_node *node)
+{
+   int ret;
+
+   ret = sysfs_create_l

[PATCH v6 0/4] usb: Linking ports to their Type-C connectors

2021-04-06 Thread Heikki Krogerus
Hi,

These are the remaining four patches of the series, now rebased on top
of the latest usb-next. No other changes.


v5 cover letter:

I have to use IS_REACHABLE() instead of IS_ENABLED() also in
include/linux/usb.h. Otherwise compilation will fail if the Type-C
class is build-in while USB is a module.

I'm sorry for re-sending these so fast, immediately after v4. Normally
I would wait, but I'll be taking a short vacation starting from right
now, and I'm still hoping to get these into v5.13.


v4 cover letter:

One more version. I used #ifdef when I should have used #if
IS_DEFINED(). Thanks Guenter for pointing that out.

I'm sending this version right away because of the holidays. I'm not
changing anything else except that one fix.


v3: cover letter:

Third version: ifdefs now in the header files as they should be.


v2 cover letter:

This is the second version of this series. The "Iterator for ports"
patch is now moved to the end of the series (5/6).

I'm now using usb_for_each_dev() in usb_for_each_port like Alan
suggested, and I'm now using usb_port_peer_mutex to lock the ports
while we're dealing with them in __each_hub().


The original cover letter:

Adding a simple function typec_link_port() that can be used to create
a symlink "connector" that points to the USB Type-C connector of a
port. It is used with USB ports initially, but hopefully later also
with other things like DisplayPorts.

Being able to see which connector is connected to a port is important
in general, but it is really important when for example the data or
power role of a device needs to swapped. The user probable wants to
know which USB device is disconnected if role swap on a USB Type-C
connector is executed.

Hope these are OK.

thanks,

Heikki Krogerus (4):
  usb: typec: Port mapping utility
  usb: Link the ports to the connectors they are attached to
  usb: Iterator for ports
  usb: typec: Link all ports during connector registration

 Documentation/ABI/testing/sysfs-bus-usb |   9 +
 drivers/usb/core/port.c |   3 +
 drivers/usb/core/usb.c  |  46 
 drivers/usb/typec/Makefile  |   2 +-
 drivers/usb/typec/class.c   |  12 +-
 drivers/usb/typec/class.h   |   9 +
 drivers/usb/typec/port-mapper.c | 277 
 include/linux/usb.h |   9 +
 include/linux/usb/typec.h   |  13 ++
 9 files changed, 377 insertions(+), 3 deletions(-)
 create mode 100644 drivers/usb/typec/port-mapper.c

-- 
2.30.2



[PATCH] ASoC: codecs: Fix rumtime PM imbalance in tas2552_probe

2021-04-06 Thread Dinghao Liu
There is a rumtime PM imbalance between the error handling path
after devm_snd_soc_register_component() and all other error
handling paths. Fix this by moving PM runtime decrement to the
end of the function.

Signed-off-by: Dinghao Liu 
---
 sound/soc/codecs/tas2552.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
index bd00c35116cd..52de6f7b4227 100644
--- a/sound/soc/codecs/tas2552.c
+++ b/sound/soc/codecs/tas2552.c
@@ -718,13 +718,6 @@ static int tas2552_probe(struct i2c_client *client,
return ret;
}
 
-   pm_runtime_set_active(&client->dev);
-   pm_runtime_set_autosuspend_delay(&client->dev, 1000);
-   pm_runtime_use_autosuspend(&client->dev);
-   pm_runtime_enable(&client->dev);
-   pm_runtime_mark_last_busy(&client->dev);
-   pm_runtime_put_sync_autosuspend(&client->dev);
-
dev_set_drvdata(&client->dev, data);
 
ret = devm_snd_soc_register_component(&client->dev,
@@ -733,6 +726,13 @@ static int tas2552_probe(struct i2c_client *client,
if (ret < 0)
dev_err(&client->dev, "Failed to register component: %d\n", 
ret);
 
+   pm_runtime_set_active(&client->dev);
+   pm_runtime_set_autosuspend_delay(&client->dev, 1000);
+   pm_runtime_use_autosuspend(&client->dev);
+   pm_runtime_enable(&client->dev);
+   pm_runtime_mark_last_busy(&client->dev);
+   pm_runtime_put_sync_autosuspend(&client->dev);
+
return ret;
 }
 
-- 
2.17.1



[PATCH -next] tools/testing/nvdimm: Make symbol '__nfit_test_ioremap' static

2021-04-06 Thread Zou Wei
The sparse tool complains as follows:

tools/testing/nvdimm/test/iomap.c:65:14: warning:
 symbol '__nfit_test_ioremap' was not declared. Should it be static?

This symbol is not used outside of security.c, so this
commit marks it static.

Reported-by: Hulk Robot 
Signed-off-by: Zou Wei 
---
 tools/testing/nvdimm/test/iomap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/nvdimm/test/iomap.c 
b/tools/testing/nvdimm/test/iomap.c
index c62d372..ed563bd 100644
--- a/tools/testing/nvdimm/test/iomap.c
+++ b/tools/testing/nvdimm/test/iomap.c
@@ -62,7 +62,7 @@ struct nfit_test_resource *get_nfit_res(resource_size_t 
resource)
 }
 EXPORT_SYMBOL(get_nfit_res);
 
-void __iomem *__nfit_test_ioremap(resource_size_t offset, unsigned long size,
+static void __iomem *__nfit_test_ioremap(resource_size_t offset, unsigned long 
size,
void __iomem *(*fallback_fn)(resource_size_t, unsigned long))
 {
struct nfit_test_resource *nfit_res = get_nfit_res(offset);
-- 
2.6.2



Re: [PATCH] bus: mhi: pci_generic: Add SDX65 based modem support

2021-04-06 Thread Manivannan Sadhasivam
On Fri, Apr 02, 2021 at 02:33:19PM -0700, Bhaumik Bhatt wrote:
> Add generic info for SDX65 based modems.
> 
> Signed-off-by: Bhaumik Bhatt 

Applied to mhi-next!

Thanks,
Mani

> ---
> This patch was tested on SDX65 hardware with Ubuntu X86_64 PC as host.
> 
>  drivers/bus/mhi/pci_generic.c | 11 +++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c
> index 5cf44bc..92a1b18 100644
> --- a/drivers/bus/mhi/pci_generic.c
> +++ b/drivers/bus/mhi/pci_generic.c
> @@ -204,6 +204,15 @@ static struct mhi_controller_config 
> modem_qcom_v1_mhiv_config = {
>   .event_cfg = modem_qcom_v1_mhi_events,
>  };
>  
> +static const struct mhi_pci_dev_info mhi_qcom_sdx65_info = {
> + .name = "qcom-sdx65m",
> + .fw = "qcom/sdx65m/xbl.elf",
> + .edl = "qcom/sdx65m/edl.mbn",
> + .config = &modem_qcom_v1_mhiv_config,
> + .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
> + .dma_data_width = 32
> +};
> +
>  static const struct mhi_pci_dev_info mhi_qcom_sdx55_info = {
>   .name = "qcom-sdx55m",
>   .fw = "qcom/sdx55m/sbl1.mbn",
> @@ -261,6 +270,8 @@ static const struct mhi_pci_dev_info 
> mhi_quectel_em1xx_info = {
>  };
>  
>  static const struct pci_device_id mhi_pci_id_table[] = {
> + { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0308),
> + .driver_data = (kernel_ulong_t) &mhi_qcom_sdx65_info },
>   { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306),
>   .driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info },
>   { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0304),
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


RE: [PATCH v4] platform/x86: intel_pmc_core: export platform global_reset via sysfs.

2021-04-06 Thread Winkler, Tomas
> >
> > During PCH (platform/board) manufacturing process a global reset has
> > to be induced in order for configuration changes take the effect upon
> > following platform reset.
> > This setting was commonly done by accessing PMC registers via /dev/mem
> > but due to security concern /dev/mem access is much restricted, hence
> > the reason for exposing this setting via dedicated sysfs interface.
> > To prevent post manufacturing abuse the register is protected by
> > hardware locking.
> 
> The purpose of this reset functionality is not entirely clear to me.
> 
> Is this only used during production of a board? Or is this also something
> which a user/reseller may use as part of a factory-reset procedure?

Board production and refurbishing of the board. I can try to rephrase but I 
thought all the info is in the commit message. 
As a runtime feature a user can check that her/his platform is correctly 
sealed. 
> 
> If this is only used once during production, then I'm not sure if introducing 
> a
> sysfs file for this is desirable.

What do you suggest, than?  I'm just guessing is where are you heading so the 
answer is that the manufacturing
is often already run on the production OS installation,  w/o going into details 
swapping or reconfiguring the OS is not always an option.
The manufacturer is also a user of ours.

> 
> Can you please provide a new version where the purpsoe of the newly
> introduced sysfs file is made more clear, both in the commit-msg as well as in
> the:
Okay I can do that.
> 
> Documentation/ABI/testing/sysfs-platform-intel-pmc
> 
> File ?
> 
> Regards,
> 
> Hans
> 
> 
> 
> >
> > The register in MMIO space is defined for Cannon Lake and newer PCHs.
> >
> > Cc: David E Box 
> > Reviewed-by: Andy Shevchenko 
> > Signed-off-by: Tamar Mashiah 
> > Signed-off-by: Tomas Winkler 
> > ---
> > 2:
> > 1. Add locking for reading the ET3 register  (Andy) 2. Fix few style
> > issues (Andy)
> > V3:
> > 1. Resend
> > v4:
> > 1. Fix return statement (Andy)
> > 2. Specify manufacturing process (Enrico)
> >
> >  .../ABI/testing/sysfs-platform-intel-pmc  | 11 +++
> >  MAINTAINERS   |  1 +
> >  drivers/platform/x86/intel_pmc_core.c | 97 +++
> >  drivers/platform/x86/intel_pmc_core.h |  6 ++
> >  4 files changed, 115 insertions(+)
> >  create mode 100644 Documentation/ABI/testing/sysfs-platform-intel-pmc
> >
> > diff --git a/Documentation/ABI/testing/sysfs-platform-intel-pmc
> > b/Documentation/ABI/testing/sysfs-platform-intel-pmc
> > new file mode 100644
> > index ..7ce00e77fbcd
> > --- /dev/null
> > +++ b/Documentation/ABI/testing/sysfs-platform-intel-pmc
> > @@ -0,0 +1,11 @@
> > +What:  /sys/devices/platform//global_reset
> > +Date:  Apr 2021
> > +KernelVersion: 5.13
> > +Contact:   "Tomas Winkler" 
> > +Description:
> > +   Display global reset setting bits for PMC.
> > +   * bit 31 - global reset is locked
> > +   * bit 20 - global reset is set
> > +   Writing bit 20 value to the global_reset will induce
> > +   a platform global reset upon consequent platform reset.
> > +   in case the register is not locked.
> > diff --git a/MAINTAINERS b/MAINTAINERS index
> > 04f68e0cda64..618676eba8c8 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -9166,6 +9166,7 @@ M:Rajneesh Bhardwaj
> 
> >  M: David E Box 
> >  L: platform-driver-...@vger.kernel.org
> >  S: Maintained
> > +F: Documentation/ABI/testing/sysfs-platform-intel-pmc
> >  F: drivers/platform/x86/intel_pmc_core*
> >
> >  INTEL PMIC GPIO DRIVERS
> > diff --git a/drivers/platform/x86/intel_pmc_core.c
> > b/drivers/platform/x86/intel_pmc_core.c
> > index ee2f757515b0..8afc198550a4 100644
> > --- a/drivers/platform/x86/intel_pmc_core.c
> > +++ b/drivers/platform/x86/intel_pmc_core.c
> > @@ -401,6 +401,7 @@ static const struct pmc_reg_map cnp_reg_map = {
> > .pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
> > .pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
> > .ltr_ignore_max = CNP_NUM_IP_IGN_ALLOWED,
> > +   .etr3_offset = ETR3_OFFSET,
> >  };
> >
> >  static const struct pmc_reg_map icl_reg_map = { @@ -418,6 +419,7 @@
> > static const struct pmc_reg_map icl_reg_map = {
> > .pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
> > .pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
> > .ltr_ignore_max = ICL_NUM_IP_IGN_ALLOWED,
> > +   .etr3_offset = ETR3_OFFSET,
> >  };
> >
> >  static const struct pmc_bit_map tgl_clocksource_status_map[] = { @@
> > -585,6 +587,7 @@ static const struct pmc_reg_map tgl_reg_map = {
> > .lpm_sts = tgl_lpm_maps,
> > .lpm_status_offset = TGL_LPM_STATUS_OFFSET,
> > .lpm_live_status_offset = TGL_LPM_LIVE_STATUS_OFFSET,
> > +   .etr3_offset = ETR3_OFFSET,
> >  };
> >
> >  static inline u32 pmc_core_reg_read(struct pmc_dev *pmcdev, int
> > reg_offset) @@ -603,6 +606,99 @@ static inline u64
> pmc_core_adjust_slp_s0_step(struct pmc_de

Re: [RESEND PATCH] bus: mhi: core: Remove pre_init flag used for power purposes

2021-04-06 Thread Manivannan Sadhasivam
On Thu, Apr 01, 2021 at 02:41:49PM -0700, Bhaumik Bhatt wrote:
> Some controllers can choose to skip preparation for power up.
> In that case, device context is initialized based on the pre_init
> flag not being set during mhi_prepare_for_power_up(). There is no
> reason MHI host driver should maintain and provide controllers
> with two separate paths for preparing MHI.
> 
> Going forward, all controllers will be required to call the
> mhi_prepare_for_power_up() API followed by their choice of sync
> or async power up. This allows MHI host driver to get rid of the
> pre_init flag and sets up a common way for all controllers to use
> MHI. This also helps controllers fail early on during preparation
> phase in some failure cases.
> 
> Signed-off-by: Bhaumik Bhatt 

Applied to mhi-next!

Thanks,
Mani

> ---
> This patch was tested on arm64 architecture.
> 
>  drivers/bus/mhi/core/init.c |  3 ---
>  drivers/bus/mhi/core/pm.c   | 20 
>  include/linux/mhi.h |  2 --
>  3 files changed, 25 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index d1d9b0d..1f61352 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -1080,8 +1080,6 @@ int mhi_prepare_for_power_up(struct mhi_controller 
> *mhi_cntrl)
>   mhi_rddm_prepare(mhi_cntrl, mhi_cntrl->rddm_image);
>   }
>  
> - mhi_cntrl->pre_init = true;
> -
>   mutex_unlock(&mhi_cntrl->pm_mutex);
>  
>   return 0;
> @@ -1112,7 +1110,6 @@ void mhi_unprepare_after_power_down(struct 
> mhi_controller *mhi_cntrl)
>   }
>  
>   mhi_deinit_dev_ctxt(mhi_cntrl);
> - mhi_cntrl->pre_init = false;
>  }
>  EXPORT_SYMBOL_GPL(mhi_unprepare_after_power_down);
>  
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index e4aff77..b23eec5 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -1062,13 +1062,6 @@ int mhi_async_power_up(struct mhi_controller 
> *mhi_cntrl)
>   mutex_lock(&mhi_cntrl->pm_mutex);
>   mhi_cntrl->pm_state = MHI_PM_DISABLE;
>  
> - if (!mhi_cntrl->pre_init) {
> - /* Setup device context */
> - ret = mhi_init_dev_ctxt(mhi_cntrl);
> - if (ret)
> - goto error_dev_ctxt;
> - }
> -
>   ret = mhi_init_irq_setup(mhi_cntrl);
>   if (ret)
>   goto error_setup_irq;
> @@ -1150,10 +1143,6 @@ int mhi_async_power_up(struct mhi_controller 
> *mhi_cntrl)
>   mhi_deinit_free_irq(mhi_cntrl);
>  
>  error_setup_irq:
> - if (!mhi_cntrl->pre_init)
> - mhi_deinit_dev_ctxt(mhi_cntrl);
> -
> -error_dev_ctxt:
>   mhi_cntrl->pm_state = MHI_PM_DISABLE;
>   mutex_unlock(&mhi_cntrl->pm_mutex);
>  
> @@ -1203,15 +1192,6 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, 
> bool graceful)
>   flush_work(&mhi_cntrl->st_worker);
>  
>   free_irq(mhi_cntrl->irq[0], mhi_cntrl);
> -
> - if (!mhi_cntrl->pre_init) {
> - /* Free all allocated resources */
> - if (mhi_cntrl->fbc_image) {
> - mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image);
> - mhi_cntrl->fbc_image = NULL;
> - }
> - mhi_deinit_dev_ctxt(mhi_cntrl);
> - }
>  }
>  EXPORT_SYMBOL_GPL(mhi_power_down);
>  
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index b16afd3..c9b36a3 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -354,7 +354,6 @@ struct mhi_controller_config {
>   * @index: Index of the MHI controller instance
>   * @bounce_buf: Use of bounce buffer
>   * @fbc_download: MHI host needs to do complete image transfer (optional)
> - * @pre_init: MHI host needs to do pre-initialization before power up
>   * @wake_set: Device wakeup set flag
>   * @irq_flags: irq flags passed to request_irq (optional)
>   *
> @@ -447,7 +446,6 @@ struct mhi_controller {
>   int index;
>   bool bounce_buf;
>   bool fbc_download;
> - bool pre_init;
>   bool wake_set;
>   unsigned long irq_flags;
>  };
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


Re: [PATCH 2/2] nvmem: qfprom: Add support for fuse blowing on sc7280

2021-04-06 Thread Rajendra Nayak



On 3/31/2021 2:49 AM, Doug Anderson wrote:

Hi,

On Wed, Mar 24, 2021 at 10:45 PM Rajendra Nayak  wrote:


@@ -111,6 +113,15 @@ static const struct qfprom_soc_compatible_data 
sc7180_qfprom = {
 .nkeepout = ARRAY_SIZE(sc7180_qfprom_keepout)
  };

+static const struct nvmem_keepout sc7280_qfprom_keepout[] = {
+   {.start = 0x128, .end = 0x148},
+   {.start = 0x238, .end = 0x248}
+};
+
+static const struct qfprom_soc_compatible_data sc7280_qfprom = {
+   .keepout = sc7280_qfprom_keepout,
+   .nkeepout = ARRAY_SIZE(sc7280_qfprom_keepout)
+};
  /**


nit: blank line between structure and comment?



@@ -187,9 +199,9 @@ static int qfprom_enable_fuse_blowing(const struct 
qfprom_priv *priv,
  * a rail shared do don't specify a max--regulator constraints
  * will handle.
  */
-   ret = regulator_set_voltage(priv->vcc, 180, INT_MAX);
+   ret = regulator_set_voltage(priv->vcc, qfprom_blow_uV, INT_MAX);
 if (ret) {
-   dev_err(priv->dev, "Failed to set 1.8 voltage\n");
+   dev_err(priv->dev, "Failed to set %duV\n", qfprom_blow_uV);


nit: the comment above this block (not in the unified diff)
specifically calls out 1.8V. It'd be nice if you updated the comment
since it's no longer fixed at 1.8V.



@@ -379,6 +399,8 @@ static int qfprom_probe(struct platform_device *pdev)

 if (major_version == 7 && minor_version == 8)
 priv->soc_data = &qfprom_7_8_data;
+   if (major_version == 7 && minor_version == 15)
+   priv->soc_data = &qfprom_7_15_data;


nit: "else if" instead of "if"?


I guess I'm a little late since I think this already got applied, but
all the above are nits. Maybe you could send a follow-up patch to
address them?


Thanks Doug for the review, yes, I'll send a follow-up patch since
Srini already has these pulled in.
 


--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


[PATCH] HID: i2c-hid: Skip ELAN power-on command after reset

2021-04-06 Thread Johnny Chuang
Previous commit 43b7029f475e ("HID: i2c-hid:
Send power-on command after reset"), it fixed issue for SIS touchscreen.

For ELAN touchscreen, we found our boot code of IC was not flexible enough
to receive and handle this command.
Once the FW main code of our controller is crashed for some reason,
the controller could not be enumerated successfully to be recognized
by the system host. therefore, it lost touch functionality.

Add quirk for skip send power-on command after reset.
It will impact to ELAN touchscreen and touchpad on HID over I2C projects.

Signed-off-by: Johnny Chuang 
---
 drivers/hid/i2c-hid/i2c-hid-core.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/i2c-hid/i2c-hid-core.c 
b/drivers/hid/i2c-hid/i2c-hid-core.c
index 9993133..6b407f7 100644
--- a/drivers/hid/i2c-hid/i2c-hid-core.c
+++ b/drivers/hid/i2c-hid/i2c-hid-core.c
@@ -45,6 +45,7 @@
 #define I2C_HID_QUIRK_BOGUS_IRQBIT(4)
 #define I2C_HID_QUIRK_RESET_ON_RESUME  BIT(5)
 #define I2C_HID_QUIRK_BAD_INPUT_SIZE   BIT(6)
+#define I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESETBIT(7)
 
 
 /* flags */
@@ -157,6 +158,10 @@ struct i2c_hid {
struct i2chid_ops   *ops;
 };
 
+/*
+ * Sending the wakeup after reset actually break ELAN touchscreen controller
+ * So add I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET to skip wakeup after reset
+ */
 static const struct i2c_hid_quirks {
__u16 idVendor;
__u16 idProduct;
@@ -178,6 +183,8 @@ static const struct i2c_hid_quirks {
 I2C_HID_QUIRK_RESET_ON_RESUME },
{ USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720,
I2C_HID_QUIRK_BAD_INPUT_SIZE },
+   { USB_VENDOR_ID_ELAN, HID_ANY_ID,
+I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET },
{ 0, 0 }
 };
 
@@ -461,7 +468,8 @@ static int i2c_hid_hwreset(struct i2c_client *client)
}
 
/* At least some SIS devices need this after reset */
-   ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
+   if (!(ihid->quirks & I2C_HID_QUIRK_NO_WAKEUP_AFTER_RESET))
+   ret = i2c_hid_set_power(client, I2C_HID_PWR_ON);
 
 out_unlock:
mutex_unlock(&ihid->reset_lock);
-- 
2.7.4



Re: [PATCH v5 3/6] usb: typec: Port mapping utility

2021-04-06 Thread Heikki Krogerus
On Mon, Apr 05, 2021 at 09:09:00AM +0200, Greg Kroah-Hartman wrote:
> On Thu, Apr 01, 2021 at 01:58:44PM +0300, Heikki Krogerus wrote:
> > Adding functions that can be used to link/unlink ports -
> > USB ports, TBT3/USB4 ports, DisplayPorts and so on - to
> > the USB Type-C connectors they are attached to inside a
> > system. The symlink that is created for the port device is
> > named "connector".
> > 
> > Initially only ACPI is supported. ACPI port object shares
> > the _PLD (Physical Location of Device) with the USB Type-C
> > connector that it's attached to.
> > 
> > Signed-off-by: Heikki Krogerus 
> > ---
> >  drivers/usb/typec/Makefile  |   2 +-
> >  drivers/usb/typec/class.c   |   7 +-
> >  drivers/usb/typec/class.h   |   9 ++
> >  drivers/usb/typec/port-mapper.c | 219 
> >  include/linux/usb/typec.h   |  13 ++
> >  5 files changed, 248 insertions(+), 2 deletions(-)
> >  create mode 100644 drivers/usb/typec/port-mapper.c
> 
> This patch failed to apply to my usb-next branch, so I stopped applying
> the patches here.  Can you rebase the rest when you resend?

Okay.

thanks,

-- 
heikki


Re: [PATCH] bus: mhi: pci_generic: Introduce Foxconn T99W175 support

2021-04-06 Thread Manivannan Sadhasivam
On Tue, Apr 06, 2021 at 07:50:29PM -0700, Jarvis Jiang wrote:
> Add support for T99W175 modems, this modem series is based on SDX55
> qcom chip. The modem is mainly based on MBIM protocol for both the
> data and control path.
> 

List the modems whose support is being added.

> This patch was tested with Ubuntu 20.04 X86_64 PC as host
> 
> Signed-off-by: Jarvis Jiang 
> ---
>  drivers/bus/mhi/pci_generic.c | 58 +++
>  1 file changed, 58 insertions(+)
> 
> diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c
> index 5cf44bcfe040..3e396c65a758 100644
> --- a/drivers/bus/mhi/pci_generic.c
> +++ b/drivers/bus/mhi/pci_generic.c
> @@ -260,6 +260,52 @@ static const struct mhi_pci_dev_info 
> mhi_quectel_em1xx_info = {
>   .dma_data_width = 32
>  };
>  
> +static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
> + MHI_CHANNEL_CONFIG_UL(0, "LOOPBACK", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(1, "LOOPBACK", 32, 0),
> + MHI_CHANNEL_CONFIG_UL(4, "DIAG", 32, 1),
> + MHI_CHANNEL_CONFIG_DL(5, "DIAG", 32, 1),
> + MHI_CHANNEL_CONFIG_UL(12, "MBIM", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(13, "MBIM", 32, 0),
> + MHI_CHANNEL_CONFIG_UL(14, "QMI", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(15, "QMI", 32, 0),
> + MHI_CHANNEL_CONFIG_UL(16, "QMI1", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(17, "QMI1", 32, 0),
> + MHI_CHANNEL_CONFIG_UL(18, "IP_CTRL", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(19, "IP_CTRL", 32, 0),
> + MHI_CHANNEL_CONFIG_UL(20, "IPCR", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(21, "IPCR", 32, 0),
> + MHI_CHANNEL_CONFIG_UL(32, "AT", 32, 0),
> + MHI_CHANNEL_CONFIG_DL(33, "AT", 32, 0),
> + MHI_CHANNEL_CONFIG_HW_UL(100, "IP_HW0_MBIM", 128, 2),
> + MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
> +};
> +
> +static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
> + MHI_EVENT_CONFIG_CTRL(0, 128),
> + MHI_EVENT_CONFIG_DATA(1, 128),
> + MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> + MHI_EVENT_CONFIG_HW_DATA(3, 1024, 101)
> +};
> +
> +static struct mhi_controller_config modem_foxconn_sdx55_config = {
> + .max_channels = 128,
> + .timeout_ms = 2,
> + .num_channels = ARRAY_SIZE(mhi_foxconn_sdx55_channels),
> + .ch_cfg = mhi_foxconn_sdx55_channels,
> + .num_events = ARRAY_SIZE(mhi_foxconn_sdx55_events),
> + .event_cfg = mhi_foxconn_sdx55_events,
> +};
> +
> +static const struct mhi_pci_dev_info mhi_foxconn_sdx55_info = {
> + .name = "foxconn-sdx55",
> + .fw = "qcom/sdx55m/sbl1.mbn",
> + .edl = "qcom/sdx55m/edl.mbn",
> + .config = &modem_foxconn_sdx55_config,
> + .bar_num = MHI_PCI_DEFAULT_BAR_NUM,
> + .dma_data_width = 32
> +};
> +
>  static const struct pci_device_id mhi_pci_id_table[] = {
>   { PCI_DEVICE(PCI_VENDOR_ID_QCOM, 0x0306),
>   .driver_data = (kernel_ulong_t) &mhi_qcom_sdx55_info },
> @@ -269,6 +315,18 @@ static const struct pci_device_id mhi_pci_id_table[] = {
>   .driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info },
>   { PCI_DEVICE(0x1eac, 0x1002), /* EM160R-GL (sdx24) */
>   .driver_data = (kernel_ulong_t) &mhi_quectel_em1xx_info },
> + { PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0ab), /* T99W175 (sdx55) */
> + .driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
> + { PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b2), /* T99W175 (sdx55) */
> + .driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
> + { PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b3), /* T99W175 (sdx55) */
> + .driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },

Please add a comment about these devices as you did below. Using T99W175 (sdx55)
for all is not sufficient.

Thanks,
Mani

> + /* DW5930e (sdx55), With eSIM, It's also T99W175 */
> + { PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b0),
> + .driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
> + /* DW5930e (sdx55), Non-eSIM, It's also T99W175 */
> + { PCI_DEVICE(PCI_VENDOR_ID_FOXCONN, 0xe0b1),
> + .driver_data = (kernel_ulong_t) &mhi_foxconn_sdx55_info },
>   {  }
>  };
>  MODULE_DEVICE_TABLE(pci, mhi_pci_id_table);
> -- 
> 2.25.1
> 


[PATCH v2 49/49] staging: sm750fb: Update members of sm750_pnltype struct to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the members of
sm750_pnltype structure, in particular sm750_24TFT, sm750_dualTFT,
and sm750_doubleTFT.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 6 +++---
 drivers/staging/sm750fb/sm750.h| 6 +++---
 drivers/staging/sm750fb/sm750_hw.c | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 946143de11fc..c9b17d6ac9fb 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -894,11 +894,11 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, 
char *src)
} else if (!strncmp(opt, "nocrt", strlen("nocrt"))) {
sm750_dev->nocrt = 1;
} else if (!strncmp(opt, "36bit", strlen("36bit"))) {
-   sm750_dev->pnltype = sm750_doubleTFT;
+   sm750_dev->pnltype = sm750_double_tft;
} else if (!strncmp(opt, "18bit", strlen("18bit"))) {
-   sm750_dev->pnltype = sm750_dualTFT;
+   sm750_dev->pnltype = sm750_dual_tft;
} else if (!strncmp(opt, "24bit", strlen("24bit"))) {
-   sm750_dev->pnltype = sm750_24TFT;
+   sm750_dev->pnltype = sm750_24_tft;
} else if (!strncmp(opt, "nohwc0", strlen("nohwc0"))) {
g_hwcursor &= ~0x1;
} else if (!strncmp(opt, "nohwc1", strlen("nohwc1"))) {
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 06cf136fa28c..ce02671a1419 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -13,9 +13,9 @@
 #endif
 
 enum sm750_pnltype {
-   sm750_24TFT = 0,/* 24bit tft */
-   sm750_dualTFT = 2,  /* dual 18 bit tft */
-   sm750_doubleTFT = 1,/* 36 bit double pixel tft */
+   sm750_24_tft = 0,   /* 24bit tft */
+   sm750_dual_tft = 2, /* dual 18 bit tft */
+   sm750_double_tft = 1,   /* 36 bit double pixel tft */
 };
 
 /* vga channel is not concerned  */
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index b445f075d0a9..ad81fd5c33ad 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -136,12 +136,12 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct 
pci_dev *pdev)
~(PANEL_DISPLAY_CTRL_DUAL_DISPLAY |
  PANEL_DISPLAY_CTRL_DOUBLE_PIXEL);
switch (sm750_dev->pnltype) {
-   case sm750_24TFT:
+   case sm750_24_tft:
break;
-   case sm750_doubleTFT:
+   case sm750_double_tft:
val |= PANEL_DISPLAY_CTRL_DOUBLE_PIXEL;
break;
-   case sm750_dualTFT:
+   case sm750_dual_tft:
val |= PANEL_DISPLAY_CTRL_DUAL_DISPLAY;
break;
}
-- 
2.30.2



[PATCH v2 48/49] staging: sm750fb: Rename fixId to fix_id

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the local variable
fixId in lynxfb_set_fbinfo function.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 0c6bfbedde50..946143de11fc 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -694,7 +694,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
"kernel HELPERS prepared vesa_modes",
};
 
-   static const char *fixId[2] = {
+   static const char *fix_id[2] = {
"sm750_fb1", "sm750_fb2",
};
 
@@ -814,7 +814,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
fix->ywrapstep = crtc->ywrapstep;
fix->accel = FB_ACCEL_SMI;
 
-   strscpy(fix->id, fixId[index], sizeof(fix->id));
+   strscpy(fix->id, fix_id[index], sizeof(fix->id));
 
fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
pr_info("fix->smem_start = %lx\n", fix->smem_start);
-- 
2.30.2



[PATCH v2 47/49] staging: sm750fb: Rename proc_setBLANK member of lynxfb_output struct

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for proc_setBLANK member of
lynxfb_output structure.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c | 4 ++--
 drivers/staging/sm750fb/sm750.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 937a44530fbf..0c6bfbedde50 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -577,7 +577,7 @@ static int lynxfb_ops_blank(int blank, struct fb_info *info)
pr_debug("blank = %d.\n", blank);
par = info->par;
output = &par->output;
-   return output->proc_setBLANK(output, blank);
+   return output->proc_set_blank(output, blank);
 }
 
 static int sm750fb_set_drv(struct lynxfb_par *par)
@@ -605,7 +605,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->ypanstep = 1;
crtc->ywrapstep = 0;
 
-   output->proc_setBLANK = (sm750_dev->revid == SM750LE_REVISION_ID) ?
+   output->proc_set_blank = (sm750_dev->revid == SM750LE_REVISION_ID) ?
 hw_sm750le_set_blank : hw_sm750_set_blank;
/* chip specific phase */
sm750_dev->accel.de_wait = (sm750_dev->revid == SM750LE_REVISION_ID) ?
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 2e6481809d43..06cf136fa28c 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -170,7 +170,7 @@ struct lynxfb_output {
 */
void *priv;
 
-   int (*proc_setBLANK)(struct lynxfb_output *output, int blank);
+   int (*proc_set_blank)(struct lynxfb_output *output, int blank);
 };
 
 struct lynxfb_par {
-- 
2.30.2



[PATCH v2 45/49] staging: sm750fb: Rename sii164_set_power function parameter

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function parameter
powerUp.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.h 
b/drivers/staging/sm750fb/ddk750_sii164.h
index ac1431dcb419..a414afbb719a 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.h
+++ b/drivers/staging/sm750fb/ddk750_sii164.h
@@ -33,7 +33,7 @@ unsigned short sii164_get_device_id(void);
 #ifdef SII164_FULL_FUNCTIONS
 void sii164_reset_chip(void);
 char *sii164_get_chip_string(void);
-void sii164_set_power(unsigned char powerUp);
+void sii164_set_power(unsigned char power_up);
 void sii164_enable_hot_plug_detection(unsigned char enable_hot_plug);
 unsigned char sii164_is_connected(void);
 unsigned char sii164_check_interrupt(void);
-- 
2.30.2



[PATCH v2 46/49] staging: sm750fb: Rename local variable Bpp to bpp in sm750.c

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the local variable
Bpp in functions lynxfb_ops_fillrect and lynxfb_ops_copyarea.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 162eaf08db4c..937a44530fbf 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -162,7 +162,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info,
 {
struct lynxfb_par *par;
struct sm750_dev *sm750_dev;
-   unsigned int base, pitch, Bpp, rop;
+   unsigned int base, pitch, bpp, rop;
u32 color;
 
if (info->state != FBINFO_STATE_RUNNING)
@@ -177,9 +177,9 @@ static void lynxfb_ops_fillrect(struct fb_info *info,
 */
base = par->crtc.o_screen;
pitch = info->fix.line_length;
-   Bpp = info->var.bits_per_pixel >> 3;
+   bpp = info->var.bits_per_pixel >> 3;
 
-   color = (Bpp == 1) ? region->color :
+   color = (bpp == 1) ? region->color :
((u32 *)info->pseudo_palette)[region->color];
rop = (region->rop != ROP_COPY) ? HW_ROP2_XOR : HW_ROP2_COPY;
 
@@ -192,7 +192,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info,
spin_lock(&sm750_dev->slock);
 
sm750_dev->accel.de_fillrect(&sm750_dev->accel,
-base, pitch, Bpp,
+base, pitch, bpp,
 region->dx, region->dy,
 region->width, region->height,
 color, rop);
@@ -204,7 +204,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 {
struct lynxfb_par *par;
struct sm750_dev *sm750_dev;
-   unsigned int base, pitch, Bpp;
+   unsigned int base, pitch, bpp;
 
par = info->par;
sm750_dev = par->dev;
@@ -215,7 +215,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 */
base = par->crtc.o_screen;
pitch = info->fix.line_length;
-   Bpp = info->var.bits_per_pixel >> 3;
+   bpp = info->var.bits_per_pixel >> 3;
 
/*
 * If not use spin_lock, system will die if user load driver
@@ -227,7 +227,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 
sm750_dev->accel.de_copyarea(&sm750_dev->accel,
 base, pitch, region->sx, region->sy,
-base, pitch, Bpp, region->dx, region->dy,
+base, pitch, bpp, region->dx, region->dy,
 region->width, region->height,
 HW_ROP2_COPY);
spin_unlock(&sm750_dev->slock);
@@ -236,7 +236,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 static void lynxfb_ops_imageblit(struct fb_info *info,
 const struct fb_image *image)
 {
-   unsigned int base, pitch, Bpp;
+   unsigned int base, pitch, bpp;
unsigned int fgcol, bgcol;
struct lynxfb_par *par;
struct sm750_dev *sm750_dev;
@@ -249,7 +249,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,
 */
base = par->crtc.o_screen;
pitch = info->fix.line_length;
-   Bpp = info->var.bits_per_pixel >> 3;
+   bpp = info->var.bits_per_pixel >> 3;
 
/* TODO: Implement hardware acceleration for image->depth > 1 */
if (image->depth != 1) {
@@ -276,7 +276,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,
 
sm750_dev->accel.de_imageblit(&sm750_dev->accel,
  image->data, image->width >> 3, 0,
- base, pitch, Bpp,
+ base, pitch, bpp,
  image->dx, image->dy,
  image->width, image->height,
  fgcol, bgcol, HW_ROP2_COPY);
-- 
2.30.2



[PATCH v2 44/49] staging: sm750fb: Rename function hw_sm750_crtc_checkMode to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
hw_sm750_crtc_checkMode.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750.h| 2 +-
 drivers/staging/sm750fb/sm750_hw.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index bb25ab4ba0de..162eaf08db4c 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -512,7 +512,7 @@ static int lynxfb_ops_check_var(struct fb_var_screeninfo 
*var,
return -ENOMEM;
}
 
-   return hw_sm750_crtc_checkMode(crtc, var);
+   return hw_sm750_crtc_check_mode(crtc, var);
 }
 
 static int lynxfb_ops_setcolreg(unsigned int regno,
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index a27aaac5d67a..2e6481809d43 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -201,7 +201,7 @@ int hw_sm750_output_set_mode(struct lynxfb_output *output,
struct fb_var_screeninfo *var,
struct fb_fix_screeninfo *fix);
 
-int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc,
+int hw_sm750_crtc_check_mode(struct lynxfb_crtc *crtc,
struct fb_var_screeninfo *var);
 
 int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 97b842148bcb..b445f075d0a9 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -221,7 +221,7 @@ int hw_sm750_output_set_mode(struct lynxfb_output *output,
return ret;
 }
 
-int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc,
+int hw_sm750_crtc_check_mode(struct lynxfb_crtc *crtc,
struct fb_var_screeninfo *var)
 {
struct sm750_dev *sm750_dev;
-- 
2.30.2



[PATCH v2 43/49] staging: sm750fb: Update members of lynx_accel struct to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the members of
lynx_accel structure, in particular dprBase and dpPortBase.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.h   | 4 ++--
 drivers/staging/sm750fb/sm750_accel.c | 6 +++---
 drivers/staging/sm750fb/sm750_hw.c| 4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index da37fc81370b..a27aaac5d67a 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -50,9 +50,9 @@ struct init_status {
 
 struct lynx_accel {
/* base virtual address of DPR registers */
-   volatile unsigned char __iomem *dprBase;
+   volatile unsigned char __iomem *dpr_base;
/* base virtual address of de data port */
-   volatile unsigned char __iomem *dpPortBase;
+   volatile unsigned char __iomem *dp_port_base;
 
/* function pointers */
void (*de_init)(struct lynx_accel *accel);
diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index d0b64962b10e..6ca2e5265836 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -20,17 +20,17 @@
 #include "sm750_accel.h"
 static inline void write_dpr(struct lynx_accel *accel, int offset, u32 
reg_value)
 {
-   writel(reg_value, accel->dprBase + offset);
+   writel(reg_value, accel->dpr_base + offset);
 }
 
 static inline u32 read_dpr(struct lynx_accel *accel, int offset)
 {
-   return readl(accel->dprBase + offset);
+   return readl(accel->dpr_base + offset);
 }
 
 static inline void write_dp_port(struct lynx_accel *accel, u32 data)
 {
-   writel(data, accel->dpPortBase);
+   writel(data, accel->dp_port_base);
 }
 
 void sm750_hw_de_init(struct lynx_accel *accel)
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 789199e628cd..97b842148bcb 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -60,8 +60,8 @@ int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev 
*pdev)
pr_info("mmio virtual addr = %p\n", sm750_dev->reg);
}
 
-   sm750_dev->accel.dprBase = sm750_dev->reg + DE_BASE_ADDR_TYPE1;
-   sm750_dev->accel.dpPortBase = sm750_dev->reg + DE_PORT_ADDR_TYPE1;
+   sm750_dev->accel.dpr_base = sm750_dev->reg + DE_BASE_ADDR_TYPE1;
+   sm750_dev->accel.dp_port_base = sm750_dev->reg + DE_PORT_ADDR_TYPE1;
 
mmio750 = sm750_dev->reg;
sm750_set_chip_type(sm750_dev->devid, sm750_dev->revid);
-- 
2.30.2



[PATCH v2 42/49] staging: sm750fb: Rename functions *_deWait to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the functions
hw_sm750le_deWait and hw_sm750_deWait.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750.h| 4 ++--
 drivers/staging/sm750fb/sm750_hw.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 05f3a1d454db..bb25ab4ba0de 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -609,7 +609,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
 hw_sm750le_set_blank : hw_sm750_set_blank;
/* chip specific phase */
sm750_dev->accel.de_wait = (sm750_dev->revid == SM750LE_REVISION_ID) ?
-   hw_sm750le_deWait : hw_sm750_deWait;
+   hw_sm750le_de_wait : hw_sm750_de_wait;
switch (sm750_dev->dataflow) {
case sm750_simul_pri:
output->paths = sm750_pnc;
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 4f9fe3e9ef81..da37fc81370b 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -194,8 +194,8 @@ static inline unsigned long ps_to_hz(unsigned int psvalue)
 int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
 int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
 void hw_sm750_init_accel(struct sm750_dev *sm750_dev);
-int hw_sm750_deWait(void);
-int hw_sm750le_deWait(void);
+int hw_sm750_de_wait(void);
+int hw_sm750le_de_wait(void);
 
 int hw_sm750_output_set_mode(struct lynxfb_output *output,
struct fb_var_screeninfo *var,
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index db2c87fe7006..789199e628cd 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -506,7 +506,7 @@ void hw_sm750_init_accel(struct sm750_dev *sm750_dev)
sm750_dev->accel.de_init(&sm750_dev->accel);
 }
 
-int hw_sm750le_deWait(void)
+int hw_sm750le_de_wait(void)
 {
int i = 0x1000;
unsigned int mask = DE_STATE2_DE_STATUS_BUSY | DE_STATE2_DE_FIFO_EMPTY |
@@ -523,7 +523,7 @@ int hw_sm750le_deWait(void)
return -1;
 }
 
-int hw_sm750_deWait(void)
+int hw_sm750_de_wait(void)
 {
int i = 0x1000;
unsigned int mask = SYSTEM_CTRL_DE_STATUS_BUSY |
-- 
2.30.2



[PATCH v2 41/49] staging: sm750fb: Rename function hw_sm750_initAccel to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
hw_sm750_init_accel.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.h| 2 +-
 drivers/staging/sm750fb/sm750_hw.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 7347be7dcded..4f9fe3e9ef81 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -193,7 +193,7 @@ static inline unsigned long ps_to_hz(unsigned int psvalue)
 
 int hw_sm750_map(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
 int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev);
-void hw_sm750_initAccel(struct sm750_dev *sm750_dev);
+void hw_sm750_init_accel(struct sm750_dev *sm750_dev);
 int hw_sm750_deWait(void);
 int hw_sm750le_deWait(void);
 
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 87d2b82f0880..db2c87fe7006 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -175,7 +175,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct 
pci_dev *pdev)
 
/* init 2d engine */
if (!sm750_dev->accel_off)
-   hw_sm750_initAccel(sm750_dev);
+   hw_sm750_init_accel(sm750_dev);
 
return 0;
 }
@@ -476,7 +476,7 @@ int hw_sm750_set_blank(struct lynxfb_output *output, int 
blank)
return 0;
 }
 
-void hw_sm750_initAccel(struct sm750_dev *sm750_dev)
+void hw_sm750_init_accel(struct sm750_dev *sm750_dev)
 {
u32 reg;
 
-- 
2.30.2



[PATCH v2 38/49] staging: sm750fb: Rename function hw_sm750_setColReg to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
hw_sm750_setColReg.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750.h| 2 +-
 drivers/staging/sm750fb/sm750_hw.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 8e803b580a71..62c9a8c5de8f 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -545,7 +545,7 @@ static int lynxfb_ops_setcolreg(unsigned int regno,
red >>= 8;
green >>= 8;
blue >>= 8;
-   ret = hw_sm750_setColReg(crtc, regno, red, green, blue);
+   ret = hw_sm750_set_col_reg(crtc, regno, red, green, blue);
goto exit;
}
 
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index b46d13134f76..71b4ce05f4fe 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -208,7 +208,7 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
  struct fb_var_screeninfo *var,
  struct fb_fix_screeninfo *fix);
 
-int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index,
+int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort index,
   ushort red, ushort green, ushort blue);
 
 int hw_sm750_setBLANK(struct lynxfb_output *output, int blank);
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 410f726b03e9..7eae56b74a2b 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -372,7 +372,7 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
return ret;
 }
 
-int hw_sm750_setColReg(struct lynxfb_crtc *crtc, ushort index,
+int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort index,
   ushort red, ushort green, ushort blue)
 {
static unsigned int add[] = {PANEL_PALETTE_RAM, CRT_PALETTE_RAM};
-- 
2.30.2



[PATCH v2 39/49] staging: sm750fb: Rename functions *_setBLANK to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the functions
hw_sm750_setBLANK and hw_sm750le_setBLANK.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750.h| 4 ++--
 drivers/staging/sm750fb/sm750_hw.c | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 62c9a8c5de8f..05f3a1d454db 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -606,7 +606,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->ywrapstep = 0;
 
output->proc_setBLANK = (sm750_dev->revid == SM750LE_REVISION_ID) ?
-hw_sm750le_setBLANK : hw_sm750_setBLANK;
+hw_sm750le_set_blank : hw_sm750_set_blank;
/* chip specific phase */
sm750_dev->accel.de_wait = (sm750_dev->revid == SM750LE_REVISION_ID) ?
hw_sm750le_deWait : hw_sm750_deWait;
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 71b4ce05f4fe..7347be7dcded 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -211,8 +211,8 @@ int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
 int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort index,
   ushort red, ushort green, ushort blue);
 
-int hw_sm750_setBLANK(struct lynxfb_output *output, int blank);
-int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank);
+int hw_sm750_set_blank(struct lynxfb_output *output, int blank);
+int hw_sm750le_set_blank(struct lynxfb_output *output, int blank);
 int hw_sm750_pan_display(struct lynxfb_crtc *crtc,
 const struct fb_var_screeninfo *var,
 const struct fb_info *info);
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 7eae56b74a2b..87d2b82f0880 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -382,7 +382,7 @@ int hw_sm750_set_col_reg(struct lynxfb_crtc *crtc, ushort 
index,
return 0;
 }
 
-int hw_sm750le_setBLANK(struct lynxfb_output *output, int blank)
+int hw_sm750le_set_blank(struct lynxfb_output *output, int blank)
 {
int dpms, crtdb;
 
@@ -423,7 +423,7 @@ int hw_sm750le_setBLANK(struct lynxfb_output *output, int 
blank)
return 0;
 }
 
-int hw_sm750_setBLANK(struct lynxfb_output *output, int blank)
+int hw_sm750_set_blank(struct lynxfb_output *output, int blank)
 {
unsigned int dpms, pps, crtdb;
 
-- 
2.30.2



[PATCH v2 40/49] staging: sm750fb: Rename function sm750_hw_cursor_setData2 to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
sm750_hw_cursor_setData2.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_cursor.c | 2 +-
 drivers/staging/sm750fb/sm750_cursor.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index 98d294ac223c..3ee3bf78f7a5 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -132,7 +132,7 @@ void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, 
u16 rop,
}
 }
 
-void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop,
+void sm750_hw_cursor_set_data2(struct lynx_cursor *cursor, u16 rop,
  const u8 *pcol, const u8 *pmsk)
 {
int i, j, count, pitch, offset;
diff --git a/drivers/staging/sm750fb/sm750_cursor.h 
b/drivers/staging/sm750fb/sm750_cursor.h
index af0211242ae8..8a1e81b8248d 100644
--- a/drivers/staging/sm750fb/sm750_cursor.h
+++ b/drivers/staging/sm750fb/sm750_cursor.h
@@ -10,6 +10,6 @@ void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int 
x, int y);
 void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, u32 fg, u32 bg);
 void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, u16 rop,
 const u8 *data, const u8 *mask);
-void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop,
+void sm750_hw_cursor_set_data2(struct lynx_cursor *cursor, u16 rop,
  const u8 *data, const u8 *mask);
 #endif
-- 
2.30.2



[PATCH v2 37/49] staging: sm750fb: Rename function hw_sm750_output_setMode to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
hw_sm750_output_set_mod.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750.h| 2 +-
 drivers/staging/sm750fb/sm750_hw.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 2c944539eaf0..8e803b580a71 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -395,7 +395,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
}
ret = hw_sm750_crtc_set_mode(crtc, var, fix);
if (!ret)
-   ret = hw_sm750_output_setMode(output, var, fix);
+   ret = hw_sm750_output_set_mode(output, var, fix);
return ret;
 }
 
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 368e5cc19147..b46d13134f76 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -197,7 +197,7 @@ void hw_sm750_initAccel(struct sm750_dev *sm750_dev);
 int hw_sm750_deWait(void);
 int hw_sm750le_deWait(void);
 
-int hw_sm750_output_setMode(struct lynxfb_output *output,
+int hw_sm750_output_set_mode(struct lynxfb_output *output,
struct fb_var_screeninfo *var,
struct fb_fix_screeninfo *fix);
 
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 7c852c6a153b..410f726b03e9 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -180,7 +180,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct 
pci_dev *pdev)
return 0;
 }
 
-int hw_sm750_output_setMode(struct lynxfb_output *output,
+int hw_sm750_output_set_mode(struct lynxfb_output *output,
struct fb_var_screeninfo *var,
struct fb_fix_screeninfo *fix)
 {
-- 
2.30.2



[PATCH v2 36/49] staging: sm750fb: Update members of lynxfb_crtc struct to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the members of the
struct lynxfb_crtc, in particular vCursor, vScreen, oCursor, and
oScreen.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 44 +++---
 drivers/staging/sm750fb/sm750.h|  8 +++---
 drivers/staging/sm750fb/sm750_hw.c |  6 ++--
 3 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 22881d35c9ad..2c944539eaf0 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -175,7 +175,7 @@ static void lynxfb_ops_fillrect(struct fb_info *info,
 * each time 2d function begin to work,below three variable always need
 * be set, seems we can put them together in some place
 */
-   base = par->crtc.oScreen;
+   base = par->crtc.o_screen;
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
 
@@ -213,7 +213,7 @@ static void lynxfb_ops_copyarea(struct fb_info *info,
 * each time 2d function begin to work,below three variable always need
 * be set, seems we can put them together in some place
 */
-   base = par->crtc.oScreen;
+   base = par->crtc.o_screen;
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
 
@@ -247,7 +247,7 @@ static void lynxfb_ops_imageblit(struct fb_info *info,
 * each time 2d function begin to work,below three variable always need
 * be set, seems we can put them together in some place
 */
-   base = par->crtc.oScreen;
+   base = par->crtc.o_screen;
pitch = info->fix.line_length;
Bpp = info->var.bits_per_pixel >> 3;
 
@@ -451,7 +451,7 @@ static int __maybe_unused lynxfb_resume(struct device *dev)
crtc = &par->crtc;
cursor = &crtc->cursor;
memset_io(cursor->vstart, 0x0, cursor->size);
-   memset_io(crtc->vScreen, 0x0, crtc->vidmem_size);
+   memset_io(crtc->v_screen, 0x0, crtc->vidmem_size);
lynxfb_ops_set_par(info);
fb_set_suspend(info, 0);
}
@@ -463,7 +463,7 @@ static int __maybe_unused lynxfb_resume(struct device *dev)
crtc = &par->crtc;
cursor = &crtc->cursor;
memset_io(cursor->vstart, 0x0, cursor->size);
-   memset_io(crtc->vScreen, 0x0, crtc->vidmem_size);
+   memset_io(crtc->v_screen, 0x0, crtc->vidmem_size);
lynxfb_ops_set_par(info);
fb_set_suspend(info, 0);
}
@@ -614,44 +614,44 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
case sm750_simul_pri:
output->paths = sm750_pnc;
crtc->channel = sm750_primary;
-   crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->mem;
+   crtc->o_screen = 0;
+   crtc->v_screen = sm750_dev->mem;
pr_info("use simul primary mode\n");
break;
case sm750_simul_sec:
output->paths = sm750_pnc;
crtc->channel = sm750_secondary;
-   crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->mem;
+   crtc->o_screen = 0;
+   crtc->v_screen = sm750_dev->mem;
break;
case sm750_dual_normal:
if (par->index == 0) {
output->paths = sm750_panel;
crtc->channel = sm750_primary;
-   crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->mem;
+   crtc->o_screen = 0;
+   crtc->v_screen = sm750_dev->mem;
} else {
output->paths = sm750_crt;
crtc->channel = sm750_secondary;
-   /* not consider of padding stuffs for oScreen,need fix 
*/
-   crtc->oScreen = sm750_dev->vidmem_size >> 1;
-   crtc->vScreen = sm750_dev->mem + crtc->oScreen;
+   /* not consider of padding stuffs for o_screen,need fix 
*/
+   crtc->o_screen = sm750_dev->vidmem_size >> 1;
+   crtc->v_screen = sm750_dev->mem + crtc->o_screen;
}
break;
case sm750_dual_swap:
if (par->index == 0) {
output->paths = sm750_panel;
crtc->channel = sm750_secondary;
-   crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->mem;
+   crtc->o_screen = 0;
+   crtc->v_screen = sm750_dev->mem;
} else {
output->paths = sm750_crt;
crtc->channel = sm750_primary;
-   /* not consider of padding stuffs for oScreen,
+   /* not co

[PATCH v2 35/49] staging: sm750fb: Update members of sm750_dev struct to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the members of
sm750_dev structure, in particular initParam, pvReg, pvMem, and hwCursor.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 36 +++---
 drivers/staging/sm750fb/sm750.h|  8 +++
 drivers/staging/sm750fb/sm750_hw.c | 22 +-
 3 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 58de4b9575d9..22881d35c9ad 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -598,7 +598,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
crtc->vidmem_size >>= 1;
 
/* setup crtc and output member */
-   sm750_dev->hwCursor = g_hwcursor;
+   sm750_dev->hw_cursor = g_hwcursor;
 
crtc->line_pad = 16;
crtc->xpanstep = 8;
@@ -615,27 +615,27 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
output->paths = sm750_pnc;
crtc->channel = sm750_primary;
crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->pvMem;
+   crtc->vScreen = sm750_dev->mem;
pr_info("use simul primary mode\n");
break;
case sm750_simul_sec:
output->paths = sm750_pnc;
crtc->channel = sm750_secondary;
crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->pvMem;
+   crtc->vScreen = sm750_dev->mem;
break;
case sm750_dual_normal:
if (par->index == 0) {
output->paths = sm750_panel;
crtc->channel = sm750_primary;
crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->pvMem;
+   crtc->vScreen = sm750_dev->mem;
} else {
output->paths = sm750_crt;
crtc->channel = sm750_secondary;
/* not consider of padding stuffs for oScreen,need fix 
*/
crtc->oScreen = sm750_dev->vidmem_size >> 1;
-   crtc->vScreen = sm750_dev->pvMem + crtc->oScreen;
+   crtc->vScreen = sm750_dev->mem + crtc->oScreen;
}
break;
case sm750_dual_swap:
@@ -643,7 +643,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
output->paths = sm750_panel;
crtc->channel = sm750_secondary;
crtc->oScreen = 0;
-   crtc->vScreen = sm750_dev->pvMem;
+   crtc->vScreen = sm750_dev->mem;
} else {
output->paths = sm750_crt;
crtc->channel = sm750_primary;
@@ -651,7 +651,7 @@ static int sm750fb_set_drv(struct lynxfb_par *par)
 * need fix
 */
crtc->oScreen = sm750_dev->vidmem_size >> 1;
-   crtc->vScreen = sm750_dev->pvMem + crtc->oScreen;
+   crtc->vScreen = sm750_dev->mem + crtc->oScreen;
}
break;
default:
@@ -719,13 +719,13 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
 * must be set after crtc member initialized
 */
crtc->cursor.offset = crtc->oScreen + crtc->vidmem_size - 1024;
-   crtc->cursor.mmio = sm750_dev->pvReg +
+   crtc->cursor.mmio = sm750_dev->reg +
0x800f0 + (int)crtc->channel * 0x140;
 
pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
crtc->cursor.max_h = crtc->cursor.max_w = 64;
crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
-   crtc->cursor.vstart = sm750_dev->pvMem + crtc->cursor.offset;
+   crtc->cursor.vstart = sm750_dev->mem + crtc->cursor.offset;
 
memset_io(crtc->cursor.vstart, 0, crtc->cursor.size);
if (!g_hwcursor) {
@@ -870,12 +870,12 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, 
char *src)
 
swap = 0;
 
-   sm750_dev->initParm.chip_clk = 0;
-   sm750_dev->initParm.mem_clk = 0;
-   sm750_dev->initParm.master_clk = 0;
-   sm750_dev->initParm.power_mode = 0;
-   sm750_dev->initParm.set_all_eng_off = 0;
-   sm750_dev->initParm.reset_memory = 1;
+   sm750_dev->init_parm.chip_clk = 0;
+   sm750_dev->init_parm.mem_clk = 0;
+   sm750_dev->init_parm.master_clk = 0;
+   sm750_dev->init_parm.power_mode = 0;
+   sm750_dev->init_parm.set_all_eng_off = 0;
+   sm750_dev->init_parm.reset_memory = 1;
 
/* defaultly turn g_hwcursor on for both view */
g_hwcursor = 3;
@@ -1061,7 +1061,7 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
sm750_dev->mtrr.vram = arch_phys_wc_add(sm750_dev->vidmem_start,
   

[PATCH v2 34/49] staging: sm750fb: Update members of init_status struct to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the members of the
struct init_status, in particular powerMode, setAllEngOff,
and resetMemory.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c | 6 +++---
 drivers/staging/sm750fb/sm750.h | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 2343cd897989..58de4b9575d9 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -873,9 +873,9 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char 
*src)
sm750_dev->initParm.chip_clk = 0;
sm750_dev->initParm.mem_clk = 0;
sm750_dev->initParm.master_clk = 0;
-   sm750_dev->initParm.powerMode = 0;
-   sm750_dev->initParm.setAllEngOff = 0;
-   sm750_dev->initParm.resetMemory = 1;
+   sm750_dev->initParm.power_mode = 0;
+   sm750_dev->initParm.set_all_eng_off = 0;
+   sm750_dev->initParm.reset_memory = 1;
 
/* defaultly turn g_hwcursor on for both view */
g_hwcursor = 3;
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 6e0805a99180..f946d35d30d0 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -39,13 +39,13 @@ enum sm750_path {
 };
 
 struct init_status {
-   ushort powerMode;
+   ushort power_mode;
/* below three clocks are in unit of MHZ*/
ushort chip_clk;
ushort mem_clk;
ushort master_clk;
-   ushort setAllEngOff;
-   ushort resetMemory;
+   ushort set_all_eng_off;
+   ushort reset_memory;
 };
 
 struct lynx_accel {
-- 
2.30.2



[PATCH v2 33/49] staging: sm750fb: Rename function hw_sm750_crtc_setMode to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
hw_sm750_crtc_setMode.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750.h| 2 +-
 drivers/staging/sm750fb/sm750_hw.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 9263d4bdd222..2343cd897989 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -393,7 +393,7 @@ static int lynxfb_ops_set_par(struct fb_info *info)
pr_err("bpp %d not supported\n", var->bits_per_pixel);
return ret;
}
-   ret = hw_sm750_crtc_setMode(crtc, var, fix);
+   ret = hw_sm750_crtc_set_mode(crtc, var, fix);
if (!ret)
ret = hw_sm750_output_setMode(output, var, fix);
return ret;
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 8271cf7c89f3..6e0805a99180 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -204,7 +204,7 @@ int hw_sm750_output_setMode(struct lynxfb_output *output,
 int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc,
struct fb_var_screeninfo *var);
 
-int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
+int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
  struct fb_var_screeninfo *var,
  struct fb_fix_screeninfo *fix);
 
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index e31f4c6bc69e..efe379ef3438 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -247,7 +247,7 @@ int hw_sm750_crtc_checkMode(struct lynxfb_crtc *crtc,
 }
 
 /* set the controller's mode for @crtc charged with @var and @fix parameters */
-int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
+int hw_sm750_crtc_set_mode(struct lynxfb_crtc *crtc,
  struct fb_var_screeninfo *var,
  struct fb_fix_screeninfo *fix)
 {
-- 
2.30.2



[PATCH v2 32/49] staging: sm750fb: Rename function sm750_hw_cursor_setData to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
sm750_hw_cursor_setData.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750_cursor.c | 2 +-
 drivers/staging/sm750fb/sm750_cursor.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index d93884f9da7f..9263d4bdd222 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -145,7 +145,7 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct 
fb_cursor *fbcursor)
}
 
if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) {
-   sm750_hw_cursor_setData(cursor,
+   sm750_hw_cursor_set_data(cursor,
fbcursor->rop,
fbcursor->image.data,
fbcursor->mask);
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index ac83ead1c5bc..98d294ac223c 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -82,7 +82,7 @@ void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, 
u32 fg, u32 bg)
poke32(HWC_COLOR_3, 0xffe0);
 }
 
-void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop,
+void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, u16 rop,
 const u8 *pcol, const u8 *pmsk)
 {
int i, j, count, pitch, offset;
diff --git a/drivers/staging/sm750fb/sm750_cursor.h 
b/drivers/staging/sm750fb/sm750_cursor.h
index edfa6a8202cd..af0211242ae8 100644
--- a/drivers/staging/sm750fb/sm750_cursor.h
+++ b/drivers/staging/sm750fb/sm750_cursor.h
@@ -8,7 +8,7 @@ void sm750_hw_cursor_disable(struct lynx_cursor *cursor);
 void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h);
 void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int x, int y);
 void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, u32 fg, u32 bg);
-void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop,
+void sm750_hw_cursor_set_data(struct lynx_cursor *cursor, u16 rop,
 const u8 *data, const u8 *mask);
 void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop,
  const u8 *data, const u8 *mask);
-- 
2.30.2



[PATCH v2 31/49] staging: sm750fb: Rename function sm750_hw_cursor_setColor to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
sm750_hw_cursor_set_color.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750_cursor.c | 2 +-
 drivers/staging/sm750fb/sm750_cursor.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index b76d3d40969a..d93884f9da7f 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -141,7 +141,7 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct 
fb_cursor *fbcursor)
 ((info->cmap.green[fbcursor->image.bg_color] & 0xfc00) >> 
5) |
 ((info->cmap.blue[fbcursor->image.bg_color] & 0xf800) >> 
11);
 
-   sm750_hw_cursor_setColor(cursor, fg, bg);
+   sm750_hw_cursor_set_color(cursor, fg, bg);
}
 
if (fbcursor->set & (FB_CUR_SETSHAPE | FB_CUR_SETIMAGE)) {
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index 0ba80e086415..ac83ead1c5bc 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -73,7 +73,7 @@ void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int 
x, int y)
poke32(HWC_LOCATION, reg);
 }
 
-void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg)
+void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, u32 fg, u32 bg)
 {
u32 reg = (fg << HWC_COLOR_12_2_RGB565_SHIFT) &
HWC_COLOR_12_2_RGB565_MASK;
diff --git a/drivers/staging/sm750fb/sm750_cursor.h 
b/drivers/staging/sm750fb/sm750_cursor.h
index d0ade8e366f4..edfa6a8202cd 100644
--- a/drivers/staging/sm750fb/sm750_cursor.h
+++ b/drivers/staging/sm750fb/sm750_cursor.h
@@ -7,7 +7,7 @@ void sm750_hw_cursor_enable(struct lynx_cursor *cursor);
 void sm750_hw_cursor_disable(struct lynx_cursor *cursor);
 void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h);
 void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int x, int y);
-void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg);
+void sm750_hw_cursor_set_color(struct lynx_cursor *cursor, u32 fg, u32 bg);
 void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop,
 const u8 *data, const u8 *mask);
 void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, u16 rop,
-- 
2.30.2



[PATCH v2 30/49] staging: sm750fb: Rename function sm750_hw_cursor_setPos to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
sm750_hw_cursor_set_pos.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750_cursor.c | 2 +-
 drivers/staging/sm750fb/sm750_cursor.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index eeba12f4b267..b76d3d40969a 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -125,7 +125,7 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct 
fb_cursor *fbcursor)
fbcursor->image.height);
 
if (fbcursor->set & FB_CUR_SETPOS)
-   sm750_hw_cursor_setPos(cursor,
+   sm750_hw_cursor_set_pos(cursor,
   fbcursor->image.dx - info->var.xoffset,
   fbcursor->image.dy - info->var.yoffset);
 
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index d5ef40b8bc8e..0ba80e086415 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -64,7 +64,7 @@ void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int 
w, int h)
cursor->h = h;
 }
 
-void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y)
+void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int x, int y)
 {
u32 reg;
 
diff --git a/drivers/staging/sm750fb/sm750_cursor.h 
b/drivers/staging/sm750fb/sm750_cursor.h
index edeed2ea4b04..d0ade8e366f4 100644
--- a/drivers/staging/sm750fb/sm750_cursor.h
+++ b/drivers/staging/sm750fb/sm750_cursor.h
@@ -6,7 +6,7 @@
 void sm750_hw_cursor_enable(struct lynx_cursor *cursor);
 void sm750_hw_cursor_disable(struct lynx_cursor *cursor);
 void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h);
-void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y);
+void sm750_hw_cursor_set_pos(struct lynx_cursor *cursor, int x, int y);
 void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg);
 void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop,
 const u8 *data, const u8 *mask);
-- 
2.30.2



[PATCH v2 29/49] staging: sm750fb: Rename function sm750_hw_cursor_setSize to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
sm750_hw_cursor_setSize.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 2 +-
 drivers/staging/sm750fb/sm750_cursor.c | 2 +-
 drivers/staging/sm750fb/sm750_cursor.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 4f5f68e6aa60..eeba12f4b267 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -120,7 +120,7 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct 
fb_cursor *fbcursor)
 
sm750_hw_cursor_disable(cursor);
if (fbcursor->set & FB_CUR_SETSIZE)
-   sm750_hw_cursor_setSize(cursor,
+   sm750_hw_cursor_set_size(cursor,
fbcursor->image.width,
fbcursor->image.height);
 
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index 43e6f52c2551..d5ef40b8bc8e 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -58,7 +58,7 @@ void sm750_hw_cursor_disable(struct lynx_cursor *cursor)
poke32(HWC_ADDRESS, 0);
 }
 
-void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, int w, int h)
+void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h)
 {
cursor->w = w;
cursor->h = h;
diff --git a/drivers/staging/sm750fb/sm750_cursor.h 
b/drivers/staging/sm750fb/sm750_cursor.h
index b59643dd61ed..edeed2ea4b04 100644
--- a/drivers/staging/sm750fb/sm750_cursor.h
+++ b/drivers/staging/sm750fb/sm750_cursor.h
@@ -5,7 +5,7 @@
 /* hw_cursor_xxx works for voyager,718 and 750 */
 void sm750_hw_cursor_enable(struct lynx_cursor *cursor);
 void sm750_hw_cursor_disable(struct lynx_cursor *cursor);
-void sm750_hw_cursor_setSize(struct lynx_cursor *cursor, int w, int h);
+void sm750_hw_cursor_set_size(struct lynx_cursor *cursor, int w, int h);
 void sm750_hw_cursor_setPos(struct lynx_cursor *cursor, int x, int y);
 void sm750_hw_cursor_setColor(struct lynx_cursor *cursor, u32 fg, u32 bg);
 void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 rop,
-- 
2.30.2



[PATCH v2 27/49] staging: sm750fb: Rename function params to snake case in sm750_accel.h

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for function parameters
in sm750_accel.h, in particular for functions sm750_hw_fillrect,
sm750_hw_copyarea and sm750_hw_imageblit.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.h | 42 +--
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.h 
b/drivers/staging/sm750fb/sm750_accel.h
index 2c79cb730a0a..8a5d1fe5075a 100644
--- a/drivers/staging/sm750fb/sm750_accel.h
+++ b/drivers/staging/sm750fb/sm750_accel.h
@@ -190,19 +190,19 @@ void sm750_hw_set2dformat(struct lynx_accel *accel, int 
fmt);
 void sm750_hw_de_init(struct lynx_accel *accel);
 
 int sm750_hw_fillrect(struct lynx_accel *accel,
- u32 base, u32 pitch, u32 Bpp,
+ u32 base, u32 pitch, u32 bpp,
  u32 x, u32 y, u32 width, u32 height,
  u32 color, u32 rop);
 
 /**
  * sm750_hm_copyarea
- * @sBase: Address of source: offset in frame buffer
- * @sPitch: Pitch value of source surface in BYTE
+ * @s_base: Address of source: offset in frame buffer
+ * @s_pitch: Pitch value of source surface in BYTE
  * @sx: Starting x coordinate of source surface
  * @sy: Starting y coordinate of source surface
- * @dBase: Address of destination: offset in frame buffer
- * @dPitch: Pitch value of destination surface in BYTE
- * @Bpp: Color depth of destination surface
+ * @d_base: Address of destination: offset in frame buffer
+ * @d_pitch: Pitch value of destination surface in BYTE
+ * @bpp: Color depth of destination surface
  * @dx: Starting x coordinate of destination surface
  * @dy: Starting y coordinate of destination surface
  * @width: width of rectangle in pixel value
@@ -210,34 +210,34 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
  * @rop2: ROP value
  */
 int sm750_hw_copyarea(struct lynx_accel *accel,
- unsigned int sBase, unsigned int sPitch,
+ unsigned int s_base, unsigned int s_pitch,
  unsigned int sx, unsigned int sy,
- unsigned int dBase, unsigned int dPitch,
- unsigned int Bpp, unsigned int dx, unsigned int dy,
+ unsigned int d_base, unsigned int d_pitch,
+ unsigned int bpp, unsigned int dx, unsigned int dy,
  unsigned int width, unsigned int height,
  unsigned int rop2);
 
 /**
  * sm750_hw_imageblit
- * @pSrcbuf: pointer to start of source buffer in system memory
- * @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down
+ * @src_buf: pointer to start of source buffer in system memory
+ * @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down
  *>-  and -ive mean button up
- * @startBit: Mono data can start at any bit in a byte, this value should be
+ * @start_bit: Mono data can start at any bit in a byte, this value should be
  *>-  0 to 7
- * @dBase: Address of destination: offset in frame buffer
- * @dPitch: Pitch value of destination surface in BYTE
- * @bytePerPixel: Color depth of destination surface
+ * @d_base: Address of destination: offset in frame buffer
+ * @d_pitch: Pitch value of destination surface in BYTE
+ * @byte_per_pixel: Color depth of destination surface
  * @dx: Starting x coordinate of destination surface
  * @dy: Starting y coordinate of destination surface
  * @width: width of rectangle in pixel value
  * @height: height of rectangle in pixel value
- * @fColor: Foreground color (corresponding to a 1 in the monochrome data
- * @bColor: Background color (corresponding to a 0 in the monochrome data
+ * @f_color: Foreground color (corresponding to a 1 in the monochrome data
+ * @b_color: Background color (corresponding to a 0 in the monochrome data
  * @rop2: ROP value
  */
-int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
-  u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch,
-  u32 bytePerPixel, u32 dx, u32 dy, u32 width,
-  u32 height, u32 fColor, u32 bColor, u32 rop2);
+int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
+  u32 src_delta, u32 start_bit, u32 d_base, u32 d_pitch,
+  u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
+  u32 height, u32 f_color, u32 b_color, u32 rop2);
 
 #endif
-- 
2.30.2



[PATCH v2 28/49] staging: sm750fb: Update members of lynx_cursor to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the members
of lynx_cursor structure, in particular maxW and maxH.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750.c| 8 
 drivers/staging/sm750fb/sm750.h| 4 ++--
 drivers/staging/sm750fb/sm750_cursor.c | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index c237a8f8eb59..4f5f68e6aa60 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -112,8 +112,8 @@ static int lynxfb_ops_cursor(struct fb_info *info, struct 
fb_cursor *fbcursor)
crtc = &par->crtc;
cursor = &crtc->cursor;
 
-   if (fbcursor->image.width > cursor->maxW ||
-   fbcursor->image.height > cursor->maxH ||
+   if (fbcursor->image.width > cursor->max_w ||
+   fbcursor->image.height > cursor->max_h ||
fbcursor->image.depth > 1) {
return -ENXIO;
}
@@ -723,8 +723,8 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int 
index)
0x800f0 + (int)crtc->channel * 0x140;
 
pr_info("crtc->cursor.mmio = %p\n", crtc->cursor.mmio);
-   crtc->cursor.maxH = crtc->cursor.maxW = 64;
-   crtc->cursor.size = crtc->cursor.maxH * crtc->cursor.maxW * 2 / 8;
+   crtc->cursor.max_h = crtc->cursor.max_w = 64;
+   crtc->cursor.size = crtc->cursor.max_h * crtc->cursor.max_w * 2 / 8;
crtc->cursor.vstart = sm750_dev->pvMem + crtc->cursor.offset;
 
memset_io(crtc->cursor.vstart, 0, crtc->cursor.size);
diff --git a/drivers/staging/sm750fb/sm750.h b/drivers/staging/sm750fb/sm750.h
index 23eefd019ec9..8271cf7c89f3 100644
--- a/drivers/staging/sm750fb/sm750.h
+++ b/drivers/staging/sm750fb/sm750.h
@@ -122,8 +122,8 @@ struct lynx_cursor {
int h;
int size;
/* hardware limitation */
-   int maxW;
-   int maxH;
+   int max_w;
+   int max_h;
/* base virtual address and offset  of cursor image */
char __iomem *vstart;
int offset;
diff --git a/drivers/staging/sm750fb/sm750_cursor.c 
b/drivers/staging/sm750fb/sm750_cursor.c
index bbbef27cb329..43e6f52c2551 100644
--- a/drivers/staging/sm750fb/sm750_cursor.c
+++ b/drivers/staging/sm750fb/sm750_cursor.c
@@ -97,7 +97,7 @@ void sm750_hw_cursor_setData(struct lynx_cursor *cursor, u16 
rop,
count = pitch * cursor->h;
 
/* in byte */
-   offset = cursor->maxW * 2 / 8;
+   offset = cursor->max_w * 2 / 8;
 
data = 0;
pstart = cursor->vstart;
@@ -147,7 +147,7 @@ void sm750_hw_cursor_setData2(struct lynx_cursor *cursor, 
u16 rop,
count = pitch * cursor->h;
 
/* in byte */
-   offset = cursor->maxW * 2 / 8;
+   offset = cursor->max_w * 2 / 8;
 
data = 0;
pstart = cursor->vstart;
-- 
2.30.2



[PATCH v2 26/49] staging: sm750fb: Update function parameter of sm750_hw_imageblit to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpoint.pl checks for the function parameter
fColor in the function sm750_hw_imageblit.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 8ab7d827a99e..d0b64962b10e 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -310,14 +310,14 @@ static unsigned int de_get_transparency(struct lynx_accel 
*accel)
  * @dy: Starting y coordinate of destination surface
  * @width: width of rectangle in pixel value
  * @height: height of rectangle in pixel value
- * @fColor: Foreground color (corresponding to a 1 in the monochrome data
+ * @f_color: Foreground color (corresponding to a 1 in the monochrome data
  * @b_olor: Background color (corresponding to a 0 in the monochrome data
  * @rop2: ROP value
  */
 int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
   u32 src_delta, u32 start_bit, u32 d_base, u32 d_pitch,
   u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
-  u32 height, u32 fColor, u32 b_olor, u32 rop2)
+  u32 height, u32 f_color, u32 b_olor, u32 rop2)
 {
unsigned int ul_bytes_per_scan;
unsigned int ul4_bytes_per_scan;
@@ -383,7 +383,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char 
*src_buf,
  ((width << DE_DIMENSION_X_SHIFT) & DE_DIMENSION_X_MASK) |
  (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */
 
-   write_dpr(accel, DE_FOREGROUND, fColor);
+   write_dpr(accel, DE_FOREGROUND, f_color);
write_dpr(accel, DE_BACKGROUND, b_olor);
 
de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) |
-- 
2.30.2



[PATCH v2 25/49] staging: sm750fb: Rename deGetTransparency to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
deGetTransparency in sm750_accel.c.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 1eeedacfc4a8..8ab7d827a99e 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -284,7 +284,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
return 0;
 }
 
-static unsigned int deGetTransparency(struct lynx_accel *accel)
+static unsigned int de_get_transparency(struct lynx_accel *accel)
 {
unsigned int de_ctrl;
 
@@ -390,7 +390,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char 
*src_buf,
DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE |
DE_CONTROL_HOST | DE_CONTROL_STATUS;
 
-   write_dpr(accel, DE_CONTROL, de_ctrl | deGetTransparency(accel));
+   write_dpr(accel, DE_CONTROL, de_ctrl | de_get_transparency(accel));
 
/* Write MONO data (line by line) to 2D Engine data port */
for (i = 0; i < height; i++) {
-- 
2.30.2



[PATCH v2 23/49] staging: sm750fb: Update local variables in sm750_hw_imageblit to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpoint.pl checks for the local variables
in the function sm750_hw_imageblit.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 760dd036d71a..c840873e9622 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -319,17 +319,17 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const 
char *src_buf,
   u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
   u32 height, u32 fColor, u32 b_olor, u32 rop2)
 {
-   unsigned int ulBytesPerScan;
-   unsigned int ul4BytesPerScan;
-   unsigned int ulBytesRemain;
+   unsigned int ul_bytes_per_scan;
+   unsigned int ul4_bytes_per_scan;
+   unsigned int ul_bytes_remain;
unsigned int de_ctrl = 0;
-   unsigned char ajRemain[4];
+   unsigned char aj_remain[4];
int i, j;
 
start_bit &= 7; /* Just make sure the start bit is within legal range */
-   ulBytesPerScan = (width + start_bit + 7) / 8;
-   ul4BytesPerScan = ulBytesPerScan & ~3;
-   ulBytesRemain = ulBytesPerScan & 3;
+   ul_bytes_per_scan = (width + start_bit + 7) / 8;
+   ul4_bytes_per_scan = ul_bytes_per_scan & ~3;
+   ul_bytes_remain = ul_bytes_per_scan & 3;
 
if (accel->de_wait() != 0)
return -1;
@@ -395,13 +395,13 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const 
char *src_buf,
/* Write MONO data (line by line) to 2D Engine data port */
for (i = 0; i < height; i++) {
/* For each line, send the data in chunks of 4 bytes */
-   for (j = 0; j < (ul4BytesPerScan / 4); j++)
+   for (j = 0; j < (ul4_bytes_per_scan / 4); j++)
write_dp_port(accel, *(unsigned int *)(src_buf + (j * 
4)));
 
-   if (ulBytesRemain) {
-   memcpy(ajRemain, src_buf + ul4BytesPerScan,
-  ulBytesRemain);
-   write_dp_port(accel, *(unsigned int *)ajRemain);
+   if (ul_bytes_remain) {
+   memcpy(aj_remain, src_buf + ul4_bytes_per_scan,
+  ul_bytes_remain);
+   write_dp_port(accel, *(unsigned int *)aj_remain);
}
 
src_buf += src_delta;
-- 
2.30.2



[PATCH v2 24/49] staging: sm750fb: Update local variable in sm750_hw_fillrect to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpoint.pl checks for the local variable
deCtrl in the function sm750_hw_fillrect.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index c840873e9622..1eeedacfc4a8 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -90,7 +90,7 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
  u32 x, u32 y, u32 width, u32 height,
  u32 color, u32 rop)
 {
-   u32 deCtrl;
+   u32 de_ctrl;
 
if (accel->de_wait() != 0) {
/*
@@ -122,11 +122,11 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
  ((width << DE_DIMENSION_X_SHIFT) & DE_DIMENSION_X_MASK) |
  (height & DE_DIMENSION_Y_ET_MASK)); /* dpr8 */
 
-   deCtrl = DE_CONTROL_STATUS | DE_CONTROL_LAST_PIXEL |
+   de_ctrl = DE_CONTROL_STATUS | DE_CONTROL_LAST_PIXEL |
DE_CONTROL_COMMAND_RECTANGLE_FILL | DE_CONTROL_ROP_SELECT |
(rop & DE_CONTROL_ROP_MASK); /* dpr0xc */
 
-   write_dpr(accel, DE_CONTROL, deCtrl);
+   write_dpr(accel, DE_CONTROL, de_ctrl);
return 0;
 }
 
-- 
2.30.2



[PATCH v2 22/49] staging: sm750fb: Update local variable in sm750_hw_copyarea to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpoint.pl checks for the local variable
nDirection in the function sm750_hw_copyarea.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 4ad2814b5b54..760dd036d71a 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -153,9 +153,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
  unsigned int width, unsigned int height,
  unsigned int rop2)
 {
-   unsigned int nDirection, de_ctrl;
+   unsigned int n_direction, de_ctrl;
 
-   nDirection = LEFT_TO_RIGHT;
+   n_direction = LEFT_TO_RIGHT;
/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left 
*/
de_ctrl = 0;
 
@@ -173,7 +173,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 *  +--+
 */
 
-   nDirection = BOTTOM_TO_TOP;
+   n_direction = BOTTOM_TO_TOP;
} else if (sy > dy) {
/*  +--+
 *  |D |
@@ -185,7 +185,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 *  +--+
 */
 
-   nDirection = TOP_TO_BOTTOM;
+   n_direction = TOP_TO_BOTTOM;
} else {
/* sy == dy */
 
@@ -198,7 +198,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 * +--+---+--+
 */
 
-   nDirection = RIGHT_TO_LEFT;
+   n_direction = RIGHT_TO_LEFT;
} else {
/* sx > dx */
 
@@ -210,12 +210,12 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 * +--+---+--+
 */
 
-   nDirection = LEFT_TO_RIGHT;
+   n_direction = LEFT_TO_RIGHT;
}
}
}
 
-   if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) {
+   if ((n_direction == BOTTOM_TO_TOP) || (n_direction == RIGHT_TO_LEFT)) {
sx += width - 1;
sy += height - 1;
dx += width - 1;
@@ -277,7 +277,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
  (height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */
 
de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) | DE_CONTROL_ROP_SELECT |
-   ((nDirection == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) |
+   ((n_direction == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) |
DE_CONTROL_COMMAND_BITBLT | DE_CONTROL_STATUS;
write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */
 
-- 
2.30.2



[PATCH v2 20/49] staging: sm750fb: Update function parameter names to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for function
parameter names in sm750_accel.c.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 92 +--
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 8faa601c700b..4327bda871e1 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -18,9 +18,9 @@
 
 #include "sm750.h"
 #include "sm750_accel.h"
-static inline void write_dpr(struct lynx_accel *accel, int offset, u32 
regValue)
+static inline void write_dpr(struct lynx_accel *accel, int offset, u32 
reg_value)
 {
-   writel(regValue, accel->dprBase + offset);
+   writel(reg_value, accel->dprBase + offset);
 }
 
 static inline u32 read_dpr(struct lynx_accel *accel, int offset)
@@ -86,7 +86,7 @@ void sm750_hw_set2dformat(struct lynx_accel *accel, int fmt)
 }
 
 int sm750_hw_fillrect(struct lynx_accel *accel,
- u32 base, u32 pitch, u32 Bpp,
+ u32 base, u32 pitch, u32 bpp,
  u32 x, u32 y, u32 width, u32 height,
  u32 color, u32 rop)
 {
@@ -103,14 +103,14 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
 
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, base); /* dpr40 */
write_dpr(accel, DE_PITCH,
- ((pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
+ ((pitch / bpp << DE_PITCH_DESTINATION_SHIFT) &
   DE_PITCH_DESTINATION_MASK) |
- (pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
+ (pitch / bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
 
write_dpr(accel, DE_WINDOW_WIDTH,
- ((pitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
+ ((pitch / bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
   DE_WINDOW_WIDTH_DST_MASK) |
-  (pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr44 */
+  (pitch / bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr44 */
 
write_dpr(accel, DE_FOREGROUND, color); /* DPR14 */
 
@@ -132,13 +132,13 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
 
 /**
  * sm750_hm_copyarea
- * @sBase: Address of source: offset in frame buffer
- * @sPitch: Pitch value of source surface in BYTE
+ * @s_base: Address of source: offset in frame buffer
+ * @s_pitch: Pitch value of source surface in BYTE
  * @sx: Starting x coordinate of source surface
  * @sy: Starting y coordinate of source surface
- * @dBase: Address of destination: offset in frame buffer
- * @dPitch: Pitch value of destination surface in BYTE
- * @Bpp: Color depth of destination surface
+ * @d_base: Address of destination: offset in frame buffer
+ * @d_pitch: Pitch value of destination surface in BYTE
+ * @bpp: Color depth of destination surface
  * @dx: Starting x coordinate of destination surface
  * @dy: Starting y coordinate of destination surface
  * @width: width of rectangle in pixel value
@@ -146,10 +146,10 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
  * @rop2: ROP value
  */
 int sm750_hw_copyarea(struct lynx_accel *accel,
- unsigned int sBase, unsigned int sPitch,
+ unsigned int s_base, unsigned int s_pitch,
  unsigned int sx, unsigned int sy,
- unsigned int dBase, unsigned int dPitch,
- unsigned int Bpp, unsigned int dx, unsigned int dy,
+ unsigned int d_base, unsigned int d_pitch,
+ unsigned int bpp, unsigned int dx, unsigned int dy,
  unsigned int width, unsigned int height,
  unsigned int rop2)
 {
@@ -160,7 +160,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
de_ctrl = 0;
 
/* If source and destination are the same surface, need to check for 
overlay cases */
-   if (sBase == dBase && sPitch == dPitch) {
+   if (s_base == d_base && s_pitch == d_pitch) {
/* Determine direction of operation */
if (sy < dy) {
/*  +--+
@@ -234,14 +234,14 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 * It is an address offset (128 bit aligned)
 * from the beginning of frame buffer.
 */
-   write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */
+   write_dpr(accel, DE_WINDOW_SOURCE_BASE, s_base); /* dpr40 */
 
/*
 * 2D Destination Base.
 * It is an address offset (128 bit aligned)
 * from the beginning of frame buffer.
 */
-   write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */
+   write_dpr(accel, DE_WINDOW_DESTINATION_BASE, d_base); /* dpr44 */
 
/*
 * Program pitch (distance between the 1st points of two adjacent 
lines).
@@ -249,9 +249,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
 * pixel values. Need Byte to pixel conversio

[PATCH v2 21/49] staging: sm750fb: Rename function write_dpPort to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the function
write_dpPort.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/sm750_accel.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/sm750_accel.c 
b/drivers/staging/sm750fb/sm750_accel.c
index 4327bda871e1..4ad2814b5b54 100644
--- a/drivers/staging/sm750fb/sm750_accel.c
+++ b/drivers/staging/sm750fb/sm750_accel.c
@@ -28,7 +28,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int 
offset)
return readl(accel->dprBase + offset);
 }
 
-static inline void write_dpPort(struct lynx_accel *accel, u32 data)
+static inline void write_dp_port(struct lynx_accel *accel, u32 data)
 {
writel(data, accel->dpPortBase);
 }
@@ -396,12 +396,12 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const 
char *src_buf,
for (i = 0; i < height; i++) {
/* For each line, send the data in chunks of 4 bytes */
for (j = 0; j < (ul4BytesPerScan / 4); j++)
-   write_dpPort(accel, *(unsigned int *)(src_buf + (j * 
4)));
+   write_dp_port(accel, *(unsigned int *)(src_buf + (j * 
4)));
 
if (ulBytesRemain) {
memcpy(ajRemain, src_buf + ul4BytesPerScan,
   ulBytesRemain);
-   write_dpPort(accel, *(unsigned int *)ajRemain);
+   write_dp_port(accel, *(unsigned int *)ajRemain);
}
 
src_buf += src_delta;
-- 
2.30.2



[PATCH v2 19/49] staging: sm750fb: Rename function parameter of sii164_enable_hot_plug_detection

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the function parameter
enable_hot_plug in the prototype of the function
sii164_enable_hot_plug_detection.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.h 
b/drivers/staging/sm750fb/ddk750_sii164.h
index ceafac60340f..ac1431dcb419 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.h
+++ b/drivers/staging/sm750fb/ddk750_sii164.h
@@ -34,7 +34,7 @@ unsigned short sii164_get_device_id(void);
 void sii164_reset_chip(void);
 char *sii164_get_chip_string(void);
 void sii164_set_power(unsigned char powerUp);
-void sii164_enable_hot_plug_detection(unsigned char enableHotPlug);
+void sii164_enable_hot_plug_detection(unsigned char enable_hot_plug);
 unsigned char sii164_is_connected(void);
 unsigned char sii164_check_interrupt(void);
 void sii164_clear_interrupt(void);
-- 
2.30.2



[PATCH v2 18/49] staging: sm750fb: Rename function params of sii164_init_chip

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for function parameter
names of the function sii164_init_chip.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.h | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.h 
b/drivers/staging/sm750fb/ddk750_sii164.h
index cf17b9029496..ceafac60340f 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.h
+++ b/drivers/staging/sm750fb/ddk750_sii164.h
@@ -16,16 +16,16 @@ enum sii164_hot_plug_mode {
 };
 
 /* Silicon Image SiI164 chip prototype */
-long sii164_init_chip(unsigned char edgeSelect,
-   unsigned char busSelect,
-   unsigned char dualEdgeClkSelect,
-   unsigned char hsyncEnable,
-   unsigned char vsyncEnable,
-   unsigned char deskewEnable,
-   unsigned char deskewSetting,
-   unsigned char continuousSyncEnable,
-   unsigned char pllFilterEnable,
-   unsigned char pllFilterValue);
+long sii164_init_chip(unsigned char edge_select,
+   unsigned char bus_select,
+   unsigned char dual_edge_clk_select,
+   unsigned char hsync_enable,
+   unsigned char vsync_enable,
+   unsigned char deskew_enable,
+   unsigned char deskew_setting,
+   unsigned char continuous_sync_enable,
+   unsigned char pll_filter_enable,
+   unsigned char pll_filter_value);
 
 unsigned short sii164_get_vendor_id(void);
 unsigned short sii164_get_device_id(void);
-- 
2.30.2



[PATCH] HID: picolcd: remove unused variable

2021-04-06 Thread Jiapeng Chong
Fix the following gcc warning:

drivers/hid/hid-picolcd_core.c:332:6: warning: variable ‘ret’ set but
not used [-Wunused-but-set-variable].

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 drivers/hid/hid-picolcd_core.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c
index 1b5c632..682c2a2 100644
--- a/drivers/hid/hid-picolcd_core.c
+++ b/drivers/hid/hid-picolcd_core.c
@@ -329,7 +329,6 @@ static int picolcd_raw_event(struct hid_device *hdev,
 {
struct picolcd_data *data = hid_get_drvdata(hdev);
unsigned long flags;
-   int ret = 0;
 
if (!data)
return 1;
@@ -342,9 +341,9 @@ static int picolcd_raw_event(struct hid_device *hdev,
 
if (report->id == REPORT_KEY_STATE) {
if (data->input_keys)
-   ret = picolcd_raw_keypad(data, report, raw_data+1, 
size-1);
+   picolcd_raw_keypad(data, report, raw_data+1, size-1);
} else if (report->id == REPORT_IR_DATA) {
-   ret = picolcd_raw_cir(data, report, raw_data+1, size-1);
+   picolcd_raw_cir(data, report, raw_data+1, size-1);
} else {
spin_lock_irqsave(&data->lock, flags);
/*
-- 
1.8.3.1



[PATCH v2 17/49] staging: sm750fb: Rename local variables to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for local
variables in SII164_FULL_FUNCTIONS block.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 40 -
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index 869d74f53a6a..758a118e4421 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -304,28 +304,28 @@ void sii164_set_power(unsigned char power_up)
 static
 void sii164_select_hot_plug_detection_mode(enum sii164_hot_plug_mode 
hot_plug_mode)
 {
-   unsigned char detectReg;
+   unsigned char detect_reg;
 
-   detectReg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
+   detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG;
switch (hot_plug_mode) {
case SII164_HOTPLUG_DISABLE:
-   detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH;
+   detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH;
break;
case SII164_HOTPLUG_USE_MDI:
-   detectReg &= ~SII164_DETECT_INTERRUPT_MASK;
-   detectReg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN;
-   detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI;
+   detect_reg &= ~SII164_DETECT_INTERRUPT_MASK;
+   detect_reg |= SII164_DETECT_INTERRUPT_BY_HTPLG_PIN;
+   detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_MDI;
break;
case SII164_HOTPLUG_USE_RSEN:
-   detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN;
+   detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_RSEN;
break;
case SII164_HOTPLUG_USE_HTPLG:
-   detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG;
+   detect_reg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HTPLG;
break;
}
 
-   i2c_write_reg(SII164_I2C_ADDRESS, SII164_DETECT, detectReg);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_DETECT, detect_reg);
 }
 
 /*
@@ -336,9 +336,9 @@ void sii164_select_hot_plug_detection_mode(enum 
sii164_hot_plug_mode hot_plug_mo
  */
 void sii164_enable_hot_plug_detection(unsigned char enable_hot_plug)
 {
-   unsigned char detectReg;
+   unsigned char detect_reg;
 
-   detectReg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT);
+   detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT);
 
/* Depending on each DVI controller, need to enable the hot plug based
 * on each individual chip design.
@@ -359,11 +359,11 @@ void sii164_enable_hot_plug_detection(unsigned char 
enable_hot_plug)
  */
 unsigned char sii164_is_connected(void)
 {
-   unsigned char hotPlugValue;
+   unsigned char hot_plug_value;
 
-   hotPlugValue = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
+   hot_plug_value = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
   SII164_DETECT_HOT_PLUG_STATUS_MASK;
-   if (hotPlugValue == SII164_DETECT_HOT_PLUG_STATUS_ON)
+   if (hot_plug_value == SII164_DETECT_HOT_PLUG_STATUS_ON)
return 1;
else
return 0;
@@ -379,11 +379,11 @@ unsigned char sii164_is_connected(void)
  */
 unsigned char sii164_check_interrupt(void)
 {
-   unsigned char detectReg;
+   unsigned char detect_reg;
 
-   detectReg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
+   detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
SII164_DETECT_MONITOR_STATE_MASK;
-   if (detectReg == SII164_DETECT_MONITOR_STATE_CHANGE)
+   if (detect_reg == SII164_DETECT_MONITOR_STATE_CHANGE)
return 1;
else
return 0;
@@ -395,12 +395,12 @@ unsigned char sii164_check_interrupt(void)
  */
 void sii164_clear_interrupt(void)
 {
-   unsigned char detectReg;
+   unsigned char detect_reg;
 
/* Clear the MDI interrupt */
-   detectReg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT);
+   detect_reg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT);
i2c_write_reg(SII164_I2C_ADDRESS, SII164_DETECT,
-   detectReg | SII164_DETECT_MONITOR_STATE_CLEAR);
+   detect_reg | SII164_DETECT_MONITOR_STATE_CLEAR);
 }
 
 #endif
-- 
2.30.2



[PATCH v2 16/49] staging: sm750fb: Update function parameter names in ddk750_sii164.c

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for function
parameters in ddk750_sii164.c.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index a7e0f001d96f..869d74f53a6a 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -277,14 +277,14 @@ char *sii164_get_chip_string(void)
  *  This function sets the power configuration of the DVI Controller Chip.
  *
  *  Input:
- *  powerUp - Flag to set the power down or up
+ *  power_up - Flag to set the power down or up
  */
-void sii164_set_power(unsigned char powerUp)
+void sii164_set_power(unsigned char power_up)
 {
unsigned char config;
 
config = i2c_read_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
-   if (powerUp == 1) {
+   if (power_up == 1) {
/* Power up the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_NORMAL;
@@ -302,13 +302,13 @@ void sii164_set_power(unsigned char powerUp)
  *  This function selects the mode of the hot plug detection.
  */
 static
-void sii164_select_hot_plug_detection_mode(enum sii164_hot_plug_mode 
hotPlugMode)
+void sii164_select_hot_plug_detection_mode(enum sii164_hot_plug_mode 
hot_plug_mode)
 {
unsigned char detectReg;
 
detectReg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG;
-   switch (hotPlugMode) {
+   switch (hot_plug_mode) {
case SII164_HOTPLUG_DISABLE:
detectReg |= SII164_DETECT_MONITOR_SENSE_OUTPUT_HIGH;
break;
@@ -332,9 +332,9 @@ void sii164_select_hot_plug_detection_mode(enum 
sii164_hot_plug_mode hotPlugMode
  *  sii164_enable_hot_plug_detection
  *  This function enables the Hot Plug detection.
  *
- *  enableHotPlug   - Enable (=1) / disable (=0) Hot Plug detection
+ *  enable_hot_plug   - Enable (=1) / disable (=0) Hot Plug detection
  */
-void sii164_enable_hot_plug_detection(unsigned char enableHotPlug)
+void sii164_enable_hot_plug_detection(unsigned char enable_hot_plug)
 {
unsigned char detectReg;
 
@@ -343,7 +343,7 @@ void sii164_enable_hot_plug_detection(unsigned char 
enableHotPlug)
/* Depending on each DVI controller, need to enable the hot plug based
 * on each individual chip design.
 */
-   if (enableHotPlug != 0)
+   if (enable_hot_plug != 0)
sii164_select_hot_plug_detection_mode(SII164_HOTPLUG_USE_MDI);
else
sii164_select_hot_plug_detection_mode(SII164_HOTPLUG_DISABLE);
-- 
2.30.2



[PATCH v2 15/49] staging: sm750fb: Rename gDviCtrlChipName to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the
global variable gDviCtrlChipName.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index 7e0a481970f5..a7e0f001d96f 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -25,7 +25,7 @@
 
 #ifdef SII164_FULL_FUNCTIONS
 /* Name of the DVI Controller chip */
-static char *gDviCtrlChipName = "Silicon Image SiI 164";
+static char *dvi_ctrl_chip_name = "Silicon Image SiI 164";
 #endif
 
 /*
@@ -269,7 +269,7 @@ void sii164_reset_chip(void)
  */
 char *sii164_get_chip_string(void)
 {
-   return gDviCtrlChipName;
+   return dvi_ctrl_chip_name;
 }
 
 /*
-- 
2.30.2



[PATCH v2 14/49] staging: sm750fb: Rename sii164SelectHotPlugDetectionMode to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the function
sii164SelectHotPlugDetectionMode in ddk750_sii164.c.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index ceeb914f8441..7e0a481970f5 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -298,11 +298,11 @@ void sii164_set_power(unsigned char powerUp)
 }
 
 /*
- *  sii164SelectHotPlugDetectionMode
+ *  sii164_select_hot_plug_detection_mode
  *  This function selects the mode of the hot plug detection.
  */
 static
-void sii164SelectHotPlugDetectionMode(enum sii164_hot_plug_mode hotPlugMode)
+void sii164_select_hot_plug_detection_mode(enum sii164_hot_plug_mode 
hotPlugMode)
 {
unsigned char detectReg;
 
@@ -344,9 +344,9 @@ void sii164_enable_hot_plug_detection(unsigned char 
enableHotPlug)
 * on each individual chip design.
 */
if (enableHotPlug != 0)
-   sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_USE_MDI);
+   sii164_select_hot_plug_detection_mode(SII164_HOTPLUG_USE_MDI);
else
-   sii164SelectHotPlugDetectionMode(SII164_HOTPLUG_DISABLE);
+   sii164_select_hot_plug_detection_mode(SII164_HOTPLUG_DISABLE);
 }
 
 /*
-- 
2.30.2



[PATCH v2 12/49] staging: sm750fb: Rename vendorID local variable to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the local
variable vendorID in the function sii164_get_vendor_id.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index af14273b99eb..14d7083775b4 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -37,14 +37,14 @@ static char *gDviCtrlChipName = "Silicon Image SiI 164";
  */
 unsigned short sii164_get_vendor_id(void)
 {
-   unsigned short vendorID;
+   unsigned short vendor_id;
 
-   vendorID = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
+   vendor_id = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
   SII164_VENDOR_ID_HIGH) << 8) |
   (unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
  SII164_VENDOR_ID_LOW);
 
-   return vendorID;
+   return vendor_id;
 }
 
 /*
-- 
2.30.2



[PATCH v2 13/49] staging: sm750fb: Rename deviceID local variable to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the local
variable deviceID in the function sii164_get_device_id.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index 14d7083775b4..ceeb914f8441 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -56,14 +56,14 @@ unsigned short sii164_get_vendor_id(void)
  */
 unsigned short sii164_get_device_id(void)
 {
-   unsigned short deviceID;
+   unsigned short device_id;
 
-   deviceID = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
+   device_id = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
   SII164_DEVICE_ID_HIGH) << 8) |
   (unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
  SII164_DEVICE_ID_LOW);
 
-   return deviceID;
+   return device_id;
 }
 
 /*
-- 
2.30.2



[PATCH v2] usb: cdnsp: Fixes issue with Configure Endpoint command

2021-04-06 Thread Pawel Laszczak
From: Pawel Laszczak 

Patch adds flag EP_UNCONFIGURED to detect whether endpoint was
unconfigured. This flag is set in cdnsp_reset_device after Reset Device
command. Among others this command disables all non control endpoints.
Flag is used in cdnsp_gadget_ep_disable to protect controller against
invoking Configure Endpoint command on disabled endpoint. Lack of this
protection in some cases caused that Configure Endpoint command completed
with Context State Error code completion.

Fixes: 3d82904559f4 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD 
Driver")
Signed-off-by: Pawel Laszczak 

---
Changelog:
v2:
- removed useless blank line
- changed the EP_UNCONFIGURED to limit changes in patch

 drivers/usb/cdns3/cdnsp-gadget.c | 17 -
 drivers/usb/cdns3/cdnsp-gadget.h |  1 +
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/cdns3/cdnsp-gadget.c b/drivers/usb/cdns3/cdnsp-gadget.c
index d7d4bdd57f46..56707b6b0f57 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.c
+++ b/drivers/usb/cdns3/cdnsp-gadget.c
@@ -727,7 +727,7 @@ int cdnsp_reset_device(struct cdnsp_device *pdev)
 * are in Disabled state.
 */
for (i = 1; i < CDNSP_ENDPOINTS_NUM; ++i)
-   pdev->eps[i].ep_state |= EP_STOPPED;
+   pdev->eps[i].ep_state |= EP_STOPPED | EP_UNCONFIGURED;
 
trace_cdnsp_handle_cmd_reset_dev(slot_ctx);
 
@@ -942,6 +942,7 @@ static int cdnsp_gadget_ep_enable(struct usb_ep *ep,
 
pep = to_cdnsp_ep(ep);
pdev = pep->pdev;
+   pep->ep_state &= ~EP_UNCONFIGURED;
 
if (dev_WARN_ONCE(pdev->dev, pep->ep_state & EP_ENABLED,
  "%s is already enabled\n", pep->name))
@@ -1023,9 +1024,13 @@ static int cdnsp_gadget_ep_disable(struct usb_ep *ep)
goto finish;
}
 
-   cdnsp_cmd_stop_ep(pdev, pep);
pep->ep_state |= EP_DIS_IN_RROGRESS;
-   cdnsp_cmd_flush_ep(pdev, pep);
+
+   /* Endpoint was unconfigured by Reset Device command. */
+   if (!(pep->ep_state & EP_UNCONFIGURED)) {
+   cdnsp_cmd_stop_ep(pdev, pep);
+   cdnsp_cmd_flush_ep(pdev, pep);
+   }
 
/* Remove all queued USB requests. */
while (!list_empty(&pep->pending_list)) {
@@ -1043,10 +1048,12 @@ static int cdnsp_gadget_ep_disable(struct usb_ep *ep)
 
cdnsp_endpoint_zero(pdev, pep);
 
-   ret = cdnsp_update_eps_configuration(pdev, pep);
+   if (!(pep->ep_state & EP_UNCONFIGURED))
+   ret = cdnsp_update_eps_configuration(pdev, pep);
+
cdnsp_free_endpoint_rings(pdev, pep);
 
-   pep->ep_state &= ~EP_ENABLED;
+   pep->ep_state &= ~(EP_ENABLED | EP_UNCONFIGURED);
pep->ep_state |= EP_STOPPED;
 
 finish:
diff --git a/drivers/usb/cdns3/cdnsp-gadget.h b/drivers/usb/cdns3/cdnsp-gadget.h
index 6bbb26548c04..783ca8ffde00 100644
--- a/drivers/usb/cdns3/cdnsp-gadget.h
+++ b/drivers/usb/cdns3/cdnsp-gadget.h
@@ -835,6 +835,7 @@ struct cdnsp_ep {
 #define EP_WEDGE   BIT(4)
 #define EP0_HALTED_STATUS  BIT(5)
 #define EP_HAS_STREAMS BIT(6)
+#define EP_UNCONFIGUREDBIT(7)
 
bool skip;
 };
-- 
2.25.1



[PATCH v2 11/49] staging: sm750fb: Rename i2cWriteReg and i2cReadReg to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for i2cWriteReg
and i2cReadReg in ddk750_sii164.c.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_sii164.c | 46 -
 1 file changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index 6c343e2e0433..af14273b99eb 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -12,11 +12,11 @@
 #define USE_HW_I2C
 
 #ifdef USE_HW_I2C
-#define i2cWriteReg sm750_hw_i2c_write_reg
-#define i2cReadReg  sm750_hw_i2c_read_reg
+#define i2c_write_reg sm750_hw_i2c_write_reg
+#define i2c_read_reg  sm750_hw_i2c_read_reg
 #else
-#define i2cWriteReg sm750_sw_i2c_write_reg
-#define i2cReadReg  sm750_sw_i2c_read_reg
+#define i2c_write_reg sm750_sw_i2c_write_reg
+#define i2c_read_reg  sm750_sw_i2c_read_reg
 #endif
 
 /* SII164 Vendor and Device ID */
@@ -39,9 +39,9 @@ unsigned short sii164_get_vendor_id(void)
 {
unsigned short vendorID;
 
-   vendorID = ((unsigned short)i2cReadReg(SII164_I2C_ADDRESS,
+   vendorID = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
   SII164_VENDOR_ID_HIGH) << 8) |
-  (unsigned short)i2cReadReg(SII164_I2C_ADDRESS,
+  (unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
  SII164_VENDOR_ID_LOW);
 
return vendorID;
@@ -58,9 +58,9 @@ unsigned short sii164_get_device_id(void)
 {
unsigned short deviceID;
 
-   deviceID = ((unsigned short)i2cReadReg(SII164_I2C_ADDRESS,
+   deviceID = ((unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
   SII164_DEVICE_ID_HIGH) << 8) |
-  (unsigned short)i2cReadReg(SII164_I2C_ADDRESS,
+  (unsigned short)i2c_read_reg(SII164_I2C_ADDRESS,
  SII164_DEVICE_ID_LOW);
 
return deviceID;
@@ -176,7 +176,7 @@ long sii164_init_chip(unsigned char edge_select,
else
config |= SII164_CONFIGURATION_VSYNC_AS_IS;
 
-   i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
 
/*
 * De-skew enabled with default 111b value.
@@ -214,7 +214,7 @@ long sii164_init_chip(unsigned char edge_select,
config |= SII164_DESKEW_8_STEP;
break;
}
-   i2cWriteReg(SII164_I2C_ADDRESS, SII164_DESKEW, config);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_DESKEW, config);
 
/* Enable/Disable Continuous Sync. */
if (continuous_sync_enable == 0)
@@ -231,12 +231,12 @@ long sii164_init_chip(unsigned char edge_select,
/* Set the PLL Filter value */
config |= ((pll_filter_value & 0x07) << 1);
 
-   i2cWriteReg(SII164_I2C_ADDRESS, SII164_PLL, config);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_PLL, config);
 
/* Recover from Power Down and enable output. */
-   config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
+   config = i2c_read_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
config |= SII164_CONFIGURATION_POWER_NORMAL;
-   i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
 
return 0;
}
@@ -283,17 +283,17 @@ void sii164_set_power(unsigned char powerUp)
 {
unsigned char config;
 
-   config = i2cReadReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
+   config = i2c_read_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION);
if (powerUp == 1) {
/* Power up the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_NORMAL;
-   i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
} else {
/* Power down the chip */
config &= ~SII164_CONFIGURATION_POWER_MASK;
config |= SII164_CONFIGURATION_POWER_DOWN;
-   i2cWriteReg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
+   i2c_write_reg(SII164_I2C_ADDRESS, SII164_CONFIGURATION, config);
}
 }
 
@@ -306,7 +306,7 @@ void sii164SelectHotPlugDetectionMode(enum 
sii164_hot_plug_mode hotPlugMode)
 {
unsigned char detectReg;
 
-   detectReg = i2cReadReg(SII164_I2C_ADDRESS, SII164_DETECT) &
+   detectReg = i2c_read_reg(SII164_I2C_ADDRESS, SII164_DETECT) &
~SII164_DETECT_MONITOR_SENSE_OUTPUT_FLAG;
switch (ho

[PATCH v2 10/49] staging: sm750fb: Rename ddk750_setModeTiming to ddk750_set_mode_timing

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the function
ddk750_setModeTiming.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_mode.c | 2 +-
 drivers/staging/sm750fb/ddk750_mode.h | 2 +-
 drivers/staging/sm750fb/sm750_hw.c| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 5c685b4e2fd6..2548695829ec 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -207,7 +207,7 @@ static int program_mode_registers(struct mode_parameter 
*mode_param,
return ret;
 }
 
-int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type clock)
+int ddk750_set_mode_timing(struct mode_parameter *parm, enum clock_type clock)
 {
struct pll_value pll;
 
diff --git a/drivers/staging/sm750fb/ddk750_mode.h 
b/drivers/staging/sm750fb/ddk750_mode.h
index 2df78a0937b2..1b70885f85e5 100644
--- a/drivers/staging/sm750fb/ddk750_mode.h
+++ b/drivers/staging/sm750fb/ddk750_mode.h
@@ -33,5 +33,5 @@ struct mode_parameter {
enum spolarity clock_phase_polarity;
 };
 
-int ddk750_setModeTiming(struct mode_parameter *parm, enum clock_type clock);
+int ddk750_set_mode_timing(struct mode_parameter *parm, enum clock_type clock);
 #endif
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 7136d751cff5..e31f4c6bc69e 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -305,7 +305,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
clock = SECONDARY_PLL;
 
pr_debug("Request pixel clock = %lu\n", modparm.pixel_clock);
-   ret = ddk750_setModeTiming(&modparm, clock);
+   ret = ddk750_set_mode_timing(&modparm, clock);
if (ret) {
pr_err("Set mode timing failed\n");
goto exit;
-- 
2.30.2



[PATCH v2 09/49] staging: sm750fb: Rename sm750_set_power_mode function parameter

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the function parameter
powerMode of function sm750_set_power_mode.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_power.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/sm750fb/ddk750_power.h 
b/drivers/staging/sm750fb/ddk750_power.h
index 4756db1ccb9c..d43942d6a5aa 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -15,7 +15,7 @@ enum dpms {
 }
 
 void ddk750_set_dpms(enum dpms state);
-void sm750_set_power_mode(unsigned int powerMode);
+void sm750_set_power_mode(unsigned int power_mode);
 void sm750_set_current_gate(unsigned int gate);
 
 /*
-- 
2.30.2



[PATCH v2 08/49] staging: sm750fb: Update enum values in dpms to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for values in
enum dpms.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_power.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_power.h 
b/drivers/staging/sm750fb/ddk750_power.h
index 7002567a47d2..4756db1ccb9c 100644
--- a/drivers/staging/sm750fb/ddk750_power.h
+++ b/drivers/staging/sm750fb/ddk750_power.h
@@ -3,10 +3,10 @@
 #define DDK750_POWER_H__
 
 enum dpms {
-   crtDPMS_ON = 0x0,
-   crtDPMS_STANDBY = 0x1,
-   crtDPMS_SUSPEND = 0x2,
-   crtDPMS_OFF = 0x3,
+   CRT_DPMS_ON = 0x0,
+   CRT_DPMS_STANDBY = 0x1,
+   CRT_DPMS_SUSPEND = 0x2,
+   CRT_DPMS_OFF = 0x3,
 };
 
 #define set_DAC(off) { \
-- 
2.30.2



[PATCH v2 06/49] staging: sm750fb: Update displayControlAdjust_SM750LE to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function
displayControlAdjust_SM750LE, including its name, parameters, and body.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_mode.c | 40 +--
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index e00a6cb31947..2fae81b47f46 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -14,13 +14,13 @@
  * in bit 29:27 of Display Control register.
  */
 static unsigned long
-displayControlAdjust_SM750LE(struct mode_parameter *pModeParam,
-unsigned long dispControl)
+display_control_adjust_sm750le(struct mode_parameter *mode_param,
+unsigned long disp_control)
 {
unsigned long x, y;
 
-   x = pModeParam->horizontal_display_end;
-   y = pModeParam->vertical_display_end;
+   x = mode_param->horizontal_display_end;
+   y = mode_param->vertical_display_end;
 
/*
 * SM750LE has to set up the top-left and bottom-right
@@ -36,42 +36,42 @@ displayControlAdjust_SM750LE(struct mode_parameter 
*pModeParam,
   ((x - 1) & CRT_AUTO_CENTERING_BR_RIGHT_MASK));
 
/*
-* Assume common fields in dispControl have been properly set before
+* Assume common fields in disp_control have been properly set before
 * calling this function.
-* This function only sets the extra fields in dispControl.
+* This function only sets the extra fields in disp_control.
 */
 
/* Clear bit 29:27 of display control register */
-   dispControl &= ~CRT_DISPLAY_CTRL_CLK_MASK;
+   disp_control &= ~CRT_DISPLAY_CTRL_CLK_MASK;
 
/* Set bit 29:27 of display control register for the right clock */
/* Note that SM750LE only need to supported 7 resolutions. */
if (x == 800 && y == 600)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL41;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL41;
else if (x == 1024 && y == 768)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL65;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL65;
else if (x == 1152 && y == 864)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL80;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL80;
else if (x == 1280 && y == 768)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL80;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL80;
else if (x == 1280 && y == 720)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL74;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL74;
else if (x == 1280 && y == 960)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL108;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL108;
else if (x == 1280 && y == 1024)
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL108;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL108;
else /* default to VGA clock */
-   dispControl |= CRT_DISPLAY_CTRL_CLK_PLL25;
+   disp_control |= CRT_DISPLAY_CTRL_CLK_PLL25;
 
/* Set bit 25:24 of display controller */
-   dispControl |= (CRT_DISPLAY_CTRL_CRTSELECT | CRT_DISPLAY_CTRL_RGBBIT);
+   disp_control |= (CRT_DISPLAY_CTRL_CRTSELECT | CRT_DISPLAY_CTRL_RGBBIT);
 
/* Set bit 14 of display controller */
-   dispControl |= DISPLAY_CTRL_CLOCK_PHASE;
+   disp_control |= DISPLAY_CTRL_CLOCK_PHASE;
 
-   poke32(CRT_DISPLAY_CTRL, dispControl);
+   poke32(CRT_DISPLAY_CTRL, disp_control);
 
-   return dispControl;
+   return disp_control;
 }
 
 /* only timing related registers will be  programed */
@@ -125,7 +125,7 @@ static int programModeRegisters(struct mode_parameter 
*pModeParam,
tmp |= DISPLAY_CTRL_HSYNC_PHASE;
 
if (sm750_get_chip_type() == SM750LE) {
-   displayControlAdjust_SM750LE(pModeParam, tmp);
+   display_control_adjust_sm750le(pModeParam, tmp);
} else {
reg = peek32(CRT_DISPLAY_CTRL) &
~(DISPLAY_CTRL_VSYNC_PHASE |
-- 
2.30.2



[PATCH v2 07/49] staging: sm750fb: Update programModeRegisters to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for the function
programModeRegisters, including its name, parameters, and body.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_mode.c | 48 +--
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 2fae81b47f46..5c685b4e2fd6 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -75,7 +75,7 @@ display_control_adjust_sm750le(struct mode_parameter 
*mode_param,
 }
 
 /* only timing related registers will be  programed */
-static int programModeRegisters(struct mode_parameter *pModeParam,
+static int program_mode_registers(struct mode_parameter *mode_param,
struct pll_value *pll)
 {
int ret = 0;
@@ -86,46 +86,46 @@ static int programModeRegisters(struct mode_parameter 
*pModeParam,
/* programe secondary pixel clock */
poke32(CRT_PLL_CTRL, sm750_format_pll_reg(pll));
 
-   tmp = ((pModeParam->horizontal_total - 1) <<
+   tmp = ((mode_param->horizontal_total - 1) <<
   CRT_HORIZONTAL_TOTAL_TOTAL_SHIFT) &
 CRT_HORIZONTAL_TOTAL_TOTAL_MASK;
-   tmp |= (pModeParam->horizontal_display_end - 1) &
+   tmp |= (mode_param->horizontal_display_end - 1) &
  CRT_HORIZONTAL_TOTAL_DISPLAY_END_MASK;
 
poke32(CRT_HORIZONTAL_TOTAL, tmp);
 
-   tmp = (pModeParam->horizontal_sync_width <<
+   tmp = (mode_param->horizontal_sync_width <<
   CRT_HORIZONTAL_SYNC_WIDTH_SHIFT) &
 CRT_HORIZONTAL_SYNC_WIDTH_MASK;
-   tmp |= (pModeParam->horizontal_sync_start - 1) &
+   tmp |= (mode_param->horizontal_sync_start - 1) &
  CRT_HORIZONTAL_SYNC_START_MASK;
 
poke32(CRT_HORIZONTAL_SYNC, tmp);
 
-   tmp = ((pModeParam->vertical_total - 1) <<
+   tmp = ((mode_param->vertical_total - 1) <<
   CRT_VERTICAL_TOTAL_TOTAL_SHIFT) &
 CRT_VERTICAL_TOTAL_TOTAL_MASK;
-   tmp |= (pModeParam->vertical_display_end - 1) &
+   tmp |= (mode_param->vertical_display_end - 1) &
  CRT_VERTICAL_TOTAL_DISPLAY_END_MASK;
 
poke32(CRT_VERTICAL_TOTAL, tmp);
 
-   tmp = ((pModeParam->vertical_sync_height <<
+   tmp = ((mode_param->vertical_sync_height <<
   CRT_VERTICAL_SYNC_HEIGHT_SHIFT)) &
 CRT_VERTICAL_SYNC_HEIGHT_MASK;
-   tmp |= (pModeParam->vertical_sync_start - 1) &
+   tmp |= (mode_param->vertical_sync_start - 1) &
  CRT_VERTICAL_SYNC_START_MASK;
 
poke32(CRT_VERTICAL_SYNC, tmp);
 
tmp = DISPLAY_CTRL_TIMING | DISPLAY_CTRL_PLANE;
-   if (pModeParam->vertical_sync_polarity)
+   if (mode_param->vertical_sync_polarity)
tmp |= DISPLAY_CTRL_VSYNC_PHASE;
-   if (pModeParam->horizontal_sync_polarity)
+   if (mode_param->horizontal_sync_polarity)
tmp |= DISPLAY_CTRL_HSYNC_PHASE;
 
if (sm750_get_chip_type() == SM750LE) {
-   display_control_adjust_sm750le(pModeParam, tmp);
+   display_control_adjust_sm750le(mode_param, tmp);
} else {
reg = peek32(CRT_DISPLAY_CTRL) &
~(DISPLAY_CTRL_VSYNC_PHASE |
@@ -140,40 +140,40 @@ static int programModeRegisters(struct mode_parameter 
*pModeParam,
 
poke32(PANEL_PLL_CTRL, sm750_format_pll_reg(pll));
 
-   reg = ((pModeParam->horizontal_total - 1) <<
+   reg = ((mode_param->horizontal_total - 1) <<
PANEL_HORIZONTAL_TOTAL_TOTAL_SHIFT) &
PANEL_HORIZONTAL_TOTAL_TOTAL_MASK;
-   reg |= ((pModeParam->horizontal_display_end - 1) &
+   reg |= ((mode_param->horizontal_display_end - 1) &
PANEL_HORIZONTAL_TOTAL_DISPLAY_END_MASK);
poke32(PANEL_HORIZONTAL_TOTAL, reg);
 
poke32(PANEL_HORIZONTAL_SYNC,
-  ((pModeParam->horizontal_sync_width <<
+  ((mode_param->horizontal_sync_width <<
 PANEL_HORIZONTAL_SYNC_WIDTH_SHIFT) &
PANEL_HORIZONTAL_SYNC_WIDTH_MASK) |
-  ((pModeParam->horizontal_sync_start - 1) &
+  ((mode_param->horizontal_sync_start - 1) &
PANEL_HORIZONTAL_SYNC_START_MASK));
 
poke32(PANEL_VERTICAL_TOTAL,
-  (((pModeParam->vertical_total - 1) <<
+  (((mode_param->vertic

[PATCH v2 05/49] staging: sm750fb: Remove remaining camel case names in ddk750_dvi.h

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl check for type definitions
DVICTRL_SETPOWER and DVICTRL_HOTPLUGDETECTION in ddk750_dvi.h.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_dvi.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.h 
b/drivers/staging/sm750fb/ddk750_dvi.h
index 8aee0cdf63a4..d953fb5ab9f2 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.h
+++ b/drivers/staging/sm750fb/ddk750_dvi.h
@@ -19,8 +19,8 @@ typedef void (*DVICTRL_RESETCHIP)(void);
 typedef char* (*DVICTRL_GETCHIPSTRING)(void);
 typedef unsigned short (*DVICTRL_GETVENDORID)(void);
 typedef unsigned short (*DVICTRL_GETDEVICEID)(void);
-typedef void (*DVICTRL_SETPOWER)(unsigned char powerUp);
-typedef void (*DVICTRL_HOTPLUGDETECTION)(unsigned char enableHotPlug);
+typedef void (*DVICTRL_SETPOWER)(unsigned char power_up);
+typedef void (*DVICTRL_HOTPLUGDETECTION)(unsigned char enable_hot_plug);
 typedef unsigned char (*DVICTRL_ISCONNECTED)(void);
 typedef unsigned char (*DVICTRL_CHECKINTERRUPT)(void);
 typedef void (*DVICTRL_CLEARINTERRUPT)(void);
-- 
2.30.2



[PATCH v2 03/49] staging: sm750fb: Update param names of PFN_DVICTRL_INIT function pointer

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for parameter names in the
type definition of PFN_DVICTRL_INIT function pointer.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_dvi.h | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.h 
b/drivers/staging/sm750fb/ddk750_dvi.h
index fbc897c7efb8..b2fd56ef51fc 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.h
+++ b/drivers/staging/sm750fb/ddk750_dvi.h
@@ -4,16 +4,16 @@
 
 /* dvi chip stuffs structros */
 
-typedef long (*PFN_DVICTRL_INIT)(unsigned char edgeSelect,
-unsigned char busSelect,
-unsigned char dualEdgeClkSelect,
-unsigned char hsyncEnable,
-unsigned char vsyncEnable,
-unsigned char deskewEnable,
-unsigned char deskewSetting,
-unsigned char continuousSyncEnable,
-unsigned char pllFilterEnable,
-unsigned char pllFilterValue);
+typedef long (*PFN_DVICTRL_INIT)(unsigned char edge_select,
+unsigned char bus_select,
+unsigned char dual_edge_clk_select,
+unsigned char hsync_enable,
+unsigned char vsync_enable,
+unsigned char deskew_enable,
+unsigned char deskew_setting,
+unsigned char continuous_sync_enable,
+unsigned char pll_filter_enable,
+unsigned char pll_filter_value);
 
 typedef void (*PFN_DVICTRL_RESETCHIP)(void);
 typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void);
-- 
2.30.2



[PATCH v2 04/49] staging: sm750fb: Remove type names in variables and type definitions

2021-04-06 Thread Pavle Rohalj
Remove type names used in variables and type definitions for
dvi_ctrl_device structure.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_dvi.c | 24 -
 drivers/staging/sm750fb/ddk750_dvi.h | 40 ++--
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index 943cbcafcffa..2743778abaab 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -14,17 +14,17 @@
 static struct dvi_ctrl_device dcft_supported_dvi_controller[] = {
 #ifdef DVI_CTRL_SII164
{
-   .pfn_init = sii164_init_chip,
-   .pfn_get_vendor_id = sii164_get_vendor_id,
-   .pfn_get_device_id = sii164_get_device_id,
+   .init = sii164_init_chip,
+   .get_vendor_id = sii164_get_vendor_id,
+   .get_device_id = sii164_get_device_id,
 #ifdef SII164_FULL_FUNCTIONS
-   .pfn_reset_chip = sii164_reset_chip,
-   .pfn_get_chip_string = sii164_get_chip_string,
-   .pfn_set_power = sii164_set_power,
-   .pfn_enable_hot_plug_detection = 
sii164_enable_hot_plug_detection,
-   .pfn_is_connected = sii164_is_connected,
-   .pfn_check_interrupt = sii164_check_interrupt,
-   .pfn_clear_interrupt = sii164_clear_interrupt,
+   .reset_chip = sii164_reset_chip,
+   .get_chip_string = sii164_get_chip_string,
+   .set_power = sii164_set_power,
+   .enable_hot_plug_detection = sii164_enable_hot_plug_detection,
+   .is_connected = sii164_is_connected,
+   .check_interrupt = sii164_check_interrupt,
+   .clear_interrupt = sii164_clear_interrupt,
 #endif
},
 #endif
@@ -44,8 +44,8 @@ int dvi_init(unsigned char edge_select,
struct dvi_ctrl_device *current_dvi_ctrl;
 
current_dvi_ctrl = dcft_supported_dvi_controller;
-   if (current_dvi_ctrl->pfn_init) {
-   return current_dvi_ctrl->pfn_init(edge_select,
+   if (current_dvi_ctrl->init) {
+   return current_dvi_ctrl->init(edge_select,
bus_select,
dual_edge_clk_select,
hsync_enable,
diff --git a/drivers/staging/sm750fb/ddk750_dvi.h 
b/drivers/staging/sm750fb/ddk750_dvi.h
index b2fd56ef51fc..8aee0cdf63a4 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.h
+++ b/drivers/staging/sm750fb/ddk750_dvi.h
@@ -4,7 +4,7 @@
 
 /* dvi chip stuffs structros */
 
-typedef long (*PFN_DVICTRL_INIT)(unsigned char edge_select,
+typedef long (*DVICTRL_INIT)(unsigned char edge_select,
 unsigned char bus_select,
 unsigned char dual_edge_clk_select,
 unsigned char hsync_enable,
@@ -15,28 +15,28 @@ typedef long (*PFN_DVICTRL_INIT)(unsigned char edge_select,
 unsigned char pll_filter_enable,
 unsigned char pll_filter_value);
 
-typedef void (*PFN_DVICTRL_RESETCHIP)(void);
-typedef char* (*PFN_DVICTRL_GETCHIPSTRING)(void);
-typedef unsigned short (*PFN_DVICTRL_GETVENDORID)(void);
-typedef unsigned short (*PFN_DVICTRL_GETDEVICEID)(void);
-typedef void (*PFN_DVICTRL_SETPOWER)(unsigned char powerUp);
-typedef void (*PFN_DVICTRL_HOTPLUGDETECTION)(unsigned char enableHotPlug);
-typedef unsigned char (*PFN_DVICTRL_ISCONNECTED)(void);
-typedef unsigned char (*PFN_DVICTRL_CHECKINTERRUPT)(void);
-typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void);
+typedef void (*DVICTRL_RESETCHIP)(void);
+typedef char* (*DVICTRL_GETCHIPSTRING)(void);
+typedef unsigned short (*DVICTRL_GETVENDORID)(void);
+typedef unsigned short (*DVICTRL_GETDEVICEID)(void);
+typedef void (*DVICTRL_SETPOWER)(unsigned char powerUp);
+typedef void (*DVICTRL_HOTPLUGDETECTION)(unsigned char enableHotPlug);
+typedef unsigned char (*DVICTRL_ISCONNECTED)(void);
+typedef unsigned char (*DVICTRL_CHECKINTERRUPT)(void);
+typedef void (*DVICTRL_CLEARINTERRUPT)(void);
 
 /* Structure to hold all the function pointer to the DVI Controller. */
 struct dvi_ctrl_device {
-   PFN_DVICTRL_INITpfn_init;
-   PFN_DVICTRL_RESETCHIP   pfn_reset_chip;
-   PFN_DVICTRL_GETCHIPSTRING   pfn_get_chip_string;
-   PFN_DVICTRL_GETVENDORID pfn_get_vendor_id;
-   PFN_DVICTRL_GETDEVICEID pfn_get_device_id;
-   PFN_DVICTRL_SETPOWERpfn_set_power;
-   PFN_DVICTRL_HOTPLUGDETECTIONpfn_enable_hot_plug_detection;
-   PFN_DVICTRL_ISCONNECTED pfn_is_connected;
-   PFN_DVICTRL_CHECKINTERRUPT  pfn_check_interrupt;
-   PFN_DVICTRL_CLEARINTERRUPT  pfn_clear_interrupt;
+   DVICTRL_INITinit;
+   DVICTRL_RESETCHIP   reset_chip

[PATCH v2 02/49] staging: sm750fb: Rename dviInit to dvi_init and update param names

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for the function dviInit and
its parameter names in ddk750_dvi.h.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_dvi.c |  2 +-
 drivers/staging/sm750fb/ddk750_dvi.h | 20 ++--
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index db19bf732482..943cbcafcffa 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -30,7 +30,7 @@ static struct dvi_ctrl_device dcft_supported_dvi_controller[] 
= {
 #endif
 };
 
-int dviInit(unsigned char edge_select,
+int dvi_init(unsigned char edge_select,
unsigned char bus_select,
unsigned char dual_edge_clk_select,
unsigned char hsync_enable,
diff --git a/drivers/staging/sm750fb/ddk750_dvi.h 
b/drivers/staging/sm750fb/ddk750_dvi.h
index 4ca2591ea94b..fbc897c7efb8 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.h
+++ b/drivers/staging/sm750fb/ddk750_dvi.h
@@ -42,16 +42,16 @@ struct dvi_ctrl_device {
 #define DVI_CTRL_SII164
 
 /* dvi functions prototype */
-int dviInit(unsigned char edgeSelect,
-   unsigned char busSelect,
-   unsigned char dualEdgeClkSelect,
-   unsigned char hsyncEnable,
-   unsigned char vsyncEnable,
-   unsigned char deskewEnable,
-   unsigned char deskewSetting,
-   unsigned char continuousSyncEnable,
-   unsigned char pllFilterEnable,
-   unsigned char pllFilterValue);
+int dvi_init(unsigned char edge_select,
+   unsigned char bus_select,
+   unsigned char dual_edge_clk_select,
+   unsigned char hsync_enable,
+   unsigned char vsync_enable,
+   unsigned char deskew_enable,
+   unsigned char deskew_setting,
+   unsigned char continuous_sync_enable,
+   unsigned char pll_filter_enable,
+   unsigned char pll_filter_value);
 
 #endif
 
-- 
2.30.2



[PATCH v2 01/49] staging: sm750fb: Update dvi_ctrl_device to snake case

2021-04-06 Thread Pavle Rohalj
Fix "Avoid CamelCase" checkpatch.pl checks for dvi_ctrl_device structure and
its usages.

Signed-off-by: Pavle Rohalj 
---
 drivers/staging/sm750fb/ddk750_dvi.c| 30 
 drivers/staging/sm750fb/ddk750_dvi.h| 20 +--
 drivers/staging/sm750fb/ddk750_sii164.c | 48 -
 drivers/staging/sm750fb/ddk750_sii164.h | 20 +--
 4 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index cd564ea40779..db19bf732482 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -11,20 +11,20 @@
  * function API. Please set the function pointer to NULL whenever the function
  * is not supported.
  */
-static struct dvi_ctrl_device g_dcftSupportedDviController[] = {
+static struct dvi_ctrl_device dcft_supported_dvi_controller[] = {
 #ifdef DVI_CTRL_SII164
{
-   .pfnInit = sii164InitChip,
-   .pfnGetVendorId = sii164GetVendorID,
-   .pfnGetDeviceId = sii164GetDeviceID,
+   .pfn_init = sii164_init_chip,
+   .pfn_get_vendor_id = sii164_get_vendor_id,
+   .pfn_get_device_id = sii164_get_device_id,
 #ifdef SII164_FULL_FUNCTIONS
-   .pfnResetChip = sii164ResetChip,
-   .pfnGetChipString = sii164GetChipString,
-   .pfnSetPower = sii164SetPower,
-   .pfnEnableHotPlugDetection = sii164EnableHotPlugDetection,
-   .pfnIsConnected = sii164IsConnected,
-   .pfnCheckInterrupt = sii164CheckInterrupt,
-   .pfnClearInterrupt = sii164ClearInterrupt,
+   .pfn_reset_chip = sii164_reset_chip,
+   .pfn_get_chip_string = sii164_get_chip_string,
+   .pfn_set_power = sii164_set_power,
+   .pfn_enable_hot_plug_detection = 
sii164_enable_hot_plug_detection,
+   .pfn_is_connected = sii164_is_connected,
+   .pfn_check_interrupt = sii164_check_interrupt,
+   .pfn_clear_interrupt = sii164_clear_interrupt,
 #endif
},
 #endif
@@ -41,11 +41,11 @@ int dviInit(unsigned char edge_select,
unsigned char pll_filter_enable,
unsigned char pll_filter_value)
 {
-   struct dvi_ctrl_device *pCurrentDviCtrl;
+   struct dvi_ctrl_device *current_dvi_ctrl;
 
-   pCurrentDviCtrl = g_dcftSupportedDviController;
-   if (pCurrentDviCtrl->pfnInit) {
-   return pCurrentDviCtrl->pfnInit(edge_select,
+   current_dvi_ctrl = dcft_supported_dvi_controller;
+   if (current_dvi_ctrl->pfn_init) {
+   return current_dvi_ctrl->pfn_init(edge_select,
bus_select,
dual_edge_clk_select,
hsync_enable,
diff --git a/drivers/staging/sm750fb/ddk750_dvi.h 
b/drivers/staging/sm750fb/ddk750_dvi.h
index 1c7a565b617a..4ca2591ea94b 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.h
+++ b/drivers/staging/sm750fb/ddk750_dvi.h
@@ -27,16 +27,16 @@ typedef void (*PFN_DVICTRL_CLEARINTERRUPT)(void);
 
 /* Structure to hold all the function pointer to the DVI Controller. */
 struct dvi_ctrl_device {
-   PFN_DVICTRL_INITpfnInit;
-   PFN_DVICTRL_RESETCHIP   pfnResetChip;
-   PFN_DVICTRL_GETCHIPSTRING   pfnGetChipString;
-   PFN_DVICTRL_GETVENDORID pfnGetVendorId;
-   PFN_DVICTRL_GETDEVICEID pfnGetDeviceId;
-   PFN_DVICTRL_SETPOWERpfnSetPower;
-   PFN_DVICTRL_HOTPLUGDETECTIONpfnEnableHotPlugDetection;
-   PFN_DVICTRL_ISCONNECTED pfnIsConnected;
-   PFN_DVICTRL_CHECKINTERRUPT  pfnCheckInterrupt;
-   PFN_DVICTRL_CLEARINTERRUPT  pfnClearInterrupt;
+   PFN_DVICTRL_INITpfn_init;
+   PFN_DVICTRL_RESETCHIP   pfn_reset_chip;
+   PFN_DVICTRL_GETCHIPSTRING   pfn_get_chip_string;
+   PFN_DVICTRL_GETVENDORID pfn_get_vendor_id;
+   PFN_DVICTRL_GETDEVICEID pfn_get_device_id;
+   PFN_DVICTRL_SETPOWERpfn_set_power;
+   PFN_DVICTRL_HOTPLUGDETECTIONpfn_enable_hot_plug_detection;
+   PFN_DVICTRL_ISCONNECTED pfn_is_connected;
+   PFN_DVICTRL_CHECKINTERRUPT  pfn_check_interrupt;
+   PFN_DVICTRL_CLEARINTERRUPT  pfn_clear_interrupt;
 };
 
 #define DVI_CTRL_SII164
diff --git a/drivers/staging/sm750fb/ddk750_sii164.c 
b/drivers/staging/sm750fb/ddk750_sii164.c
index 73e0e9f41ec5..6c343e2e0433 100644
--- a/drivers/staging/sm750fb/ddk750_sii164.c
+++ b/drivers/staging/sm750fb/ddk750_sii164.c
@@ -29,13 +29,13 @@ static char *gDviCtrlChipName = "Silicon Image SiI 164";
 #endif
 
 /*
- *  sii164GetVendorID
+ *  sii164_get_vendor_id
  *  This function gets the vendor ID of the DVI controller chip.
  *
  *  Output:
  *  Vendor ID
  */
-unsigned short sii164GetVendorID(void)

[PATCH v2 00/49] *** SUBJECT HERE ***

2021-04-06 Thread Pavle Rohalj
Changes in v2:
- Removed type information from variable names
- Broken up the changes into smaller patches

Pavle Rohalj (49):
  staging: sm750fb: Update dvi_ctrl_device to snake case
  staging: sm750fb: Rename dviInit to dvi_init and update param names
  staging: sm750fb: Update param names of PFN_DVICTRL_INIT function
pointer
  staging: sm750fb: Remove type names in variables and type definitions
  staging: sm750fb: Remove remaining camel case names in ddk750_dvi.h
  staging: sm750fb: Update displayControlAdjust_SM750LE to snake case
  staging: sm750fb: Update programModeRegisters to snake case
  staging: sm750fb: Update enum values in dpms to snake case
  staging: sm750fb: Rename sm750_set_power_mode function parameter
  staging: sm750fb: Rename ddk750_setModeTiming to
ddk750_set_mode_timing
  staging: sm750fb: Rename i2cWriteReg and i2cReadReg to snake case
  staging: sm750fb: Rename vendorID local variable to snake case
  staging: sm750fb: Rename deviceID local variable to snake case
  staging: sm750fb: Rename sii164SelectHotPlugDetectionMode to snake
case
  staging: sm750fb: Rename gDviCtrlChipName to snake case
  staging: sm750fb: Update function parameter names in ddk750_sii164.c
  staging: sm750fb: Rename local variables to snake case
  staging: sm750fb: Rename function params of sii164_init_chip
  staging: sm750fb: Rename function parameter of
sii164_enable_hot_plug_detection
  staging: sm750fb: Update function parameter names to snake case
  staging: sm750fb: Rename function write_dpPort to snake case
  staging: sm750fb: Update local variable in sm750_hw_copyarea to snake
case
  staging: sm750fb: Update local variables in sm750_hw_imageblit to
snake case
  staging: sm750fb: Update local variable in sm750_hw_fillrect to snake
case
  staging: sm750fb: Rename deGetTransparency to snake case
  staging: sm750fb: Update function parameter of sm750_hw_imageblit to
snake case
  staging: sm750fb: Rename function params to snake case in
sm750_accel.h
  staging: sm750fb: Update members of lynx_cursor to snake case
  staging: sm750fb: Rename function sm750_hw_cursor_setSize to snake
case
  staging: sm750fb: Rename function sm750_hw_cursor_setPos to snake case
  staging: sm750fb: Rename function sm750_hw_cursor_setColor to snake
case
  staging: sm750fb: Rename function sm750_hw_cursor_setData to snake
case
  staging: sm750fb: Rename function hw_sm750_crtc_setMode to snake case
  staging: sm750fb: Update members of init_status struct to snake case
  staging: sm750fb: Update members of sm750_dev struct to snake case
  staging: sm750fb: Update members of lynxfb_crtc struct to snake case
  staging: sm750fb: Rename function hw_sm750_output_setMode to snake
case
  staging: sm750fb: Rename function hw_sm750_setColReg to snake case
  staging: sm750fb: Rename functions *_setBLANK to snake case
  staging: sm750fb: Rename function sm750_hw_cursor_setData2 to snake
case
  staging: sm750fb: Rename function hw_sm750_initAccel to snake case
  staging: sm750fb: Rename functions *_deWait to snake case
  staging: sm750fb: Update members of lynx_accel struct to snake case
  staging: sm750fb: Rename function hw_sm750_crtc_checkMode to snake
case
  staging: sm750fb: Rename sii164_set_power function parameter
  staging: sm750fb: Rename local variable Bpp to bpp in sm750.c
  staging: sm750fb: Rename proc_setBLANK member of lynxfb_output struct
  staging: sm750fb: Rename fixId to fix_id
  staging: sm750fb: Update members of sm750_pnltype struct to snake case

 drivers/staging/sm750fb/ddk750_dvi.c|  32 ++---
 drivers/staging/sm750fb/ddk750_dvi.h|  80 ++---
 drivers/staging/sm750fb/ddk750_mode.c   |  88 +++---
 drivers/staging/sm750fb/ddk750_mode.h   |   2 +-
 drivers/staging/sm750fb/ddk750_power.h  |  10 +-
 drivers/staging/sm750fb/ddk750_sii164.c | 152 
 drivers/staging/sm750fb/ddk750_sii164.h |  40 +++
 drivers/staging/sm750fb/sm750.c | 130 ++--
 drivers/staging/sm750fb/sm750.h |  56 -
 drivers/staging/sm750fb/sm750_accel.c   | 148 +++
 drivers/staging/sm750fb/sm750_accel.h   |  42 +++
 drivers/staging/sm750fb/sm750_cursor.c  |  14 +--
 drivers/staging/sm750fb/sm750_cursor.h  |  10 +-
 drivers/staging/sm750fb/sm750_hw.c  |  56 -
 14 files changed, 430 insertions(+), 430 deletions(-)

-- 
2.30.2



RE: [PATCH] iommu/vt-d: Force to flush iotlb before creating superpage

2021-04-06 Thread Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
Hi Baolu,

> -Original Message-
> From: Lu Baolu [mailto:baolu...@linux.intel.com]
> Sent: Friday, April 2, 2021 12:44 PM
> To: Longpeng (Mike, Cloud Infrastructure Service Product Dept.)
> ; io...@lists.linux-foundation.org;
> linux-kernel@vger.kernel.org
> Cc: baolu...@linux.intel.com; David Woodhouse ; Nadav
> Amit ; Alex Williamson ;
> Kevin Tian ; Gonglei (Arei) ;
> sta...@vger.kernel.org
> Subject: Re: [PATCH] iommu/vt-d: Force to flush iotlb before creating 
> superpage
> 
> Hi Longpeng,
> 
> On 4/1/21 3:18 PM, Longpeng(Mike) wrote:
> > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> > index ee09323..cbcb434 100644
> > --- a/drivers/iommu/intel/iommu.c
> > +++ b/drivers/iommu/intel/iommu.c
> > @@ -2342,9 +2342,20 @@ static inline int hardware_largepage_caps(struct
> dmar_domain *domain,
> >  * removed to make room for superpage(s).
> >  * We're adding new large pages, so make sure
> >  * we don't remove their parent tables.
> > +*
> > +* We also need to flush the iotlb before 
> > creating
> > +* superpage to ensure it does not perserves any
> > +* obsolete info.
> >  */
> > -   dma_pte_free_pagetable(domain, iov_pfn, end_pfn,
> > -  largepage_lvl + 1);
> > +   if (dma_pte_present(pte)) {
> 
> The dma_pte_free_pagetable() clears a batch of PTEs. So checking current PTE 
> is
> insufficient. How about removing this check and always performing cache
> invalidation?
> 

Um...the PTE here may be present( e.g. 4K mapping --> superpage mapping ) or 
NOT-present ( e.g. create a totally new superpage mapping ), but we only need 
to call free_pagetable and flush_iotlb in the former case, right ?

> > +   int i;
> > +
> > +   dma_pte_free_pagetable(domain, iov_pfn, 
> > end_pfn,
> > +  largepage_lvl + 
> > 1);
> > +   for_each_domain_iommu(i, domain)
> > +   
> > iommu_flush_iotlb_psi(g_iommus[i], domain,
> > + iov_pfn, 
> > nr_pages, 0, 0);
> > +
> 
> Best regards,
> baolu


Re: [PATCH] driver: of: Properly truncate command line if too long

2021-04-06 Thread Alex Ghiti

Hi Andy,

Le 4/6/21 à 6:56 PM, Andy Shevchenko a écrit :



On Tuesday, March 16, 2021, Alexandre Ghiti > wrote:


In case the command line given by the user is too long, warn about it
and truncate it to the last full argument.

This is what efi already does in commit 80b1bfe1cb2f ("efi/libstub:
Don't parse overlong command lines").

Reported-by: Dmitry Vyukov mailto:dvyu...@google.com>>
Signed-off-by: Alexandre Ghiti mailto:a...@ghiti.fr>>
---
  drivers/of/fdt.c | 21 -
  1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index dcc1dd96911a..de4c6f9bac39 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -25,6 +25,7 @@
  #include 
  #include 
  #include 
+#include 

  #include   /* for COMMAND_LINE_SIZE */
  #include 
@@ -1050,9 +1051,27 @@ int __init early_init_dt_scan_chosen(unsigned
long node, const char *uname,

         /* Retrieve command line */
         p = of_get_flat_dt_prop(node, "bootargs", &l);
-       if (p != NULL && l > 0)
+       if (p != NULL && l > 0) {
                 strlcpy(data, p, min(l, COMMAND_LINE_SIZE));

+               /*
+                * If the given command line size is larger than
+                * COMMAND_LINE_SIZE, truncate it to the last complete
+                * parameter.
+                */
+               if (l > COMMAND_LINE_SIZE) {
+                       char *cmd_p = (char *)data +
COMMAND_LINE_SIZE - 1;
+
+                       while (!isspace(*cmd_p))
+                               cmd_p--;


Shouldn’t you check for cmd_p being always bigger than or equal to data?


Yes you're right.



+
+                       *cmd_p = '\0';
+
+                       pr_err("Command line is too long: truncated
to %d bytes\n",
+                              (int)(cmd_p - (char *)data + 1));


Do you really need that casting?


No, I can use %td to print a pointer difference.

I'll send a v2.

Thanks,

Alex



+               }
+       }
+
         /*
          * CONFIG_CMDLINE is meant to be a default in case nothing else
          * managed to set the command line, unless CONFIG_CMDLINE_FORCE
-- 
2.20.1




--
With Best Regards,
Andy Shevchenko




[PATCH 3/3] fsdax: Output address in dax_iomap_pfn() and rename it

2021-04-06 Thread Shiyang Ruan
Add address output in dax_iomap_pfn() in order to perform a memcpy() in
CoW case.  Since this function both output address and pfn, rename it to
dax_iomap_direct_access().

Signed-off-by: Shiyang Ruan 
Reviewed-by: Christoph Hellwig 
Reviewed-by: Ritesh Harjani 
---
 fs/dax.c | 16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index 19fa22ab50fa..ec66207a3199 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -998,8 +998,8 @@ static sector_t dax_iomap_sector(struct iomap *iomap, 
loff_t pos)
return (iomap->addr + (pos & PAGE_MASK) - iomap->offset) >> 9;
 }
 
-static int dax_iomap_pfn(struct iomap *iomap, loff_t pos, size_t size,
-pfn_t *pfnp)
+static int dax_iomap_direct_access(struct iomap *iomap, loff_t pos, size_t 
size,
+   void **kaddr, pfn_t *pfnp)
 {
const sector_t sector = dax_iomap_sector(iomap, pos);
pgoff_t pgoff;
@@ -1011,11 +1011,13 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t 
pos, size_t size,
return rc;
id = dax_read_lock();
length = dax_direct_access(iomap->dax_dev, pgoff, PHYS_PFN(size),
-  NULL, pfnp);
+  kaddr, pfnp);
if (length < 0) {
rc = length;
goto out;
}
+   if (!pfnp)
+   goto out_check_addr;
rc = -EINVAL;
if (PFN_PHYS(length) < size)
goto out;
@@ -1025,6 +1027,12 @@ static int dax_iomap_pfn(struct iomap *iomap, loff_t 
pos, size_t size,
if (length > 1 && !pfn_t_devmap(*pfnp))
goto out;
rc = 0;
+
+out_check_addr:
+   if (!kaddr)
+   goto out;
+   if (!*kaddr)
+   rc = -EFAULT;
 out:
dax_read_unlock(id);
return rc;
@@ -1388,7 +1396,7 @@ static vm_fault_t dax_fault_actor(struct vm_fault *vmf, 
pfn_t *pfnp,
return pmd ? VM_FAULT_FALLBACK : VM_FAULT_SIGBUS;
}
 
-   err = dax_iomap_pfn(iomap, pos, size, &pfn);
+   err = dax_iomap_direct_access(iomap, pos, size, NULL, &pfn);
if (err)
return pmd ? VM_FAULT_FALLBACK : dax_fault_return(err);
 
-- 
2.31.0





[PATCH 2/3] fsdax: Factor helper: dax_fault_actor()

2021-04-06 Thread Shiyang Ruan
The core logic in the two dax page fault functions is similar. So, move
the logic into a common helper function. Also, to facilitate the
addition of new features, such as CoW, switch-case is no longer used to
handle different iomap types.

Signed-off-by: Shiyang Ruan 
Reviewed-by: Christoph Hellwig 
---
 fs/dax.c | 294 ---
 1 file changed, 148 insertions(+), 146 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index dc75ea04b6d9..19fa22ab50fa 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1054,6 +1054,66 @@ static vm_fault_t dax_load_hole(struct xa_state *xas,
return ret;
 }
 
+#ifdef CONFIG_FS_DAX_PMD
+static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
+   struct iomap *iomap, void **entry)
+{
+   struct address_space *mapping = vmf->vma->vm_file->f_mapping;
+   unsigned long pmd_addr = vmf->address & PMD_MASK;
+   struct vm_area_struct *vma = vmf->vma;
+   struct inode *inode = mapping->host;
+   pgtable_t pgtable = NULL;
+   struct page *zero_page;
+   spinlock_t *ptl;
+   pmd_t pmd_entry;
+   pfn_t pfn;
+
+   zero_page = mm_get_huge_zero_page(vmf->vma->vm_mm);
+
+   if (unlikely(!zero_page))
+   goto fallback;
+
+   pfn = page_to_pfn_t(zero_page);
+   *entry = dax_insert_entry(xas, mapping, vmf, *entry, pfn,
+   DAX_PMD | DAX_ZERO_PAGE, false);
+
+   if (arch_needs_pgtable_deposit()) {
+   pgtable = pte_alloc_one(vma->vm_mm);
+   if (!pgtable)
+   return VM_FAULT_OOM;
+   }
+
+   ptl = pmd_lock(vmf->vma->vm_mm, vmf->pmd);
+   if (!pmd_none(*(vmf->pmd))) {
+   spin_unlock(ptl);
+   goto fallback;
+   }
+
+   if (pgtable) {
+   pgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable);
+   mm_inc_nr_ptes(vma->vm_mm);
+   }
+   pmd_entry = mk_pmd(zero_page, vmf->vma->vm_page_prot);
+   pmd_entry = pmd_mkhuge(pmd_entry);
+   set_pmd_at(vmf->vma->vm_mm, pmd_addr, vmf->pmd, pmd_entry);
+   spin_unlock(ptl);
+   trace_dax_pmd_load_hole(inode, vmf, zero_page, *entry);
+   return VM_FAULT_NOPAGE;
+
+fallback:
+   if (pgtable)
+   pte_free(vma->vm_mm, pgtable);
+   trace_dax_pmd_load_hole_fallback(inode, vmf, zero_page, *entry);
+   return VM_FAULT_FALLBACK;
+}
+#else
+static vm_fault_t dax_pmd_load_hole(struct xa_state *xas, struct vm_fault *vmf,
+   struct iomap *iomap, void **entry)
+{
+   return VM_FAULT_FALLBACK;
+}
+#endif /* CONFIG_FS_DAX_PMD */
+
 s64 dax_iomap_zero(loff_t pos, u64 length, struct iomap *iomap)
 {
sector_t sector = iomap_sector(iomap, pos & PAGE_MASK);
@@ -1290,6 +1350,64 @@ static int dax_fault_cow_page(struct vm_fault *vmf, 
struct iomap *iomap,
return 0;
 }
 
+/**
+ * dax_fault_actor - Common actor to handle pfn insertion in PTE/PMD fault.
+ * @vmf:   vm fault instance
+ * @pfnp:  pfn to be returned
+ * @xas:   the dax mapping tree of a file
+ * @entry: an unlocked dax entry to be inserted
+ * @pmd:   distinguish whether it is a pmd fault
+ * @flags: iomap flags
+ * @iomap: from iomap_begin()
+ * @srcmap:from iomap_begin(), not equal to iomap if it is a CoW
+ */
+static vm_fault_t dax_fault_actor(struct vm_fault *vmf, pfn_t *pfnp,
+   struct xa_state *xas, void **entry, bool pmd,
+   unsigned int flags, struct iomap *iomap, struct iomap *srcmap)
+{
+   struct address_space *mapping = vmf->vma->vm_file->f_mapping;
+   size_t size = pmd ? PMD_SIZE : PAGE_SIZE;
+   loff_t pos = (loff_t)xas->xa_index << PAGE_SHIFT;
+   bool write = vmf->flags & FAULT_FLAG_WRITE;
+   bool sync = dax_fault_is_synchronous(flags, vmf->vma, iomap);
+   unsigned long entry_flags = pmd ? DAX_PMD : 0;
+   int err = 0;
+   pfn_t pfn;
+
+   /* if we are reading UNWRITTEN and HOLE, return a hole. */
+   if (!write &&
+   (iomap->type == IOMAP_UNWRITTEN || iomap->type == IOMAP_HOLE)) {
+   if (!pmd)
+   return dax_load_hole(xas, mapping, entry, vmf);
+   else
+   return dax_pmd_load_hole(xas, vmf, iomap, entry);
+   }
+
+   if (iomap->type != IOMAP_MAPPED) {
+   WARN_ON_ONCE(1);
+   return pmd ? VM_FAULT_FALLBACK : VM_FAULT_SIGBUS;
+   }
+
+   err = dax_iomap_pfn(iomap, pos, size, &pfn);
+   if (err)
+   return pmd ? VM_FAULT_FALLBACK : dax_fault_return(err);
+
+   *entry = dax_insert_entry(xas, mapping, vmf, *entry, pfn, entry_flags,
+ write && !sync);
+
+   if (sync)
+   return dax_fault_synchronous_pfnp(pfnp, pfn);
+
+   /* insert PMD pfn */
+   if (pmd)
+   return vmf_insert_pfn_pmd(vmf, pfn, write);
+
+   /* insert PTE pfn */
+   if (write)
+   

[PATCH 1/3] fsdax: Factor helpers to simplify dax fault code

2021-04-06 Thread Shiyang Ruan
The dax page fault code is too long and a bit difficult to read. And it
is hard to understand when we trying to add new features. Some of the
PTE/PMD codes have similar logic. So, factor them as helper functions to
simplify the code.

Signed-off-by: Shiyang Ruan 
Reviewed-by: Christoph Hellwig 
Reviewed-by: Ritesh Harjani 
---
 fs/dax.c | 152 ++-
 1 file changed, 84 insertions(+), 68 deletions(-)

diff --git a/fs/dax.c b/fs/dax.c
index b3d27fdc6775..dc75ea04b6d9 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1244,6 +1244,52 @@ static bool dax_fault_is_synchronous(unsigned long flags,
&& (iomap->flags & IOMAP_F_DIRTY);
 }
 
+/*
+ * If we are doing synchronous page fault and inode needs fsync, we can insert
+ * PTE/PMD into page tables only after that happens. Skip insertion for now and
+ * return the pfn so that caller can insert it after fsync is done.
+ */
+static vm_fault_t dax_fault_synchronous_pfnp(pfn_t *pfnp, pfn_t pfn)
+{
+   if (WARN_ON_ONCE(!pfnp))
+   return VM_FAULT_SIGBUS;
+
+   *pfnp = pfn;
+   return VM_FAULT_NEEDDSYNC;
+}
+
+static int dax_fault_cow_page(struct vm_fault *vmf, struct iomap *iomap,
+   loff_t pos, vm_fault_t *ret)
+{
+   int error = 0;
+   unsigned long vaddr = vmf->address;
+   sector_t sector = dax_iomap_sector(iomap, pos);
+
+   switch (iomap->type) {
+   case IOMAP_HOLE:
+   case IOMAP_UNWRITTEN:
+   clear_user_highpage(vmf->cow_page, vaddr);
+   break;
+   case IOMAP_MAPPED:
+   error = copy_cow_page_dax(iomap->bdev, iomap->dax_dev,
+   sector, vmf->cow_page, vaddr);
+   break;
+   default:
+   WARN_ON_ONCE(1);
+   error = -EIO;
+   break;
+   }
+
+   if (error)
+   return error;
+
+   __SetPageUptodate(vmf->cow_page);
+   *ret = finish_fault(vmf);
+   if (!*ret)
+   *ret = VM_FAULT_DONE_COW;
+   return 0;
+}
+
 static vm_fault_t dax_iomap_pte_fault(struct vm_fault *vmf, pfn_t *pfnp,
   int *iomap_errp, const struct iomap_ops *ops)
 {
@@ -1312,30 +1358,9 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault 
*vmf, pfn_t *pfnp,
}
 
if (vmf->cow_page) {
-   sector_t sector = dax_iomap_sector(&iomap, pos);
-
-   switch (iomap.type) {
-   case IOMAP_HOLE:
-   case IOMAP_UNWRITTEN:
-   clear_user_highpage(vmf->cow_page, vaddr);
-   break;
-   case IOMAP_MAPPED:
-   error = copy_cow_page_dax(iomap.bdev, iomap.dax_dev,
- sector, vmf->cow_page, vaddr);
-   break;
-   default:
-   WARN_ON_ONCE(1);
-   error = -EIO;
-   break;
-   }
-
+   error = dax_fault_cow_page(vmf, &iomap, pos, &ret);
if (error)
-   goto error_finish_iomap;
-
-   __SetPageUptodate(vmf->cow_page);
-   ret = finish_fault(vmf);
-   if (!ret)
-   ret = VM_FAULT_DONE_COW;
+   ret = dax_fault_return(error);
goto finish_iomap;
}
 
@@ -1355,19 +1380,8 @@ static vm_fault_t dax_iomap_pte_fault(struct vm_fault 
*vmf, pfn_t *pfnp,
entry = dax_insert_entry(&xas, mapping, vmf, entry, pfn,
 0, write && !sync);
 
-   /*
-* If we are doing synchronous page fault and inode needs fsync,
-* we can insert PTE into page tables only after that happens.
-* Skip insertion for now and return the pfn so that caller can
-* insert it after fsync is done.
-*/
if (sync) {
-   if (WARN_ON_ONCE(!pfnp)) {
-   error = -EIO;
-   goto error_finish_iomap;
-   }
-   *pfnp = pfn;
-   ret = VM_FAULT_NEEDDSYNC | major;
+   ret = dax_fault_synchronous_pfnp(pfnp, pfn);
goto finish_iomap;
}
trace_dax_insert_mapping(inode, vmf, entry);
@@ -1466,13 +1480,45 @@ static vm_fault_t dax_pmd_load_hole(struct xa_state 
*xas, struct vm_fault *vmf,
return VM_FAULT_FALLBACK;
 }
 
+static bool dax_fault_check_fallback(struct vm_fault *vmf, struct xa_state 
*xas,
+   pgoff_t max_pgoff)
+{
+   unsigned long pmd_addr = vmf->address & PMD_MASK;
+   bool write = vmf->flags & FAULT_FLAG_WRITE;
+
+   /*
+* Make sure that the faulting address's PMD offset (color) matches
+* the PMD offset from

[PATCH 0/3] fsdax: Factor helper functions to simplify the code

2021-04-06 Thread Shiyang Ruan
The page fault part of fsdax code is little complex. In order to add CoW
feature and make it easy to understand, I was suggested to factor some
helper functions to simplify the current dax code.

(Rebased on v5.12-rc5)
==

Shiyang Ruan (3):
  fsdax: Factor helpers to simplify dax fault code
  fsdax: Factor helper: dax_fault_actor()
  fsdax: Output address in dax_iomap_pfn() and rename it

 fs/dax.c | 438 +--
 1 file changed, 232 insertions(+), 206 deletions(-)

-- 
2.31.0





Re: [PATCH v8 5/9] bus: mhi: core: Hold device wake for channel update commands

2021-04-06 Thread Manivannan Sadhasivam
On Thu, Apr 01, 2021 at 02:16:14PM -0700, Bhaumik Bhatt wrote:
> MHI host can fail early if device is in a bad state by attempting
> to assert device wake and holding the runtime PM vote before
> sending a channel update command instead of performing a wake
> toggle and waiting for a timeout if the send were to fail. This
> can help improve the design and enable shorter wait periods for
> device to respond as votes are already held.
> 
> Signed-off-by: Bhaumik Bhatt 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/main.c | 19 ++-
>  1 file changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
> index 94fdbf7..989a2a8 100644
> --- a/drivers/bus/mhi/core/main.c
> +++ b/drivers/bus/mhi/core/main.c
> @@ -1278,16 +1278,18 @@ static int mhi_update_channel_state(struct 
> mhi_controller *mhi_cntrl,
>   return -EINVAL;
>   }
>  
> - mhi_cntrl->wake_toggle(mhi_cntrl);
> + /* bring host and device out of suspended states */
> + ret = mhi_device_get_sync(mhi_cntrl->mhi_dev);
> + if (ret)
> + return ret;
>   mhi_cntrl->runtime_get(mhi_cntrl);
> - mhi_cntrl->runtime_put(mhi_cntrl);
>  
>   reinit_completion(&mhi_chan->completion);
>   ret = mhi_send_cmd(mhi_cntrl, mhi_chan, cmd);
>   if (ret) {
>   dev_err(dev, "%d: Failed to send %s channel command\n",
>   mhi_chan->chan, TO_CH_STATE_TYPE_STR(to_state));
> - return ret;
> + goto exit_channel_update;
>   }
>  
>   ret = wait_for_completion_timeout(&mhi_chan->completion,
> @@ -1296,9 +1298,12 @@ static int mhi_update_channel_state(struct 
> mhi_controller *mhi_cntrl,
>   dev_err(dev,
>   "%d: Failed to receive %s channel command completion\n",
>   mhi_chan->chan, TO_CH_STATE_TYPE_STR(to_state));
> - return -EIO;
> + ret = -EIO;
> + goto exit_channel_update;
>   }
>  
> + ret = 0;
> +
>   if (to_state != MHI_CH_STATE_TYPE_RESET) {
>   write_lock_irq(&mhi_chan->lock);
>   mhi_chan->ch_state = (to_state == MHI_CH_STATE_TYPE_START) ?
> @@ -1309,7 +1314,11 @@ static int mhi_update_channel_state(struct 
> mhi_controller *mhi_cntrl,
>   dev_dbg(dev, "%d: Channel state change to %s successful\n",
>   mhi_chan->chan, TO_CH_STATE_TYPE_STR(to_state));
>  
> - return 0;
> +exit_channel_update:
> + mhi_cntrl->runtime_put(mhi_cntrl);
> + mhi_device_put(mhi_cntrl->mhi_dev);
> +
> + return ret;
>  }
>  
>  static void __mhi_unprepare_channel(struct mhi_controller *mhi_cntrl,
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


Re: [PATCH] i2c: omap: Fix rumtime PM imbalance on error

2021-04-06 Thread Tony Lindgren
* Vignesh Raghavendra  [210407 06:20]:
> Do we need a Fixes: tag to enable stable backports?

Well pm_runtime_resume_and_get() was introduced quite recently, and
we already handle the error and bail out. And likely after an error
not much works anyways :) So it might be better to add just a stable
tag v5.10 and later as further backports are not likely needed.

Naturally nothing stopping doing separate backports if really needed
though.

Regards,

Tony


Re: [PATCH v8 4/9] bus: mhi: core: Update debug messages to use client device

2021-04-06 Thread Manivannan Sadhasivam
On Thu, Apr 01, 2021 at 02:16:13PM -0700, Bhaumik Bhatt wrote:
> Debug messages dealing with client devices use the generic MHI
> controller or parent device along with a channel number. It would
> be better to instead use the client device directly and enable
> better log messages for channel updates.
> 
> Suggested-by: Manivannan Sadhasivam 
> Signed-off-by: Bhaumik Bhatt 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/main.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
> index 710ca0f..94fdbf7 100644
> --- a/drivers/bus/mhi/core/main.c
> +++ b/drivers/bus/mhi/core/main.c
> @@ -1238,7 +1238,7 @@ static int mhi_update_channel_state(struct 
> mhi_controller *mhi_cntrl,
>   struct mhi_chan *mhi_chan,
>   enum mhi_ch_state_type to_state)
>  {
> - struct device *dev = &mhi_cntrl->mhi_dev->dev;
> + struct device *dev = &mhi_chan->mhi_dev->dev;
>   enum mhi_cmd_type cmd = MHI_CMD_NOP;
>   int ret;
>  
> @@ -1316,7 +1316,7 @@ static void __mhi_unprepare_channel(struct 
> mhi_controller *mhi_cntrl,
>   struct mhi_chan *mhi_chan)
>  {
>   int ret;
> - struct device *dev = &mhi_cntrl->mhi_dev->dev;
> + struct device *dev = &mhi_chan->mhi_dev->dev;
>  
>   mutex_lock(&mhi_chan->mutex);
>  
> @@ -1340,13 +1340,11 @@ int mhi_prepare_channel(struct mhi_controller 
> *mhi_cntrl,
>   struct mhi_chan *mhi_chan)
>  {
>   int ret = 0;
> - struct device *dev = &mhi_cntrl->mhi_dev->dev;
> + struct device *dev = &mhi_chan->mhi_dev->dev;
>  
>   if (!(BIT(mhi_cntrl->ee) & mhi_chan->ee_mask)) {
> - dev_err(dev,
> - "Current EE: %s Required EE Mask: 0x%x for chan: %s\n",
> - TO_MHI_EXEC_STR(mhi_cntrl->ee), mhi_chan->ee_mask,
> - mhi_chan->name);
> + dev_err(dev, "Current EE: %s Required EE Mask: 0x%x\n",
> + TO_MHI_EXEC_STR(mhi_cntrl->ee), mhi_chan->ee_mask);
>   return -ENOTCONN;
>   }
>  
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


Re: [PATCH v8 3/9] bus: mhi: core: Improvements to the channel handling state machine

2021-04-06 Thread Manivannan Sadhasivam
On Thu, Apr 01, 2021 at 02:16:12PM -0700, Bhaumik Bhatt wrote:
> Improve the channel handling state machine such that all commands
> go through a common function and a validation process to ensure
> that the state machine is not violated in any way and adheres to
> the MHI specification. Using this common function allows MHI to
> eliminate some unnecessary debug messages and code duplication.
> 
> Signed-off-by: Bhaumik Bhatt 

Reviewed-by: Manivannan Sadhasivam 

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/init.c |   6 ++
>  drivers/bus/mhi/core/internal.h |  12 
>  drivers/bus/mhi/core/main.c | 151 
> ++--
>  3 files changed, 100 insertions(+), 69 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index f8ba954..9c2ed92 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -56,6 +56,12 @@ const char * const mhi_state_str[MHI_STATE_MAX] = {
>   [MHI_STATE_SYS_ERR] = "SYS ERROR",
>  };
>  
> +const char * const mhi_ch_state_type_str[MHI_CH_STATE_TYPE_MAX] = {
> + [MHI_CH_STATE_TYPE_RESET] = "RESET",
> + [MHI_CH_STATE_TYPE_STOP] = "STOP",
> + [MHI_CH_STATE_TYPE_START] = "START",
> +};
> +
>  static const char * const mhi_pm_state_str[] = {
>   [MHI_PM_STATE_DISABLE] = "DISABLE",
>   [MHI_PM_STATE_POR] = "POWER ON RESET",
> diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
> index e690f15..5b9ea66 100644
> --- a/drivers/bus/mhi/core/internal.h
> +++ b/drivers/bus/mhi/core/internal.h
> @@ -369,6 +369,18 @@ enum mhi_ch_state {
>   MHI_CH_STATE_ERROR = 0x5,
>  };
>  
> +enum mhi_ch_state_type {
> + MHI_CH_STATE_TYPE_RESET,
> + MHI_CH_STATE_TYPE_STOP,
> + MHI_CH_STATE_TYPE_START,
> + MHI_CH_STATE_TYPE_MAX,
> +};
> +
> +extern const char * const mhi_ch_state_type_str[MHI_CH_STATE_TYPE_MAX];
> +#define TO_CH_STATE_TYPE_STR(state) (((state) >= MHI_CH_STATE_TYPE_MAX) ? \
> +  "INVALID_STATE" : \
> +  mhi_ch_state_type_str[(state)])
> +
>  #define MHI_INVALID_BRSTMODE(mode) (mode != MHI_DB_BRST_DISABLE && \
>   mode != MHI_DB_BRST_ENABLE)
>  
> diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
> index 8c510f1..710ca0f 100644
> --- a/drivers/bus/mhi/core/main.c
> +++ b/drivers/bus/mhi/core/main.c
> @@ -1234,56 +1234,105 @@ int mhi_send_cmd(struct mhi_controller *mhi_cntrl,
>   return 0;
>  }
>  
> -static void __mhi_unprepare_channel(struct mhi_controller *mhi_cntrl,
> - struct mhi_chan *mhi_chan)
> +static int mhi_update_channel_state(struct mhi_controller *mhi_cntrl,
> + struct mhi_chan *mhi_chan,
> + enum mhi_ch_state_type to_state)
>  {
> - int ret;
>   struct device *dev = &mhi_cntrl->mhi_dev->dev;
> + enum mhi_cmd_type cmd = MHI_CMD_NOP;
> + int ret;
>  
> - dev_dbg(dev, "Entered: unprepare channel:%d\n", mhi_chan->chan);
> -
> - /* no more processing events for this channel */
> - mutex_lock(&mhi_chan->mutex);
> - write_lock_irq(&mhi_chan->lock);
> - if (mhi_chan->ch_state != MHI_CH_STATE_ENABLED &&
> - mhi_chan->ch_state != MHI_CH_STATE_SUSPENDED) {
> + dev_dbg(dev, "%d: Updating channel state to: %s\n", mhi_chan->chan,
> + TO_CH_STATE_TYPE_STR(to_state));
> +
> + switch (to_state) {
> + case MHI_CH_STATE_TYPE_RESET:
> + write_lock_irq(&mhi_chan->lock);
> + if (mhi_chan->ch_state != MHI_CH_STATE_STOP &&
> + mhi_chan->ch_state != MHI_CH_STATE_ENABLED &&
> + mhi_chan->ch_state != MHI_CH_STATE_SUSPENDED) {
> + write_unlock_irq(&mhi_chan->lock);
> + return -EINVAL;
> + }
> + mhi_chan->ch_state = MHI_CH_STATE_DISABLED;
>   write_unlock_irq(&mhi_chan->lock);
> - mutex_unlock(&mhi_chan->mutex);
> - return;
> - }
>  
> - mhi_chan->ch_state = MHI_CH_STATE_DISABLED;
> - write_unlock_irq(&mhi_chan->lock);
> + cmd = MHI_CMD_RESET_CHAN;
> + break;
> + case MHI_CH_STATE_TYPE_STOP:
> + if (mhi_chan->ch_state != MHI_CH_STATE_ENABLED)
> + return -EINVAL;
>  
> - reinit_completion(&mhi_chan->completion);
> - read_lock_bh(&mhi_cntrl->pm_lock);
> - if (MHI_PM_IN_ERROR_STATE(mhi_cntrl->pm_state)) {
> - read_unlock_bh(&mhi_cntrl->pm_lock);
> - goto error_invalid_state;
> + cmd = MHI_CMD_STOP_CHAN;
> + break;
> + case MHI_CH_STATE_TYPE_START:
> + if (mhi_chan->ch_state != MHI_CH_STATE_STOP &&
> + mhi_chan->ch_state != MHI_CH_STATE_DISABLED)
> + return -EINVAL;
> +
> + cmd = MHI_CMD_START_CHAN;
> + break;
> + 

Re: [PATCH] i2c: omap: Fix rumtime PM imbalance on error

2021-04-06 Thread Vignesh Raghavendra



On 4/7/21 9:00 AM, Dinghao Liu wrote:
> pm_runtime_get_sync() will increase the rumtime PM counter
> even it returns an error. Thus a pairing decrement is needed
> to prevent refcount leak. Fix this by replacing this API with
> pm_runtime_resume_and_get(), which will not change the runtime
> PM counter on error.
> 
> Signed-off-by: Dinghao Liu 
> ---

Do we need a Fixes: tag to enable stable backports?

Reviewed-by: Vignesh Raghavendra 

>  drivers/i2c/busses/i2c-omap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 12ac4212aded..c9ee0875a79d 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1404,7 +1404,7 @@ omap_i2c_probe(struct platform_device *pdev)
>   pm_runtime_set_autosuspend_delay(omap->dev, OMAP_I2C_PM_TIMEOUT);
>   pm_runtime_use_autosuspend(omap->dev);
>  
> - r = pm_runtime_get_sync(omap->dev);
> + r = pm_runtime_resume_and_get(omap->dev);
>   if (r < 0)
>   goto err_free_mem;
>  
> 


[PATCH] staging: rt8192u: change constants to be on right

2021-04-06 Thread Vardhan H G
When comparing a constant with variable, it is recommeneded
to have the constant on the right side of the test.

This patch silences the following checkpatch.pl warning:
 "Comparisons should place the constant on the right side of the test"

Signed-off-by: Vardhan H G 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
index 379a2ccf4d9f..6823e405eeb8 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c
@@ -140,7 +140,7 @@ static struct sk_buff *ieee80211_ADDBA(struct 
ieee80211_device *ieee, u8 *Dst, s
// Dialog Token
*tag++ = pBA->dialog_token;
 
-   if (ACT_ADDBARSP == type) {
+   if (type == ACT_ADDBARSP) {
// Status Code
netdev_info(ieee->dev, "=>to send ADDBARSP\n");
 
@@ -156,7 +156,7 @@ static struct sk_buff *ieee80211_ADDBA(struct 
ieee80211_device *ieee, u8 *Dst, s
put_unaligned_le16(pBA->timeout_value, tag);
tag += 2;
 
-   if (ACT_ADDBAREQ == type) {
+   if (type == ACT_ADDBAREQ) {
// BA Start SeqCtrl
memcpy(tag, (u8 *)&(pBA->start_seq_ctrl), 2);
tag += 2;
-- 
2.27.0



Re: [PATCH v2 1/2] Documentation: misc-devices: Fix indentation, formatting, and update outdated info

2021-04-06 Thread Greg Kroah-Hartman
On Tue, Apr 06, 2021 at 11:17:48PM +0200, Gustavo Pimentel wrote:
> Fixes indentation issues reported by doing *make htmldocs* as well some
> text formatting.
> 
> Besides these fixes, there was some outdated information related to stop
> file interface in sysfs.

You are not doing this for all "misc-devices", you are doing this only
for one specific driver file.

Please look at the example I provided for how to name this and fix up.

> 
> Fixes: e1181b5bbc3c ("Documentation: misc-devices: Add Documentation for 
> dw-xdata-pcie driver")
> Link: 
> https://lore.kernel.org/linux-next/20210406214615.40cf3...@canb.auug.org.au/
> Reported-by: Stephen Rothwell 
> Signed-off-by: Gustavo Pimentel 
> ---
>  Documentation/misc-devices/dw-xdata-pcie.rst | 62 
> +++-
>  1 file changed, 43 insertions(+), 19 deletions(-)

What changed from v1?  Always put that below the --- line.

thanks,

greg k-h


Re: [PATCH v7 8/8] pwm: pca9685: Add error messages for failed regmap calls

2021-04-06 Thread Uwe Kleine-König
On Tue, Apr 06, 2021 at 06:41:40PM +0200, Clemens Gruber wrote:
> Regmap operations can fail if the underlying subsystem is not working
> properly (e.g. hogged I2C bus, etc.)
> As this is useful information for the user, print an error message if it
> happens.
> Let probe fail if the first regmap_read or the first regmap_write fails.
> 
> Signed-off-by: Clemens Gruber 
> ---
> Changes since v6:
> - Rebased
> 
>  drivers/pwm/pwm-pca9685.c | 83 ---
>  1 file changed, 59 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c
> index cf0c98e4ef44..8a4993882b40 100644
> --- a/drivers/pwm/pwm-pca9685.c
> +++ b/drivers/pwm/pwm-pca9685.c
> @@ -107,6 +107,30 @@ static bool pca9685_prescaler_can_change(struct pca9685 
> *pca, int channel)
>   return test_bit(channel, pca->pwms_enabled);
>  }
>  
> +static int pca9685_read_reg(struct pca9685 *pca, unsigned int reg, unsigned 
> int *val)
> +{
> + struct device *dev = pca->chip.dev;
> + int err;
> +
> + err = regmap_read(pca->regmap, reg, val);
> + if (err != 0)
> + dev_err(dev, "regmap_read of register 0x%x failed: %d\n", reg, 
> err);

Please use %pe to emit the error code instead of %d.

> +
> + return err;
> +}
> +
> +static int pca9685_write_reg(struct pca9685 *pca, unsigned int reg, unsigned 
> int val)
> +{
> + struct device *dev = pca->chip.dev;
> + int err;
> +
> + err = regmap_write(pca->regmap, reg, val);
> + if (err != 0)
> + dev_err(dev, "regmap_write to register 0x%x failed: %d\n", reg, 
> err);
> +
> + return err;
> +}
> +
>  /* Helper function to set the duty cycle ratio to duty/4096 (e.g. duty=2048 
> -> 50%) */
>  static void pca9685_pwm_set_duty(struct pca9685 *pca, int channel, unsigned 
> int duty)
>  {
> @@ -115,12 +139,12 @@ static void pca9685_pwm_set_duty(struct pca9685 *pca, 
> int channel, unsigned int
>  
>   if (duty == 0) {
>   /* Set the full OFF bit, which has the highest precedence */
> - regmap_write(pca->regmap, REG_OFF_H(channel), LED_FULL);
> + pca9685_write_reg(pca, REG_OFF_H(channel), LED_FULL);

You didn't check all return codes? How did you select the calls to
check?

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


[PATCH] lib/string: Introduce sysfs_streqcase

2021-04-06 Thread Gioh Kim
As the name shows, it checks if strings are equal in case insensitive
manner.

For example, drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c uses
strncasecmp to check that the input via sysfs is "mi". But it would
work even-if the input is "min-wrongcommand".

I found some more cases using strncasecmp to check the entire string
such as rtrs-clt-sysfs.c does. drivers/pnp/interface.c checks
"disable" command with strncasecmp but it would also work if the
command is "disable-wrong".

Signed-off-by: Gioh Kim 
---
 include/linux/string.h |  1 +
 lib/string.c   | 23 +++
 2 files changed, 24 insertions(+)

diff --git a/include/linux/string.h b/include/linux/string.h
index 4fcfb56abcf5..36d00ff8013e 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -184,6 +184,7 @@ extern char **argv_split(gfp_t gfp, const char *str, int 
*argcp);
 extern void argv_free(char **argv);
 
 extern bool sysfs_streq(const char *s1, const char *s2);
+extern bool sysfs_streqcase(const char *s1, const char *s2);
 extern int kstrtobool(const char *s, bool *res);
 static inline int strtobool(const char *s, bool *res)
 {
diff --git a/lib/string.c b/lib/string.c
index 7548eb715ddb..5e6bc0d3d5c6 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -714,6 +714,29 @@ bool sysfs_streq(const char *s1, const char *s2)
 }
 EXPORT_SYMBOL(sysfs_streq);
 
+/**
+ * sysfs_streqcase - same to sysfs_streq and case insensitive
+ * @s1: one string
+ * @s2: another string
+ *
+ */
+bool sysfs_streqcase(const char *s1, const char *s2)
+{
+   while (*s1 && tolower(*s1) == tolower(*s2)) {
+   s1++;
+   s2++;
+   }
+
+   if (*s1 == *s2)
+   return true;
+   if (!*s1 && *s2 == '\n' && !s2[1])
+   return true;
+   if (*s1 == '\n' && !s1[1] && !*s2)
+   return true;
+   return false;
+}
+EXPORT_SYMBOL(sysfs_streqcase);
+
 /**
  * match_string - matches given string in an array
  * @array: array of strings
-- 
2.25.1



Re: [PATCH v4] userfaultfd/shmem: fix MCOPY_ATOMIC_CONTINUE behavior

2021-04-06 Thread Hugh Dickins
[PATCH v4] userfaultfd/shmem: fix MCOPY_ATOMIC_CONTINUE behavior
was a significant rework, so here I'm reviewing a synthetic patch
merged from 5.12-rc5's 2021-03-31 mmotm patches:
  userfaultfd-support-minor-fault-handling-for-shmem.patch
  userfaultfd-support-minor-fault-handling-for-shmem-fix.patch
  userfaultfd-support-minor-fault-handling-for-shmem-fix-2.patch
Plus the PATCH v4 which akpm added the next day as fix-3:
  userfaultfd-support-minor-fault-handling-for-shmem-fix-3.patch

[PATCH v5] userfaultfd/shmem: fix MCOPY_ATOMIC_CONTINUE behavior
was the same as v4, except for adding a change in selftests, which
would not apply at this stage of the series: so I've ignored it.

>  fs/userfaultfd.c |6 
>  include/linux/shmem_fs.h |   26 +--
>  include/uapi/linux/userfaultfd.h |4 
>  mm/memory.c  |8 -
>  mm/shmem.c   |   65 +++--
>  mm/userfaultfd.c |  192 -
>  6 files changed, 186 insertions(+), 115 deletions(-)
> 
> diff -purN 5125m243/fs/userfaultfd.c 5125m247/fs/userfaultfd.c
> --- 5125m243/fs/userfaultfd.c 2021-04-04 22:32:32.018244547 -0700
> +++ 5125m247/fs/userfaultfd.c 2021-04-04 22:34:14.946860343 -0700
> @@ -1267,8 +1267,7 @@ static inline bool vma_can_userfault(str
>   }
>  
>   if (vm_flags & VM_UFFD_MINOR) {
> - /* FIXME: Add minor fault interception for shmem. */
> - if (!is_vm_hugetlb_page(vma))
> + if (!(is_vm_hugetlb_page(vma) || vma_is_shmem(vma)))
>   return false;
>   }
>  
> @@ -1941,7 +1940,8 @@ static int userfaultfd_api(struct userfa
>   /* report all available features and ioctls to userland */
>   uffdio_api.features = UFFD_API_FEATURES;
>  #ifndef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR
> - uffdio_api.features &= ~UFFD_FEATURE_MINOR_HUGETLBFS;
> + uffdio_api.features &=
> + ~(UFFD_FEATURE_MINOR_HUGETLBFS | UFFD_FEATURE_MINOR_SHMEM);
>  #endif
>   uffdio_api.ioctls = UFFD_API_IOCTLS;
>   ret = -EFAULT;
> diff -purN 5125m243/include/linux/shmem_fs.h 5125m247/include/linux/shmem_fs.h
> --- 5125m243/include/linux/shmem_fs.h 2021-02-14 14:32:24.0 -0800
> +++ 5125m247/include/linux/shmem_fs.h 2021-04-04 22:34:14.958860415 -0700
> @@ -9,6 +9,7 @@
>  #include 
>  #include 
>  #include 
> +#include 

I'd much rather not include userfaultfd_k.h in shmem_fs.h, and go back
to including it in mm/shmem.c: it's better to minimize everyone's header
file inclusion, where reasonably possible.  A small change below for that.

I advise the same for include/linux/hugetlb.h and mm/hugetlb.c,
but those are outside the scope of this userfaultfd/shmem patch.

>  
>  /* inode in-kernel data */
>  
> @@ -122,21 +123,16 @@ static inline bool shmem_file(struct fil
>  extern bool shmem_charge(struct inode *inode, long pages);
>  extern void shmem_uncharge(struct inode *inode, long pages);
>  
> +#ifdef CONFIG_USERFAULTFD
>  #ifdef CONFIG_SHMEM
> -extern int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
> -   struct vm_area_struct *dst_vma,
> -   unsigned long dst_addr,
> -   unsigned long src_addr,
> -   struct page **pagep);
> -extern int shmem_mfill_zeropage_pte(struct mm_struct *dst_mm,
> - pmd_t *dst_pmd,
> - struct vm_area_struct *dst_vma,
> - unsigned long dst_addr);
> -#else
> -#define shmem_mcopy_atomic_pte(dst_mm, dst_pte, dst_vma, dst_addr, \
> -src_addr, pagep)({ BUG(); 0; })
> -#define shmem_mfill_zeropage_pte(dst_mm, dst_pmd, dst_vma, \
> -  dst_addr)  ({ BUG(); 0; })
> -#endif

Please add
enum mcopy_atomic_mode;
here, so the compiler can understand it without needing userfaultfd_k.h.

> +int shmem_mcopy_atomic_pte(struct mm_struct *dst_mm, pmd_t *dst_pmd,
> +struct vm_area_struct *dst_vma,
> +unsigned long dst_addr, unsigned long src_addr,
> +enum mcopy_atomic_mode mode, struct page **pagep);
> +#else /* !CONFIG_SHMEM */
> +#define shmem_mcopy_atomic_pte(dst_mm, dst_pmd, dst_vma, dst_addr, \
> +src_addr, mode, pagep)({ BUG(); 0; })
> +#endif /* CONFIG_SHMEM */
> +#endif /* CONFIG_USERFAULTFD */
>  
>  #endif
> diff -purN 5125m243/include/uapi/linux/userfaultfd.h 
> 5125m247/include/uapi/linux/userfaultfd.h
> --- 5125m243/include/uapi/linux/userfaultfd.h 2021-04-04 22:32:32.042244690 
> -0700
> +++ 5125m247/include/uapi/linux/userfaultfd.h 2021-04-04 22:34:14.962860439 
> -0700
> @@ -31,7 +31,8 @@
>  UFFD_FEATURE_MISSING_SHMEM | \
>  UFFD_FEATURE_SIGBUS |\
>  UFFD_FEATURE_THREAD_

Re: [PATCH v7 7/8] pwm: pca9685: Restrict period change for enabled PWMs

2021-04-06 Thread Uwe Kleine-König
On Tue, Apr 06, 2021 at 06:41:39PM +0200, Clemens Gruber wrote:
> Previously, the last used PWM channel could change the global prescale
> setting, even if other channels are already in use.
> 
> Fix it by only allowing the first enabled PWM to change the global
> chip-wide prescale setting. If there is more than one channel in use,
> the prescale settings resulting from the chosen periods must match.
> 
> GPIOs do not count as enabled PWMs as they are not using the prescaler
> and can't change it.
> 
> Signed-off-by: Clemens Gruber 
> ---
> Changes since v6:
> - Only allow the first PWM that is enabled to change the prescaler, not
>   the first one that uses the prescaler
> 
>  drivers/pwm/pwm-pca9685.c | 66 +--
>  1 file changed, 56 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/pwm/pwm-pca9685.c b/drivers/pwm/pwm-pca9685.c
> index 24221ee7a77a..cf0c98e4ef44 100644
> --- a/drivers/pwm/pwm-pca9685.c
> +++ b/drivers/pwm/pwm-pca9685.c
> @@ -23,11 +23,11 @@
>  #include 
>  
>  /*
> - * Because the PCA9685 has only one prescaler per chip, changing the period 
> of
> - * one channel affects the period of all 16 PWM outputs!
> - * However, the ratio between each configured duty cycle and the chip-wide
> - * period remains constant, because the OFF time is set in proportion to the
> - * counter range.
> + * Because the PCA9685 has only one prescaler per chip, only the first 
> channel
> + * that is enabled is allowed to change the prescale register.
> + * PWM channels requested afterwards must use a period that results in the 
> same
> + * prescale setting as the one set by the first requested channel.
> + * GPIOs do not count as enabled PWMs as they are not using the prescaler.
>   */
>  
>  #define PCA9685_MODE10x00
> @@ -78,8 +78,9 @@
>  struct pca9685 {
>   struct pwm_chip chip;
>   struct regmap *regmap;
> -#if IS_ENABLED(CONFIG_GPIOLIB)
>   struct mutex lock;
> + DECLARE_BITMAP(pwms_enabled, PCA9685_MAXCHAN + 1);
> +#if IS_ENABLED(CONFIG_GPIOLIB)
>   struct gpio_chip gpio;
>   DECLARE_BITMAP(pwms_inuse, PCA9685_MAXCHAN + 1);
>  #endif
> @@ -90,6 +91,22 @@ static inline struct pca9685 *to_pca(struct pwm_chip *chip)
>   return container_of(chip, struct pca9685, chip);
>  }
>  
> +/* This function is supposed to be called with the lock mutex held */
> +static bool pca9685_prescaler_can_change(struct pca9685 *pca, int channel)
> +{
> + /* No PWM enabled: Change allowed */
> + if (bitmap_empty(pca->pwms_enabled, PCA9685_MAXCHAN + 1))
> + return true;
> + /* More than one PWM enabled: Change not allowed */
> + if (bitmap_weight(pca->pwms_enabled, PCA9685_MAXCHAN + 1) > 1)
> + return false;
> + /*
> +  * Only one PWM enabled: Change allowed if the PWM about to
> +  * be changed is the one that is already enabled
> +  */
> + return test_bit(channel, pca->pwms_enabled);

Maybe this is a bit more effective?:

DECLARE_BITMAP(blablub, PCA9685_MAXCHAN + 1);   
bitmap_zero(blablub, PCA9685_MAXCHAN + 1);
bitmap_set(blablub, channel);
return bitmap_subset(pca->pwms_enabled, blablub);

(but that's a minor issue, the suggested algorithm is correct.)

So:

Acked-by: Uwe Kleine-König 

(side-note: I wonder if the handling of the set-all channel is correct
here. But given that it is messy anyhow, (e.g. because setting some
state to this set-all channel doesn't influence pwm_get_state for the
individual channels) I don't object if there is another problem in this
corner case. IMHO just dropping this virtual channel would be nice.)

Best regards
Uwe

-- 
Pengutronix e.K.   | Uwe Kleine-König|
Industrial Linux Solutions | https://www.pengutronix.de/ |


signature.asc
Description: PGP signature


[PATCH v2] docs: driver-model: Update the documentation for device class

2021-04-06 Thread Manivannan Sadhasivam
The current documentation about the device class is out of date such
that it refers to non-existent APIs and structures. This commit updates
them to the current device class APIs and structures, removes wordings
that no longer valid while trying to keep the original content intact.

Signed-off-by: Manivannan Sadhasivam 
---

Changes in v2:

* Fixed CLASS_ATTR_RW as spotted by Greg

 .../driver-api/driver-model/class.rst | 144 --
 1 file changed, 66 insertions(+), 78 deletions(-)

diff --git a/Documentation/driver-api/driver-model/class.rst 
b/Documentation/driver-api/driver-model/class.rst
index fff55b80e86a..87441f4ac4ac 100644
--- a/Documentation/driver-api/driver-model/class.rst
+++ b/Documentation/driver-api/driver-model/class.rst
@@ -5,12 +5,7 @@ Device Classes
 Introduction
 
 A device class describes a type of device, like an audio or network
-device. The following device classes have been identified:
-
-
-
-
-Each device class defines a set of semantics and a programming interface
+device. It defines a set of semantics and a programming interface
 that devices of that class adhere to. Device drivers are the
 implementation of that programming interface for a particular device on
 a particular bus.
@@ -18,23 +13,27 @@ a particular bus.
 Device classes are agnostic with respect to what bus a device resides
 on.
 
-
 Programming Interface
 ~
 The device class structure looks like::
 
+  struct class {
+const char  *name;
+struct module   *owner;
 
-  typedef int (*devclass_add)(struct device *);
-  typedef void (*devclass_remove)(struct device *);
+const struct attribute_group**class_groups;
+const struct attribute_group**dev_groups;
+struct kobject  *dev_kobj;
+...
+  };
 
 See the kerneldoc for the struct class.
 
 A typical device class definition would look like::
 
-  struct device_class input_devclass = {
-.name  = "input",
-.add_device= input_add_device,
-   .remove_device  = input_remove_device,
+  struct class input_class = {
+.name   = "input",
+.dev_release= input_dev_release,
   };
 
 Each device class structure should be exported in a header file so it
@@ -42,101 +41,84 @@ can be used by drivers, extensions and interfaces.
 
 Device classes are registered and unregistered with the core using::
 
-  int devclass_register(struct device_class * cls);
-  void devclass_unregister(struct device_class * cls);
-
+  int class_register(struct class *class);
+  void class_unregister(struct class *class);
 
 Devices
 ~~~
-As devices are bound to drivers, they are added to the device class
-that the driver belongs to. Before the driver model core, this would
-typically happen during the driver's probe() callback, once the device
-has been initialized. It now happens after the probe() callback
-finishes from the core.
-
-The device is enumerated in the class. Each time a device is added to
-the class, the class's devnum field is incremented and assigned to the
-device. The field is never decremented, so if the device is removed
-from the class and re-added, it will receive a different enumerated
-value.
-
-The class is allowed to create a class-specific structure for the
-device and store it in the device's class_data pointer.
-
-There is no list of devices in the device class. Each driver has a
-list of devices that it supports. The device class has a list of
-drivers of that particular class. To access all of the devices in the
-class, iterate over the device lists of each driver in the class.
+When a device is added, it is also added to the 'klist_devices' inside
+the 'subsys_private' struct of the class. Later, the devices belonging
+to the class are accessed using::
 
+  class_dev_iter_next()
+  class_find_device()
+  class_find_device_by_name()
 
-Device Drivers
-~~
-Device drivers are added to device classes when they are registered
-with the core. A driver specifies the class it belongs to by setting
-the struct device_driver::devclass field.
+It is also possible to access the devices of a class in a platform
+dependent way using::
 
+  class_find_device_by_of_node()
+  class_find_device_by_acpi_dev()
 
 sysfs directory structure
 
 There is a top-level sysfs directory named 'class'.
 
-Each class gets a directory in the class directory, along with two
-default subdirectories::
+Each class gets a directory in the top-level class directory::
 
-class/
-`-- input
-|-- devices
-`-- drivers
+  class/
+  |-- input
+  |-- block
+  |-- drm
+  |-- nvme
 
-
-Drivers registered with the class get a symlink in the drivers/ directory
-that points to the driver's directory (under its bus directory)::
-
-   class/
-   `-- input
-   |-- devices
-   `-- drivers
-   `-- usb:usb_mouse -> ../../

Re: [PATCH] i2c: omap: Fix rumtime PM imbalance on error

2021-04-06 Thread Tony Lindgren
* Dinghao Liu  [210407 03:31]:
> pm_runtime_get_sync() will increase the rumtime PM counter
> even it returns an error. Thus a pairing decrement is needed
> to prevent refcount leak. Fix this by replacing this API with
> pm_runtime_resume_and_get(), which will not change the runtime
> PM counter on error.
> 
> Signed-off-by: Dinghao Liu 

Reviewed-by: Tony Lindgren 

> ---
>  drivers/i2c/busses/i2c-omap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 12ac4212aded..c9ee0875a79d 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1404,7 +1404,7 @@ omap_i2c_probe(struct platform_device *pdev)
>   pm_runtime_set_autosuspend_delay(omap->dev, OMAP_I2C_PM_TIMEOUT);
>   pm_runtime_use_autosuspend(omap->dev);
>  
> - r = pm_runtime_get_sync(omap->dev);
> + r = pm_runtime_resume_and_get(omap->dev);
>   if (r < 0)
>   goto err_free_mem;
>  
> -- 
> 2.17.1
> 


Re: [PATCH RESEND] lib/scatterlist: Fix NULL pointer deference

2021-04-06 Thread Christoph Hellwig
Looks good,

Reviewed-by: Christoph Hellwig 


Re: [PATCH v6 01/27] mm: Introduce struct folio

2021-04-06 Thread Christoph Hellwig
On Tue, Apr 06, 2021 at 05:25:30PM +0100, Matthew Wilcox wrote:
> About a third of ->index can be folio_offset(), based on a crude:
> 
> $ git grep 'page->index.*PAGE_' |wc -l
> 101
> 
> and I absolutely don't mind cleaning that up as part of the folio work,
> but that still leaves 200-250 instances that would need to be changed
> later.
> 
> I don't want to change the page->mapping to calls to folio_mapping().
> That's a lot of extra work for a page which the filesystem knows belongs
> to it.  folio_mapping() only needs to be used for pages which might not
> belong to a filesystem.
> 
> page_file_mapping() absolutely needs to go away.  The way to do that
> is to change swap-over-nfs to use direct IO, and then NFS can use
> folio->mapping like all other filesystems.  f2fs is just terminally
> confused and shouldn't be using page_file_mapping at all.  I'll fix
> that as part of the folio work.

Thanks.  So my opinion for now remains preferably just don't add
the union and derefence through the page.  But I'm not going to block
the series for it, as I think it is a huge and badly needed cleanup
required to make further use of larger pages / large chunks of memory
in the pagecache and the file systems.


[PATCH net-next v5] atl1c: move tx cleanup processing out of interrupt

2021-04-06 Thread Gatis Peisenieks

Tx queue cleanup happens in interrupt handler on same core as rx queue
processing. Both can take considerable amount of processing in high
packet-per-second scenarios.

Sending big amounts of packets can stall the rx processing which is 
unfair

and also can lead to out-of-memory condition since __dev_kfree_skb_irq
queues the skbs for later kfree in softirq which is not allowed to 
happen

with heavy load in interrupt handler.

This puts tx cleanup in its own napi and enables threaded napi to allow
the rx/tx queue processing to happen on different cores.

The ability to sustain equal amounts of tx/rx traffic increased:
from 280Kpps to 1130Kpps on Threadripper 3960X with upcoming
Mikrotik 10/25G NIC,
from 520Kpps to 850Kpps on Intel i3-3320 with Mikrotik RB44Ge adapter.

Signed-off-by: Gatis Peisenieks 
---
Reposting for net-next as requested by David Miller,

v5:
- EXPORT_SYMBOL(dev_set_threaded) not needed, already there
v4:
- made scripts/checkpatch.pl happy
- moved the new intr_mask_lock to be besides the intr_mask it
  protects so they are more likely to be on same cacheline
v3:
- addressed comments from Eric Dumazet
- added EXPORT_SYMBOL for dev_set_threaded
---
 drivers/net/ethernet/atheros/atl1c/atl1c.h|  2 +
 .../net/ethernet/atheros/atl1c/atl1c_main.c   | 44 ++-
 2 files changed, 36 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c.h 
b/drivers/net/ethernet/atheros/atl1c/atl1c.h

index a0562a90fb6d..28ae5c16831e 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c.h
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c.h
@@ -367,6 +367,7 @@ struct atl1c_hw {
u16 phy_id1;
u16 phy_id2;

+   spinlock_t intr_mask_lock;  /* protect the intr_mask */
u32 intr_mask;

u8 preamble_len;
@@ -506,6 +507,7 @@ struct atl1c_adapter {
struct net_device   *netdev;
struct pci_dev  *pdev;
struct napi_struct  napi;
+   struct napi_struct  tx_napi;
struct page *rx_page;
unsigned intrx_page_offset;
unsigned intrx_frag_size;
diff --git a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c 
b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c

index d54375b255dc..1d17c24e6d75 100644
--- a/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
+++ b/drivers/net/ethernet/atheros/atl1c/atl1c_main.c
@@ -813,6 +813,7 @@ static int atl1c_sw_init(struct atl1c_adapter 
*adapter)

atl1c_set_rxbufsize(adapter, adapter->netdev);
atomic_set(&adapter->irq_sem, 1);
spin_lock_init(&adapter->mdio_lock);
+   spin_lock_init(&adapter->hw.intr_mask_lock);
set_bit(__AT_DOWN, &adapter->flags);

return 0;
@@ -1530,20 +1531,19 @@ static inline void atl1c_clear_phy_int(struct 
atl1c_adapter *adapter)

spin_unlock(&adapter->mdio_lock);
 }

-static bool atl1c_clean_tx_irq(struct atl1c_adapter *adapter,
-   enum atl1c_trans_queue type)
+static int atl1c_clean_tx(struct napi_struct *napi, int budget)
 {
-   struct atl1c_tpd_ring *tpd_ring = &adapter->tpd_ring[type];
+   struct atl1c_adapter *adapter =
+   container_of(napi, struct atl1c_adapter, tx_napi);
+	struct atl1c_tpd_ring *tpd_ring = 
&adapter->tpd_ring[atl1c_trans_normal];

struct atl1c_buffer *buffer_info;
struct pci_dev *pdev = adapter->pdev;
u16 next_to_clean = atomic_read(&tpd_ring->next_to_clean);
u16 hw_next_to_clean;
-   u16 reg;
unsigned int total_bytes = 0, total_packets = 0;
+   unsigned long flags;

-	reg = type == atl1c_trans_high ? REG_TPD_PRI1_CIDX : 
REG_TPD_PRI0_CIDX;

-
-   AT_READ_REGW(&adapter->hw, reg, &hw_next_to_clean);
+   AT_READ_REGW(&adapter->hw, REG_TPD_PRI0_CIDX, &hw_next_to_clean);

while (next_to_clean != hw_next_to_clean) {
buffer_info = &tpd_ring->buffer_info[next_to_clean];
@@ -1564,7 +1564,15 @@ static bool atl1c_clean_tx_irq(struct 
atl1c_adapter *adapter,

netif_wake_queue(adapter->netdev);
}

-   return true;
+   if (total_packets < budget) {
+   napi_complete_done(napi, total_packets);
+   spin_lock_irqsave(&adapter->hw.intr_mask_lock, flags);
+   adapter->hw.intr_mask |= ISR_TX_PKT;
+   AT_WRITE_REG(&adapter->hw, REG_IMR, adapter->hw.intr_mask);
+   spin_unlock_irqrestore(&adapter->hw.intr_mask_lock, flags);
+   return total_packets;
+   }
+   return budget;
 }

 /**
@@ -1599,13 +1607,22 @@ static irqreturn_t atl1c_intr(int irq, void 
*data)

AT_WRITE_REG(hw, REG_ISR, status | ISR_DIS_INT);
if (status & ISR_RX_PKT) {
if (likely(napi_schedule_prep(&adapter->napi))) {
+   spin_lock(&hw->intr_mask_lock);
hw->intr_mask &= ~ISR_RX_PKT;
  

[PATCH] staging: rtl8192u: remove unused variable

2021-04-06 Thread Jiapeng Chong
Fix the following gcc warning:

drivers/staging/rtl8192u/r8192U_core.c:3419:6: warning: variable
‘reset_status’ set but not used [-Wunused-but-set-variable].

Reported-by: Abaci Robot 
Signed-off-by: Jiapeng Chong 
---
 drivers/staging/rtl8192u/r8192U_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 9fc4adc..f48c042 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3416,7 +3416,6 @@ int rtl8192_down(struct net_device *dev)
 void rtl8192_commit(struct net_device *dev)
 {
struct r8192_priv *priv = ieee80211_priv(dev);
-   int reset_status = 0;
 
if (priv->up == 0)
return;
@@ -3428,7 +3427,7 @@ void rtl8192_commit(struct net_device *dev)
ieee80211_softmac_stop_protocol(priv->ieee80211);
 
rtl8192_rtx_disable(dev);
-   reset_status = _rtl8192_up(dev);
+   _rtl8192_up(dev);
 }
 
 static void rtl8192_restart(struct work_struct *work)
-- 
1.8.3.1



Re: [PATCH] Input: gpio-keys - fix crash when disabliing GPIO-less buttons

2021-04-06 Thread Tony Lindgren
* Dmitry Torokhov  [210407 05:30]:
> My brain-damaged adjustments to Paul's patch caused crashes in
> gpio_keys_disable_button() when driver is used in GPIO-less (i.e.
> purely interrupt-driven) setups, because I mixed together debounce and
> release timers when they are in fact separate:
> 
> Unable to handle kernel NULL pointer dereference at virtual address 000c
> ...
> PC is at hrtimer_active+0xc/0x98
> LR is at hrtimer_try_to_cancel+0x24/0x140
> ...
> [] (hrtimer_active) from [] 
> (hrtimer_try_to_cancel+0x24/0x140)
> [] (hrtimer_try_to_cancel) from [] 
> (hrtimer_cancel+0x14/0x4c)
> [] (hrtimer_cancel) from [] 
> (gpio_keys_attr_store_helper+0x1b8/0x1d8 [gpio_keys])
> [] (gpio_keys_attr_store_helper [gpio_keys]) from [] 
> (gpio_keys_store_disabled_keys+0x18/0x24 [gpio_keys])
> [] (gpio_keys_store_disabled_keys [gpio_keys]) from [] 
> (kernfs_fop_write_iter+0x10c/0x1cc)
> [] (kernfs_fop_write_iter) from [] (vfs_write+0x2ac/0x404)
> [] (vfs_write) from [] (ksys_write+0x64/0xdc)
> [] (ksys_write) from [] (ret_fast_syscall+0x0/0x58)
> 
> Let's fix it up.
> 
> Fixes: c9efb0ba281e ("Input: gpio-keys - use hrtimer for software debounce, 
> if possible")
> Reported-by: Tony Lindgren 
> Signed-off-by: Dmitry Torokhov 
> ---
> 
> Tony, could you please try this patch and see if it fixes the crash you
> observed?

Yes great, thanks this works for me:

Tested-by: Tony Lindgren 


RE: [PATCH v5 1/2] dt-bindings: drm/bridge: MHDP8546 bridge binding changes for HDCP

2021-04-06 Thread Parshuram Raju Thombare
Hi Rob,

Thanks for your comment and sorry for late response.

>> -minItems: 1
>> -maxItems: 2
>> +minItems: 2
>> +maxItems: 3
>
>1 entry was valid and now it is not? That's not a compatible change and
>needs an explanation at a minimum.

Yes, as the driver returns error in the absence of SAPB port address range, this
may break the driver on platform without SAPB port. This IP needs SAPB port
to support HDCP feature using embedded HDCP crypto module.

So, to maintain backward compatibility I will modify the driver and allow it
to proceed without HDCP feature, instead of returning an error, in case of no 
SAPB port.

Regards,
Parshuram Thombare




Re: [PATCH v2 0/6] perf arm64 metricgroup support

2021-04-06 Thread kajoljain



On 3/25/21 4:03 PM, John Garry wrote:
> This series contains support to get basic metricgroups working for
> arm64 CPUs.
> 
> Initial support is added for HiSilicon hip08 platform.
> 
> Some sample usage on Huawei D06 board:
> 
>  $ ./perf list metric
> 
> List of pre-defined events (to be used in -e): 
> 
> Metrics: 
> 
>   bp_misp_flush
>[BP misp flush L3 topdown metric]
>   branch_mispredicts
>[Branch mispredicts L2 topdown metric]
>   core_bound
>[Core bound L2 topdown metric]
>   divider
>[Divider L3 topdown metric]
>   exe_ports_util
>[EXE ports util L3 topdown metric]
>   fetch_bandwidth_bound
>[Fetch bandwidth bound L2 topdown metric]
>   fetch_latency_bound
>[Fetch latency bound L2 topdown metric]
>   fsu_stall
>[FSU stall L3 topdown metric]
>   idle_by_icache_miss
> 
> $ sudo ./perf stat -v -M core_bound sleep 1
> Using CPUID 0x480fd010
> metric expr (exe_stall_cycle - (mem_stall_anyload + 
> armv8_pmuv3_0@event\=0x7005@)) / cpu_cycles for core_bound
> found event cpu_cycles
> found event armv8_pmuv3_0/event=0x7005/
> found event exe_stall_cycle
> found event mem_stall_anyload
> adding {cpu_cycles -> armv8_pmuv3_0/event=0x7001/
> mem_stall_anyload -> armv8_pmuv3_0/event=0x7004/
> Control descriptor is not initialized
> cpu_cycles: 989433 385050 385050
> armv8_pmuv3_0/event=0x7005/: 19207 385050 385050
> exe_stall_cycle: 900825 385050 385050
> mem_stall_anyload: 253516 385050 385050
> 
> Performance counter stats for 'sleep':
> 
> 989,433  cpu_cycles  # 0.63 core_bound
>   19,207  armv8_pmuv3_0/event=0x7005/
>  900,825  exe_stall_cycle
>  253,516  mem_stall_anyload
> 
>0.000805809 seconds time elapsed
> 
>0.000875000 seconds user
>0.0 seconds sys
>
> perf stat --topdown is not supported, as this requires the CPU PMU to
> expose (alias) events for the TopDown L1 metrics from sysfs, which arm 
> does not do. To get that to work, we probably need to make perf use the
> pmu-events cpumap to learn about those alias events.
> 
> Metric reuse support is added for pmu-events parse metric testcase.
> This had been broken on power9 recentlty:
> https://lore.kernel.org/lkml/20210324015418.gc8...@li-24c3614c-2adc-11b2-a85c-85f334518bdb.ibm.com/
>  

Patch set looks good to me.

Reviewed-By: Kajol Jain

Thanks,
Kajol jain

> 
> Differences to v1:
> - Add pmu_events_map__find() as arm64-specific function
> - Fix metric reuse for pmu-events parse metric testcase 
> 
> John Garry (6):
>   perf metricgroup: Make find_metric() public with name change
>   perf test: Handle metric reuse in pmu-events parsing test
>   perf pmu: Add pmu_events_map__find()
>   perf vendor events arm64: Add Hisi hip08 L1 metrics
>   perf vendor events arm64: Add Hisi hip08 L2 metrics
>   perf vendor events arm64: Add Hisi hip08 L3 metrics
> 
>  tools/perf/arch/arm64/util/Build  |   1 +
>  tools/perf/arch/arm64/util/pmu.c  |  25 ++
>  .../arch/arm64/hisilicon/hip08/metrics.json   | 233 ++
>  tools/perf/tests/pmu-events.c |  82 +-
>  tools/perf/util/metricgroup.c |  12 +-
>  tools/perf/util/metricgroup.h |   3 +-
>  tools/perf/util/pmu.c |   5 +
>  tools/perf/util/pmu.h |   1 +
>  tools/perf/util/s390-sample-raw.c |   4 +-
>  9 files changed, 355 insertions(+), 11 deletions(-)
>  create mode 100644 tools/perf/arch/arm64/util/pmu.c
>  create mode 100644 
> tools/perf/pmu-events/arch/arm64/hisilicon/hip08/metrics.json
> 


Re: [igb] netconsole triggers warning in netpoll_poll_dev

2021-04-06 Thread Oleksandr Natalenko
Hello.

On Tue, Apr 06, 2021 at 11:48:02AM -0700, Jakub Kicinski wrote:
> On Tue, 6 Apr 2021 14:36:19 +0200 Oleksandr Natalenko wrote:
> > Hello.
> > 
> > I've raised this here [1] first, but was suggested to engage igb devs,
> > so here we are.
> > 
> > I'm experiencing the following woes while using netconsole regularly:
> > 
> > ```
> > [22038.710800] [ cut here ]
> > [22038.710801] igb_poll+0x0/0x1440 [igb] exceeded budget in poll
> > [22038.710802] WARNING: CPU: 12 PID: 40362 at net/core/netpoll.c:155 
> > netpoll_poll_dev+0x18a/0x1a0
> > [22038.710802] Modules linked in: ...
> > [22038.710835] CPU: 12 PID: 40362 Comm: systemd-sleep Not tainted 
> > 5.11.0-pf7 #1
> > [22038.710836] Hardware name: ASUS System Product Name/Pro WS X570-ACE, 
> > BIOS 3302 03/05/2021
> > [22038.710836] RIP: 0010:netpoll_poll_dev+0x18a/0x1a0
> > [22038.710837] Code: 6e ff 80 3d d2 9d f8 00 00 0f 85 5c ff ff ff 48 8b 73 
> > 28 48 c7 c7 0c b8 21 84 89 44 24 04 c6 05 b6 9d f8 00 01 e8 84 21 1c 00 
> > <0f> 0b 8b 54 24 04 e9 36 ff ff ff 66 66 2e 0f 1f 84 00 00 00 00 00
> > [22038.710838] RSP: 0018:b24106e37ba0 EFLAGS: 00010086
> > [22038.710838] RAX:  RBX: 9599d2929c50 RCX: 
> > 959f8ed1ac30
> > [22038.710839] RDX:  RSI: 0023 RDI: 
> > 959f8ed1ac28
> > [22038.710839] RBP: 9598981d4058 R08: 0019 R09: 
> > b24206e3796d
> > [22038.710839] R10:  R11: b24106e37968 R12: 
> > 959887e51ec8
> > [22038.710840] R13: 000c R14:  R15: 
> > 9599d2929c60
> > [22038.710840] FS:  7f3ade370a40() GS:959f8ed0() 
> > knlGS:
> > [22038.710841] CS:  0010 DS:  ES:  CR0: 80050033
> > [22038.710841] CR2:  CR3: 0003017b CR4: 
> > 00350ee0
> > [22038.710841] Call Trace:
> > [22038.710842]  netpoll_send_skb+0x185/0x240
> > [22038.710842]  write_msg+0xe5/0x100 [netconsole]
> > [22038.710842]  console_unlock+0x37d/0x640
> > [22038.710842]  ? __schedule+0x2e5/0xc90
> > [22038.710843]  suspend_devices_and_enter+0x2ac/0x7f0
> > [22038.710843]  pm_suspend.cold+0x321/0x36c
> > [22038.710843]  state_store+0xa6/0x140
> > [22038.710844]  kernfs_fop_write_iter+0x124/0x1b0
> > [22038.710844]  new_sync_write+0x16a/0x200
> > [22038.710844]  vfs_write+0x21c/0x2e0
> > [22038.710844]  __x64_sys_write+0x6d/0xf0
> > [22038.710845]  do_syscall_64+0x33/0x40
> > [22038.710845]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
> > [22038.710845] RIP: 0033:0x7f3adece10f7
> > [22038.710846] Code: 0d 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 
> > 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 b8 01 00 00 00 0f 05 
> > <48> 3d 00 f0 ff ff 77 51 c3 48 83 ec 28 48 89 54 24 18 48 89 74 24
> > [22038.710847] RSP: 002b:7ffc51c555b8 EFLAGS: 0246 ORIG_RAX: 
> > 0001
> > [22038.710847] RAX: ffda RBX: 0004 RCX: 
> > 7f3adece10f7
> > [22038.710848] RDX: 0004 RSI: 7ffc51c556a0 RDI: 
> > 0004
> > [22038.710848] RBP: 7ffc51c556a0 R08: 55ea374302a0 R09: 
> > 7f3aded770c0
> > [22038.710849] R10: 7f3aded76fc0 R11: 0246 R12: 
> > 0004
> > [22038.710849] R13: 55ea3742c430 R14: 0004 R15: 
> > 7f3adedb3700
> > [22038.710849] ---[ end trace 6eae54fbf23807f8 ]---
> > ```
> > 
> > This one happened during suspend/resume cycle (on resume), followed by:
> > 
> > ```
> > [22038.868669] igb :05:00.0 enp5s0: Reset adapter
> > [22040.998673] igb :05:00.0 enp5s0: Reset adapter
> > [22043.819198] igb :05:00.0 enp5s0: igb: enp5s0 NIC Link is Up 1000 
> > Mbps Full Duplex, Flow Control: RX
> > ```
> > 
> > I've bumped into a similar issue in BZ 211911 [2] (see c#16),
> > and in c#17 it was suggested it was a separate unrelated issue,
> > hence I'm raising a new concern.
> > 
> > Please help in finding out why this woe happens and in fixing it.
> > 
> > Thanks.
> > 
> > [1] https://bugzilla.kernel.org/show_bug.cgi?id=212573
> > [2] https://bugzilla.kernel.org/show_bug.cgi?id=211911
> 
> Looks like igb_clean_tx_irq() should not return true if budget is 0,
> ever, otherwise we risk hitting the min(work, budget - 1) which may
> go negative.
> 
> So something like this? 
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
> b/drivers/net/ethernet/intel/igb/igb_main.c
> index c9e8c65a3cfe..7a237b5311ca 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -8028,7 +8028,7 @@ static bool igb_clean_tx_irq(struct igb_q_vector 
> *q_vector, int napi_budget)
> unsigned int i = tx_ring->next_to_clean;
>  
> if (test_bit(__IGB_DOWN, &adapter->state))
> -   return true;
> +   goto out;
>  
> tx_buffer = &tx_ring->tx_buffer_info[i];
> tx_desc = IGB_TX_DESC(tx_ring, i);
> @@ -8157,7 +8157,7 @@ static bool igb_clean_tx_ir

Re: [PATCH] staging: sm750fb: Convert camel case to snake case

2021-04-06 Thread Pavle Rohalj
On Tue, Apr 06, 2021 at 11:36:41AM +0200, Greg KH wrote:
> On Tue, Apr 06, 2021 at 02:18:41AM -0700, Pavle Rohalj wrote:
> > -   struct dvi_ctrl_device *pCurrentDviCtrl;
> > +   struct dvi_ctrl_device *p_current_dvi_ctrl;
> 
> Does this change make sense?  Why keep the "p_" here?  We do not need or
> use, this type of variable naming in the kernel.
> 
> Also, please break this up into a patch series where you do one
> structure change at a time.
> 
> thanks,
> 
> greg k-h

Thank you for the input. Makes sense why we would not want to include
type information in variable names. I will send a patchset with changes
broken up into smaller chunks soon.

-Pavle


Re: [PATCH v2] media: venus : hfi: add venus image info into smem

2021-04-06 Thread dikshita

Hi Bjorn,

Thanks for your review comments.
I have addressed all in the latest patch v3.
couldn't think of a shorter name for variables without losing the
readability so kept as it is.

Thanks,
Dikshita

On 2021-03-30 09:29, Bjorn Andersson wrote:

On Fri 26 Mar 01:33 CDT 2021, Dikshita Agarwal wrote:


Fill fw version info into smem to be printed as part of
soc info.

Signed-off-by: Dikshita Agarwal 

Changes since v1:
 adressed comments from stephen.
 removed unwanted code.
---
 drivers/media/platform/qcom/venus/hfi_msgs.c | 21 
+++--

 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/hfi_msgs.c 
b/drivers/media/platform/qcom/venus/hfi_msgs.c

index 06a1908..6b6d33c9 100644
--- a/drivers/media/platform/qcom/venus/hfi_msgs.c
+++ b/drivers/media/platform/qcom/venus/hfi_msgs.c
@@ -6,6 +6,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include "core.h"
@@ -14,6 +15,10 @@
 #include "hfi_msgs.h"
 #include "hfi_parser.h"

+#define SMEM_IMG_VER_TBL 469
+#define VER_STR_SZ 128
+#define SMEM_IMG_INDEX_VENUS 14 * 128


14 is the index, 128 is the element size, so this is now an "offset".


+
 static void event_seq_changed(struct venus_core *core, struct 
venus_inst *inst,

  struct hfi_msg_event_notify_pkt *pkt)
 {
@@ -239,15 +244,27 @@ static void
 sys_get_prop_image_version(struct device *dev,
   struct hfi_msg_sys_property_info_pkt *pkt)
 {
+   size_t smem_blk_sz = 0;


You shouldn't need to initialize smem_blk_sz if you check the return
value of qcom_smem_get() first.


+   u8 *smem_tbl_ptr;
+   u8 *img_ver;
int req_bytes;

req_bytes = pkt->hdr.size - sizeof(*pkt);

-   if (req_bytes < 128 || !pkt->data[1] || pkt->num_properties > 1)
+	if (req_bytes < VER_STR_SZ || !pkt->data[1] || pkt->num_properties > 
1)

/* bad packet */
return;

-   dev_dbg(dev, VDBGL "F/W version: %s\n", (u8 *)&pkt->data[1]);
+   img_ver = (u8 *)&pkt->data[1];
+
+   dev_dbg(dev, VDBGL "F/W version: %s\n", img_ver);
+
+   smem_tbl_ptr = qcom_smem_get(QCOM_SMEM_HOST_ANY,
+  SMEM_IMG_VER_TBL, &smem_blk_sz);


80 chars is just a guideline and this looks prettier if you avoid the
line wrap. That said, if you pick shorter names for smem_tbl_ptr and
smem_blk_sz you probably even have to worry.


+   if ((SMEM_IMG_INDEX_VENUS + VER_STR_SZ) <= smem_blk_sz &&
+   smem_tbl_ptr)


In English you're trying to determine: "did qcom_smem_get() return a
valid pointer and is the item's size at least as big as we need".

So just write that in C:

if (smem_tbl_ptr && smem_blk_sz >= SMEM_IMG_INDEX_VENUS + VER_STR_SZ)


+   memcpy(smem_tbl_ptr + SMEM_IMG_INDEX_VENUS,
+  img_ver, VER_STR_SZ);


Again, please avoid the line wrap...

Regards,
Bjorn


 }

 static void hfi_sys_property_info(struct venus_core *core,
--
2.7.4



  1   2   3   4   5   6   7   8   9   10   >