[PATCH] edac: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Borislav Petkov 
Cc: Mauro Carvalho Chehab 
Cc: linux-e...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/edac/debugfs.c | 45 ++
 drivers/edac/edac_module.h |  4 ++--
 2 files changed, 13 insertions(+), 36 deletions(-)

diff --git a/drivers/edac/debugfs.c b/drivers/edac/debugfs.c
index 92dbb7e2320c..fd27ea0453a3 100644
--- a/drivers/edac/debugfs.c
+++ b/drivers/edac/debugfs.c
@@ -44,10 +44,6 @@ static const struct file_operations debug_fake_inject_fops = 
{
 int __init edac_debugfs_init(void)
 {
edac_debugfs = debugfs_create_dir("edac", NULL);
-   if (IS_ERR(edac_debugfs)) {
-   edac_debugfs = NULL;
-   return -ENOMEM;
-   }
return 0;
 }
 
@@ -56,50 +52,31 @@ void edac_debugfs_exit(void)
debugfs_remove_recursive(edac_debugfs);
 }
 
-int edac_create_debugfs_nodes(struct mem_ctl_info *mci)
+void edac_create_debugfs_nodes(struct mem_ctl_info *mci)
 {
-   struct dentry *d, *parent;
+   struct dentry *parent;
char name[80];
int i;
 
-   if (!edac_debugfs)
-   return -ENODEV;
-
-   d = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs);
-   if (!d)
-   return -ENOMEM;
-   parent = d;
+   parent = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs);
 
for (i = 0; i < mci->n_layers; i++) {
sprintf(name, "fake_inject_%s",
 edac_layer_name[mci->layers[i].type]);
-   d = debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent,
- >fake_inject_layer[i]);
-   if (!d)
-   goto nomem;
+   debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent,
+ >fake_inject_layer[i]);
}
 
-   d = debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent,
-   >fake_inject_ue);
-   if (!d)
-   goto nomem;
+   debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent,
+   >fake_inject_ue);
 
-   d = debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent,
-   >fake_inject_count);
-   if (!d)
-   goto nomem;
+   debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent,
+  >fake_inject_count);
 
-   d = debugfs_create_file("fake_inject", S_IWUSR, parent,
-   >dev,
-   _fake_inject_fops);
-   if (!d)
-   goto nomem;
+   debugfs_create_file("fake_inject", S_IWUSR, parent, >dev,
+   _fake_inject_fops);
 
mci->debugfs = parent;
-   return 0;
-nomem:
-   edac_debugfs_remove_recursive(mci->debugfs);
-   return -ENOMEM;
 }
 
 /* Create a toplevel dir under EDAC's debugfs hierarchy */
diff --git a/drivers/edac/edac_module.h b/drivers/edac/edac_module.h
index dec88dcea036..bc63a6a9dd0a 100644
--- a/drivers/edac/edac_module.h
+++ b/drivers/edac/edac_module.h
@@ -71,7 +71,7 @@ extern void *edac_align_ptr(void **p, unsigned size, int 
n_elems);
 #ifdef CONFIG_EDAC_DEBUG
 int edac_debugfs_init(void);
 void edac_debugfs_exit(void);
-int edac_create_debugfs_nodes(struct mem_ctl_info *mci);
+void edac_create_debugfs_nodes(struct mem_ctl_info *mci);
 struct dentry *edac_debugfs_create_dir(const char *dirname);
 struct dentry *
 edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent);
@@ -85,7 +85,7 @@ edac_debugfs_create_x16(const char *name, umode_t mode, 
struct dentry *parent, u
 #else
 static inline int edac_debugfs_init(void)  
{ return -ENODEV; }
 static inline void edac_debugfs_exit(void) 
{ }
-static inline int edac_create_debugfs_nodes(struct mem_ctl_info *mci)  
{ return 0; }
+static inline void edac_create_debugfs_nodes(struct mem_ctl_info *mci) 
{ }
 static inline struct dentry *edac_debugfs_create_dir(const char *dirname)  
{ return NULL; }
 static inline struct dentry *
 edac_debugfs_create_dir_at(const char *dirname, struct dentry *parent) 
{ return NULL; }
-- 
2.20.1



[PATCH] fbdev: omap2: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Bartlomiej Zolnierkiewicz 
Cc: Mauro Carvalho Chehab 
Cc: linux-o...@vger.kernel.org
Cc: linux-fb...@vger.kernel.org
Cc: dri-de...@lists.freedesktop.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/video/fbdev/omap2/omapfb/dss/core.c | 31 -
 drivers/video/fbdev/omap2/omapfb/dss/dss.h  |  2 +-
 2 files changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/core.c 
b/drivers/video/fbdev/omap2/omapfb/dss/core.c
index b4bcf3a4a647..7e6a3eb266d0 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/core.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/core.c
@@ -110,19 +110,12 @@ DEFINE_SHOW_ATTRIBUTE(dss);
 
 static struct dentry *dss_debugfs_dir;
 
-static int dss_initialize_debugfs(void)
+static void dss_initialize_debugfs(void)
 {
dss_debugfs_dir = debugfs_create_dir("omapdss", NULL);
-   if (IS_ERR(dss_debugfs_dir)) {
-   int err = PTR_ERR(dss_debugfs_dir);
-   dss_debugfs_dir = NULL;
-   return err;
-   }
 
debugfs_create_file("clk", S_IRUGO, dss_debugfs_dir,
_debug_dump_clocks, _fops);
-
-   return 0;
 }
 
 static void dss_uninitialize_debugfs(void)
@@ -130,24 +123,18 @@ static void dss_uninitialize_debugfs(void)
debugfs_remove_recursive(dss_debugfs_dir);
 }
 
-int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+void dss_debugfs_create_file(const char *name, void (*write)(struct seq_file 
*))
 {
-   struct dentry *d;
-
-   d = debugfs_create_file(name, S_IRUGO, dss_debugfs_dir,
-   write, _fops);
-
-   return PTR_ERR_OR_ZERO(d);
+   debugfs_create_file(name, S_IRUGO, dss_debugfs_dir, write, _fops);
 }
 #else /* CONFIG_FB_OMAP2_DSS_DEBUGFS */
-static inline int dss_initialize_debugfs(void)
+static inline void dss_initialize_debugfs(void)
 {
-   return 0;
 }
 static inline void dss_uninitialize_debugfs(void)
 {
 }
-int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file *))
+void dss_debugfs_create_file(const char *name, void (*write)(struct seq_file 
*))
 {
return 0;
 }
@@ -188,9 +175,7 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
 
dss_features_init(omapdss_get_version());
 
-   r = dss_initialize_debugfs();
-   if (r)
-   goto err_debugfs;
+   dss_initialize_debugfs();
 
if (def_disp_name)
core.default_display_name = def_disp_name;
@@ -198,10 +183,6 @@ static int __init omap_dss_probe(struct platform_device 
*pdev)
register_pm_notifier(_dss_pm_notif_block);
 
return 0;
-
-err_debugfs:
-
-   return r;
 }
 
 static int omap_dss_remove(struct platform_device *pdev)
diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss.h 
b/drivers/video/fbdev/omap2/omapfb/dss/dss.h
index a3cc0ca8f9d2..b1a354494144 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss.h
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss.h
@@ -214,7 +214,7 @@ struct platform_device *dss_get_core_pdev(void);
 int dss_dsi_enable_pads(int dsi_id, unsigned lane_mask);
 void dss_dsi_disable_pads(int dsi_id, unsigned lane_mask);
 int dss_set_min_bus_tput(struct device *dev, unsigned long tput);
-int dss_debugfs_create_file(const char *name, void (*write)(struct seq_file 
*));
+void dss_debugfs_create_file(const char *name, void (*write)(struct seq_file 
*));
 
 /* display */
 int dss_suspend_all_devices(void);
-- 
2.20.1



[PATCH] fbdev: mbx: fix up debugfs file creation

2019-01-22 Thread Greg Kroah-Hartman
There is no need to keep the dentries around for the individual debugfs
files, just delete the whole directory all at once at shutdown instead.

This also fixes a tiny memory leak where the memory for the pointers to
the file dentries was never freed when the device shut down, as well as
making the logic of the code a lot simpler.

Cc: Bartlomiej Zolnierkiewicz 
Cc: dri-de...@lists.freedesktop.org
Cc: linux-fb...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/video/fbdev/mbx/mbxdebugfs.c | 40 +---
 drivers/video/fbdev/mbx/mbxfb.c  |  2 +-
 2 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/drivers/video/fbdev/mbx/mbxdebugfs.c 
b/drivers/video/fbdev/mbx/mbxdebugfs.c
index 2bd328883178..52cfe0132b25 100644
--- a/drivers/video/fbdev/mbx/mbxdebugfs.c
+++ b/drivers/video/fbdev/mbx/mbxdebugfs.c
@@ -211,36 +211,22 @@ static const struct file_operations misc_fops = {
 static void mbxfb_debugfs_init(struct fb_info *fbi)
 {
struct mbxfb_info *mfbi = fbi->par;
-   struct mbxfb_debugfs_data *dbg;
-
-   dbg = kzalloc(sizeof(struct mbxfb_debugfs_data), GFP_KERNEL);
-   mfbi->debugfs_data = dbg;
-
-   dbg->dir = debugfs_create_dir("mbxfb", NULL);
-   dbg->sysconf = debugfs_create_file("sysconf", 0444, dbg->dir,
- fbi, _fops);
-   dbg->clock = debugfs_create_file("clock", 0444, dbg->dir,
-   fbi, _fops);
-   dbg->display = debugfs_create_file("display", 0444, dbg->dir,
- fbi, _fops);
-   dbg->gsctl = debugfs_create_file("gsctl", 0444, dbg->dir,
-   fbi, _fops);
-   dbg->sdram = debugfs_create_file("sdram", 0444, dbg->dir,
-   fbi, _fops);
-   dbg->misc = debugfs_create_file("misc", 0444, dbg->dir,
-   fbi, _fops);
+   struct dentry *dir;
+
+   dir = debugfs_create_dir("mbxfb", NULL);
+   mbfi->debugfs_dir = dir;
+
+   debugfs_create_file("sysconf", 0444, dir, fbi, _fops);
+   debugfs_create_file("clock", 0444, dir, fbi, _fops);
+   debugfs_create_file("display", 0444, dir, fbi, _fops);
+   debugfs_create_file("gsctl", 0444, dir, fbi, _fops);
+   debugfs_create_file("sdram", 0444, dir, fbi, _fops);
+   debugfs_create_file("misc", 0444, dir, fbi, _fops);
 }
 
 static void mbxfb_debugfs_remove(struct fb_info *fbi)
 {
struct mbxfb_info *mfbi = fbi->par;
-   struct mbxfb_debugfs_data *dbg = mfbi->debugfs_data;
-
-   debugfs_remove(dbg->misc);
-   debugfs_remove(dbg->sdram);
-   debugfs_remove(dbg->gsctl);
-   debugfs_remove(dbg->display);
-   debugfs_remove(dbg->clock);
-   debugfs_remove(dbg->sysconf);
-   debugfs_remove(dbg->dir);
+
+   debugfs_remove_recursive(mfbi->debugfs_dir);
 }
diff --git a/drivers/video/fbdev/mbx/mbxfb.c b/drivers/video/fbdev/mbx/mbxfb.c
index 539b85da0897..6ded480a69b4 100644
--- a/drivers/video/fbdev/mbx/mbxfb.c
+++ b/drivers/video/fbdev/mbx/mbxfb.c
@@ -74,7 +74,7 @@ struct mbxfb_info {
 
u32 pseudo_palette[MAX_PALETTES];
 #ifdef CONFIG_FB_MBX_DEBUG
-   void *debugfs_data;
+   struct dentry *debugfs_dir;
 #endif
 
 };
-- 
2.20.1



[PATCH] mm: kmemleak: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Catalin Marinas 
Cc: linux...@kvack.org
Signed-off-by: Greg Kroah-Hartman 
---
 mm/kmemleak.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index f9d9dc250428..d45bc65db5fb 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -2124,14 +2124,9 @@ void __init kmemleak_init(void)
  */
 static int __init kmemleak_late_init(void)
 {
-   struct dentry *dentry;
-
kmemleak_initialized = 1;
 
-   dentry = debugfs_create_file("kmemleak", 0644, NULL, NULL,
-_fops);
-   if (!dentry)
-   pr_warn("Failed to create the debugfs kmemleak file\n");
+   debugfs_create_file("kmemleak", 0644, NULL, NULL, _fops);
 
if (kmemleak_error) {
/*
-- 
2.20.1



[PATCH] mm: cleancache: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Konrad Rzeszutek Wilk 
Cc: linux...@kvack.org
Signed-off-by: Greg Kroah-Hartman 
---
 mm/cleancache.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/cleancache.c b/mm/cleancache.c
index 2bf12da9baa0..082fdda7aaa6 100644
--- a/mm/cleancache.c
+++ b/mm/cleancache.c
@@ -305,8 +305,7 @@ static int __init init_cleancache(void)
 {
 #ifdef CONFIG_DEBUG_FS
struct dentry *root = debugfs_create_dir("cleancache", NULL);
-   if (root == NULL)
-   return -ENXIO;
+
debugfs_create_u64("succ_gets", 0444, root, _succ_gets);
debugfs_create_u64("failed_gets", 0444, root, _failed_gets);
debugfs_create_u64("puts", 0444, root, _puts);
-- 
2.20.1



Re: [PATCH v9 12/26] arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking

2019-01-22 Thread Catalin Marinas
On Mon, Jan 21, 2019 at 03:33:31PM +, Julien Thierry wrote:
> diff --git a/arch/arm64/include/asm/irqflags.h 
> b/arch/arm64/include/asm/irqflags.h
> index 24692ed..7e82a92 100644
> --- a/arch/arm64/include/asm/irqflags.h
> +++ b/arch/arm64/include/asm/irqflags.h
> @@ -18,7 +18,9 @@
>  
>  #ifdef __KERNEL__
>  
> +#include 
>  #include 
> +#include 
>  
>  /*
>   * Aarch64 has flags for masking: Debug, Asynchronous (serror), Interrupts 
> and
> @@ -36,33 +38,31 @@
>  /*
>   * CPU interrupt mask handling.
>   */
> -static inline unsigned long arch_local_irq_save(void)
> -{
> - unsigned long flags;
> - asm volatile(
> - "mrs%0, daif// arch_local_irq_save\n"
> - "msrdaifset, #2"
> - : "=r" (flags)
> - :
> - : "memory");
> - return flags;
> -}
> -
>  static inline void arch_local_irq_enable(void)
>  {
> - asm volatile(
> - "msrdaifclr, #2 // arch_local_irq_enable"
> - :
> + unsigned long unmasked = GIC_PRIO_IRQON;
> +
> + asm volatile(ALTERNATIVE(
> + "msrdaifclr, #2 // arch_local_irq_enable\n"
> + "nop",
> + "msr_s  " __stringify(SYS_ICC_PMR_EL1) ",%0\n"
> + "dsbsy",
> + ARM64_HAS_IRQ_PRIO_MASKING)
>   :
> + : "r" (unmasked)
>   : "memory");
>  }
>  
>  static inline void arch_local_irq_disable(void)
>  {
> - asm volatile(
> - "msrdaifset, #2 // arch_local_irq_disable"
> - :
> + unsigned long masked = GIC_PRIO_IRQOFF;
> +
> + asm volatile(ALTERNATIVE(
> + "msrdaifset, #2 // arch_local_irq_disable",
> + "msr_s  " __stringify(SYS_ICC_PMR_EL1) ", %0",
> + ARM64_HAS_IRQ_PRIO_MASKING)
>   :
> + : "r" (masked)
>   : "memory");
>  }

Nitpicks: you could drop masked/unmasked variables here (it's up to you,
it wouldn't make any difference on the generated asm).

> @@ -71,12 +71,44 @@ static inline void arch_local_irq_disable(void)
>   */
>  static inline unsigned long arch_local_save_flags(void)
>  {
> + unsigned long daif_bits;
>   unsigned long flags;
> - asm volatile(
> - "mrs%0, daif// arch_local_save_flags"
> - : "=r" (flags)
> - :
> +
> + daif_bits = read_sysreg(daif);
> +
> + /*
> +  * The asm is logically equivalent to:
> +  *
> +  * if (system_uses_irq_prio_masking())
> +  *  flags = (daif_bits & PSR_I_BIT) ?
> +  *  GIC_PRIO_IRQOFF :
> +  *  read_sysreg_s(SYS_ICC_PMR_EL1);
> +  * else
> +  *  flags = daif_bits;
> +  */
> + asm volatile(ALTERNATIVE(
> + "mov%0, %1\n"
> + "nop\n"
> + "nop",
> + "mrs_s  %0, " __stringify(SYS_ICC_PMR_EL1) "\n"
> + "ands   %1, %1, " __stringify(PSR_I_BIT) "\n"
> + "csel   %0, %0, %2, eq",
> + ARM64_HAS_IRQ_PRIO_MASKING)
> + : "=" (flags), "+r" (daif_bits)
> + : "r" (GIC_PRIO_IRQOFF)
>   : "memory");
> +
> + return flags;
> +}

BTW, how's the code generated from the C version? It will have a branch
but may not be too bad. Either way is fine by me.

Reviewed-by: Catalin Marinas 


[PATCH] s390: pci: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: Sebastian Ott 
Cc: Gerald Schaefer 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/s390/include/asm/pci.h |  1 -
 arch/s390/pci/pci_debug.c   | 15 ---
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h
index 10fe982f2b4b..4e0efebc56a9 100644
--- a/arch/s390/include/asm/pci.h
+++ b/arch/s390/include/asm/pci.h
@@ -148,7 +148,6 @@ struct zpci_dev {
enum pci_bus_speed max_bus_speed;
 
struct dentry   *debugfs_dev;
-   struct dentry   *debugfs_perf;
 
struct s390_domain *s390_domain; /* s390 IOMMU domain data */
 };
diff --git a/arch/s390/pci/pci_debug.c b/arch/s390/pci/pci_debug.c
index 04388a254ffb..6b48ca7760a7 100644
--- a/arch/s390/pci/pci_debug.c
+++ b/arch/s390/pci/pci_debug.c
@@ -172,21 +172,14 @@ static const struct file_operations debugfs_pci_perf_fops 
= {
 void zpci_debug_init_device(struct zpci_dev *zdev, const char *name)
 {
zdev->debugfs_dev = debugfs_create_dir(name, debugfs_root);
-   if (IS_ERR(zdev->debugfs_dev))
-   zdev->debugfs_dev = NULL;
-
-   zdev->debugfs_perf = debugfs_create_file("statistics",
-   S_IFREG | S_IRUGO | S_IWUSR,
-   zdev->debugfs_dev, zdev,
-   _pci_perf_fops);
-   if (IS_ERR(zdev->debugfs_perf))
-   zdev->debugfs_perf = NULL;
+
+   debugfs_create_file("statistics", S_IFREG | S_IRUGO | S_IWUSR,
+   zdev->debugfs_dev, zdev, _pci_perf_fops);
 }
 
 void zpci_debug_exit_device(struct zpci_dev *zdev)
 {
-   debugfs_remove(zdev->debugfs_perf);
-   debugfs_remove(zdev->debugfs_dev);
+   debugfs_remove_recursive(zdev->debugfs_dev);
 }
 
 int __init zpci_debug_init(void)
-- 
2.20.1



[PATCH] hwpoison-inject: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Naoya Horiguchi 
Cc: linux...@kvack.org
Signed-off-by: Greg Kroah-Hartman 
---
 mm/hwpoison-inject.c | 67 +++-
 1 file changed, 22 insertions(+), 45 deletions(-)

diff --git a/mm/hwpoison-inject.c b/mm/hwpoison-inject.c
index b6ac70616c32..36662d0097d5 100644
--- a/mm/hwpoison-inject.c
+++ b/mm/hwpoison-inject.c
@@ -76,63 +76,40 @@ static void pfn_inject_exit(void)
 
 static int pfn_inject_init(void)
 {
-   struct dentry *dentry;
-
hwpoison_dir = debugfs_create_dir("hwpoison", NULL);
-   if (hwpoison_dir == NULL)
-   return -ENOMEM;
 
/*
 * Note that the below poison/unpoison interfaces do not involve
 * hardware status change, hence do not require hardware support.
 * They are mainly for testing hwpoison in software level.
 */
-   dentry = debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir,
- NULL, _fops);
-   if (!dentry)
-   goto fail;
-
-   dentry = debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir,
-NULL, _fops);
-   if (!dentry)
-   goto fail;
-
-   dentry = debugfs_create_u32("corrupt-filter-enable", 0600,
-   hwpoison_dir, _filter_enable);
-   if (!dentry)
-   goto fail;
-
-   dentry = debugfs_create_u32("corrupt-filter-dev-major", 0600,
-   hwpoison_dir, _filter_dev_major);
-   if (!dentry)
-   goto fail;
-
-   dentry = debugfs_create_u32("corrupt-filter-dev-minor", 0600,
-   hwpoison_dir, _filter_dev_minor);
-   if (!dentry)
-   goto fail;
-
-   dentry = debugfs_create_u64("corrupt-filter-flags-mask", 0600,
-   hwpoison_dir, _filter_flags_mask);
-   if (!dentry)
-   goto fail;
-
-   dentry = debugfs_create_u64("corrupt-filter-flags-value", 0600,
-   hwpoison_dir, _filter_flags_value);
-   if (!dentry)
-   goto fail;
+   debugfs_create_file("corrupt-pfn", 0200, hwpoison_dir, NULL,
+   _fops);
+
+   debugfs_create_file("unpoison-pfn", 0200, hwpoison_dir, NULL,
+   _fops);
+
+   debugfs_create_u32("corrupt-filter-enable", 0600, hwpoison_dir,
+  _filter_enable);
+
+   debugfs_create_u32("corrupt-filter-dev-major", 0600, hwpoison_dir,
+  _filter_dev_major);
+
+   debugfs_create_u32("corrupt-filter-dev-minor", 0600, hwpoison_dir,
+  _filter_dev_minor);
+
+   debugfs_create_u64("corrupt-filter-flags-mask", 0600, hwpoison_dir,
+  _filter_flags_mask);
+
+   debugfs_create_u64("corrupt-filter-flags-value", 0600, hwpoison_dir,
+  _filter_flags_value);
 
 #ifdef CONFIG_MEMCG
-   dentry = debugfs_create_u64("corrupt-filter-memcg", 0600,
-   hwpoison_dir, _filter_memcg);
-   if (!dentry)
-   goto fail;
+   debugfs_create_u64("corrupt-filter-memcg", 0600, hwpoison_dir,
+  _filter_memcg);
 #endif
 
return 0;
-fail:
-   pfn_inject_exit();
-   return -ENOMEM;
 }
 
 module_init(pfn_inject_init);
-- 
2.20.1



[PATCH] s390: hypfs: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/s390/hypfs/hypfs.h|  6 +++---
 arch/s390/hypfs/hypfs_dbfs.c   |  8 ++--
 arch/s390/hypfs/hypfs_diag.c   |  9 -
 arch/s390/hypfs/hypfs_diag0c.c |  3 ++-
 arch/s390/hypfs/hypfs_sprp.c   |  6 +++---
 arch/s390/hypfs/hypfs_vm.c |  3 ++-
 arch/s390/hypfs/inode.c| 11 +++
 7 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/arch/s390/hypfs/hypfs.h b/arch/s390/hypfs/hypfs.h
index 52348e0a812e..05f3f9aee5fc 100644
--- a/arch/s390/hypfs/hypfs.h
+++ b/arch/s390/hypfs/hypfs.h
@@ -43,7 +43,7 @@ int hypfs_diag0c_init(void);
 void hypfs_diag0c_exit(void);
 
 /* Set Partition-Resource Parameter */
-int hypfs_sprp_init(void);
+void hypfs_sprp_init(void);
 void hypfs_sprp_exit(void);
 
 /* debugfs interface */
@@ -69,9 +69,9 @@ struct hypfs_dbfs_file {
struct dentry   *dentry;
 };
 
-extern int hypfs_dbfs_init(void);
+extern void hypfs_dbfs_init(void);
 extern void hypfs_dbfs_exit(void);
-extern int hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
+extern void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df);
 extern void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df);
 
 #endif /* _HYPFS_H_ */
diff --git a/arch/s390/hypfs/hypfs_dbfs.c b/arch/s390/hypfs/hypfs_dbfs.c
index b9bdf5c1918e..f4c7dbfaf8ee 100644
--- a/arch/s390/hypfs/hypfs_dbfs.c
+++ b/arch/s390/hypfs/hypfs_dbfs.c
@@ -78,14 +78,11 @@ static const struct file_operations dbfs_ops = {
.unlocked_ioctl = dbfs_ioctl,
 };
 
-int hypfs_dbfs_create_file(struct hypfs_dbfs_file *df)
+void hypfs_dbfs_create_file(struct hypfs_dbfs_file *df)
 {
df->dentry = debugfs_create_file(df->name, 0400, dbfs_dir, df,
 _ops);
-   if (IS_ERR(df->dentry))
-   return PTR_ERR(df->dentry);
mutex_init(>lock);
-   return 0;
 }
 
 void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
@@ -93,10 +90,9 @@ void hypfs_dbfs_remove_file(struct hypfs_dbfs_file *df)
debugfs_remove(df->dentry);
 }
 
-int hypfs_dbfs_init(void)
+void hypfs_dbfs_init(void)
 {
dbfs_dir = debugfs_create_dir("s390_hypfs", NULL);
-   return PTR_ERR_OR_ZERO(dbfs_dir);
 }
 
 void hypfs_dbfs_exit(void)
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 3452e18bb1ca..f0bc4dc3e9bf 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -440,11 +440,10 @@ __init int hypfs_diag_init(void)
pr_err("The hardware system does not support hypfs\n");
return -ENODATA;
}
-   if (diag204_info_type == DIAG204_INFO_EXT) {
-   rc = hypfs_dbfs_create_file(_file_d204);
-   if (rc)
-   return rc;
-   }
+
+   if (diag204_info_type == DIAG204_INFO_EXT)
+   hypfs_dbfs_create_file(_file_d204);
+
if (MACHINE_IS_LPAR) {
rc = diag224_get_name_table();
if (rc) {
diff --git a/arch/s390/hypfs/hypfs_diag0c.c b/arch/s390/hypfs/hypfs_diag0c.c
index cebf05150cc1..46bf190234b9 100644
--- a/arch/s390/hypfs/hypfs_diag0c.c
+++ b/arch/s390/hypfs/hypfs_diag0c.c
@@ -125,7 +125,8 @@ int __init hypfs_diag0c_init(void)
 {
if (!MACHINE_IS_VM)
return 0;
-   return hypfs_dbfs_create_file(_file_0c);
+   hypfs_dbfs_create_file(_file_0c);
+   return 0;
 }
 
 /*
diff --git a/arch/s390/hypfs/hypfs_sprp.c b/arch/s390/hypfs/hypfs_sprp.c
index 601b70786dc8..7d9fb496d155 100644
--- a/arch/s390/hypfs/hypfs_sprp.c
+++ b/arch/s390/hypfs/hypfs_sprp.c
@@ -137,11 +137,11 @@ static struct hypfs_dbfs_file hypfs_sprp_file = {
.unlocked_ioctl = hypfs_sprp_ioctl,
 };
 
-int hypfs_sprp_init(void)
+void hypfs_sprp_init(void)
 {
if (!sclp.has_sprp)
-   return 0;
-   return hypfs_dbfs_create_file(_sprp_file);
+   return;
+   hypfs_dbfs_create_file(_sprp_file);
 }
 
 void hypfs_sprp_exit(void)
diff --git a/arch/s390/hypfs/hypfs_vm.c b/arch/s390/hypfs/hypfs_vm.c
index c4b7b681e055..42f2375c203e 100644
--- a/arch/s390/hypfs/hypfs_vm.c
+++ b/arch/s390/hypfs/hypfs_vm.c
@@ -279,7 +279,8 @@ int hypfs_vm_init(void)
guest_query = local_guest;
else
return -EACCES;
-   return hypfs_dbfs_create_file(_file_2fc);
+   hypfs_dbfs_create_file(_file_2fc);
+   return 0;
 }
 
 void hypfs_vm_exit(void)
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index c681329fdeec..ccad1398abd4 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -456,9 +456,8 @@ static int __init hypfs_init(void)
 {
int rc;
 
-   rc = hypfs_dbfs_init();
-   if (rc)
-   return rc;
+ 

Re: [PATCH v11 perf, bpf-next 7/9] perf tools: synthesize PERF_RECORD_* for loaded BPF programs

2019-01-22 Thread Jiri Olsa
On Tue, Jan 22, 2019 at 12:58:05PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jan 22, 2019 at 03:51:19PM +0100, Jiri Olsa escreveu:
> > On Tue, Jan 22, 2019 at 12:31:17PM -0200, Arnaldo Carvalho de Melo wrote:
> > > Em Tue, Jan 22, 2019 at 12:13:20PM -0200, Arnaldo Carvalho de Melo 
> > > escreveu:
> > > > Em Fri, Jan 18, 2019 at 11:46:55AM -0300, Arnaldo Carvalho de Melo 
> > > > escreveu:
> > > > > Em Thu, Jan 17, 2019 at 08:15:19AM -0800, Song Liu escreveu:
> > > > > > This patch synthesize PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT 
> > > > > > for
> > > > > > BPF programs loaded before perf-record. This is achieved by 
> > > > > > gathering
> > > > > > information about all BPF programs via sys_bpf.
> > > > > 
> > > > > Ditto
> > > > 
> > > > This is breaking 'perf sched', see below, the fix seems trivial:
> > > > 
> > > > [root@quaco ~]# perf sched record -a sleep 2
> > > > [ perf record: Woken up 1 times to write data ]
> > > > 0x5b60 [0x138]: failed to process type: 17
> > > > [ perf record: Captured and wrote 1.539 MB perf.data ]
> > > > [root@quaco ~]# perf sched lat
> > > > 0x5b60 [0x138]: failed to process type: 17
> > > > Failed to process events, error -22
> > > > [root@quaco ~]#
> > > 
> > > So:
> > > 
> > >perf_session__process_event (event->header.type = 17 
> > > (PERF_RECORD_KSYMBOL)
> > >  if (tool->ordered_events)
> > >ret = perf_evlist__parse_sample_timestamp(evlist, event, 
> > > );
> > >if (ret && ret != -1)
> > > return ret;
> > > 
> > > So it returns here with -EFAULT, i.e. this is failing:
> > > 
> > > int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
> > > union perf_event *event,
> > > u64 *timestamp)
> > > {
> > > struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, 
> > > event);
> > > 
> > > if (!evsel)
> > > return -EFAULT;
> > > return perf_evsel__parse_sample_timestamp(evsel, event, 
> > > timestamp);
> > > }
> > > 
> > > It isn't mapping the event ID it finds back to an evsel.. Jiri, ideas?
> > > 
> > > This is happening so far only for 'perf sched', perf record with two
> > > events works.
> > 
> > I saw also perf mem failing because of this.. will check
> 
> Right, seems something with the synthesizing of existing bpf progs,
> which always there are some nowadays, for instance, on this fedora29
> system:
> 
> [root@quaco tmp]# bpftool prog
> 13: cgroup_skb  tag 7be49e3934a125ba  gpl
>   loaded_at 2019-01-21T13:30:27-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 13,14
> 14: cgroup_skb  tag 2a142ef67aaad174  gpl
>   loaded_at 2019-01-21T13:30:27-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 13,14
> 15: cgroup_skb  tag 7be49e3934a125ba  gpl
>   loaded_at 2019-01-21T13:30:27-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 15,16
> 16: cgroup_skb  tag 2a142ef67aaad174  gpl
>   loaded_at 2019-01-21T13:30:27-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 15,16
> 17: cgroup_skb  tag 7be49e3934a125ba  gpl
>   loaded_at 2019-01-21T13:30:29-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 17,18
> 18: cgroup_skb  tag 2a142ef67aaad174  gpl
>   loaded_at 2019-01-21T13:30:29-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 17,18
> 21: cgroup_skb  tag 7be49e3934a125ba  gpl
>   loaded_at 2019-01-21T13:30:29-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 21,22
> 22: cgroup_skb  tag 2a142ef67aaad174  gpl
>   loaded_at 2019-01-21T13:30:29-0200  uid 0
>   xlated 296B  jited 229B  memlock 4096B  map_ids 21,22
> [root@quaco tmp]#
> 
> When with a bunch of tracepoints, that is what 'perf mem', 'perf kmem',
> 'perf sched', etc does, it ends up failing here:
> 
> ret = perf_evlist__parse_sample_timestamp(evlist, event, 
> );
> 
> So it is not passed to 
> 
>ret = perf_session__queue_event(session, event, timestamp, 
> file_offset);
> 
> in perf_session__process_event, this happens right when processing
> buildids in 'perf record', and also in 'perf report', so that is
> something badly synthesized that hits perf.data for PERF_RECORD_KSYMBOL.

it's reproducible with simple:
  perf record -e cycles,instructions ls

as you said on irc, it's the machine->id_hdr_size size missing
there's one more glitch, attached patch fixes that for me
you can't use sizeof(struct ksymbol_event), because it includes
the name as well.. which screws the size

but I don't know that code that much.. might be still something
missing

jirka


---
diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c
index 01e1dc1bb7fb..d86b61cc635f 100644
--- a/tools/perf/util/bpf-event.c
+++ b/tools/perf/util/bpf-event.c
@@ -7,6 +7,7 @@
 #include "bpf-event.h"
 #include "debug.h"
 #include "symbol.h"
+#include 

Re: [PATCH v6 08/16] sched/cpufreq: uclamp: Add utilization clamping for FAIR tasks

2019-01-22 Thread Peter Zijlstra
On Tue, Jan 15, 2019 at 10:15:05AM +, Patrick Bellasi wrote:
> --- a/kernel/sched/cpufreq_schedutil.c
> +++ b/kernel/sched/cpufreq_schedutil.c
> @@ -218,8 +218,15 @@ unsigned long schedutil_freq_util(int cpu, unsigned long 
> util_cfs,
>* CFS tasks and we use the same metric to track the effective
>* utilization (PELT windows are synchronized) we can directly add them
>* to obtain the CPU's actual utilization.
> +  *
> +  * CFS utilization can be boosted or capped, depending on utilization
> +  * clamp constraints requested by currently RUNNABLE tasks.
> +  * When there are no CFS RUNNABLE tasks, clamps are released and
> +  * frequency will be gracefully reduced with the utilization decay.
>*/
> - util = util_cfs;
> + util = (type == ENERGY_UTIL)
> + ? util_cfs
> + : uclamp_util(rq, util_cfs);

That's pretty horrible; what's wrong with:

util = util_cfs;
if (type == FREQUENCY_UTIL)
util = uclamp_util(rq, util);

That should generate the same code, but is (IMO) far easier to read.

>   util += cpu_util_rt(rq);
>  
>   dl_util = cpu_util_dl(rq);


[PATCH v7 4/6] dt-bindings: anybus-controller: document devicetree binding

2019-01-22 Thread Sven Van Asbroeck
From: Sven Van Asbroeck 

This patch adds devicetree binding documentation for the
Arcx anybus controller.

Signed-off-by: Sven Van Asbroeck 
---
 .../fieldbus/arcx,anybus-controller.txt   | 71 +++
 1 file changed, 71 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt

diff --git 
a/Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt 
b/Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt
new file mode 100644
index ..b1f9474f36d5
--- /dev/null
+++ b/Documentation/devicetree/bindings/fieldbus/arcx,anybus-controller.txt
@@ -0,0 +1,71 @@
+* Arcx Anybus-S controller
+
+This chip communicates with the SoC over a parallel bus. It is
+expected that its Device Tree node is specified as the child of a node
+corresponding to the parallel bus used for communication.
+
+Required properties:
+
+
+  - compatible : The following chip-specific string:
+"arcx,anybus-controller"
+
+  - reg : three areas:
+   index 0: bus memory area where the cpld registers are located.
+   index 1: bus memory area of the first  host's dual-port ram.
+   index 2: bus memory area of the second host's dual-port ram.
+
+  - reset-gpios : the GPIO pin connected to the reset line of the controller.
+
+  - interrupts : two interrupts:
+   index 0: interrupt connected to the first  host
+   index 1: interrupt connected to the second host
+   Generic interrupt client node bindings are described in
+   interrupt-controller/interrupts.txt
+
+Optional: use of subnodes
+-
+
+The card connected to a host may need additional properties. These can be
+specified in subnodes to the controller node.
+
+The subnodes are identified by the standard 'reg' property. Which information
+exactly can be specified depends on the bindings for the function driver
+for the subnode.
+
+Required controller node properties when using subnodes:
+- #address-cells: should be one.
+- #size-cells: should be zero.
+
+Required subnode properties:
+- reg: Must contain the host index of the card this subnode describes:
+   <0> for the first  host on the controller
+   <1> for the second host on the controller
+   Note that only a single card can be plugged into a host, so the host
+   index uniquely describes the card location.
+
+Example of usage:
+-
+
+This example places the bridge on top of the i.MX WEIM parallel bus, see:
+Documentation/devicetree/bindings/bus/imx-weim.txt
+
+ {
+   controller@0,0 {
+   compatible = "arcx,anybus-controller";
+   reg = <0 0 0x100>, <0 0x40 0x800>, <1 0x40 0x800>;
+   reset-gpios = < 2 GPIO_ACTIVE_HIGH>;
+   interrupt-parent = <>;
+   interrupts = <1 IRQ_TYPE_LEVEL_LOW>, <5 IRQ_TYPE_LEVEL_LOW>;
+   /* fsl,weim-cs-timing is a i.MX WEIM bus specific property */
+   fsl,weim-cs-timing = <0x024400b1 0x1010 0x20081100
+   0x 0xa240 0x>;
+   /* optional subnode for a card plugged into the first host */
+   #address-cells = <1>;
+   #size-cells = <0>;
+   card@0 {
+   reg = <0>;
+   /* card specific properties go here */
+   };
+   };
+};
-- 
2.17.1



[PATCH v7 3/6] anybus-s: support the Arcx anybus controller

2019-01-22 Thread Sven Van Asbroeck
Add a driver for the Arcx anybus controller.

This device implements two Anybus-S hosts (buses),
and connects to the SoC via a parallel memory bus.
There is also a CAN power readout, unrelated to the Anybus,
modelled as a regulator.

Signed-off-by: Sven Van Asbroeck 
---
 drivers/fieldbus/Makefile  |   1 -
 drivers/fieldbus/anybuss/Kconfig   |  14 +
 drivers/fieldbus/anybuss/Makefile  |   2 +
 drivers/fieldbus/anybuss/arcx-anybus.c | 399 +
 4 files changed, 415 insertions(+), 1 deletion(-)
 create mode 100644 drivers/fieldbus/anybuss/arcx-anybus.c

diff --git a/drivers/fieldbus/Makefile b/drivers/fieldbus/Makefile
index 432dd9c03569..d152f8270c96 100644
--- a/drivers/fieldbus/Makefile
+++ b/drivers/fieldbus/Makefile
@@ -8,4 +8,3 @@ fieldbus_dev-y  := dev_core.o
 
 # Anybus-S core and devices
 obj-$(CONFIG_HMS_ANYBUSS_BUS)  += anybuss/
-
diff --git a/drivers/fieldbus/anybuss/Kconfig b/drivers/fieldbus/anybuss/Kconfig
index 5b495f25c11e..7e563a78be13 100644
--- a/drivers/fieldbus/anybuss/Kconfig
+++ b/drivers/fieldbus/anybuss/Kconfig
@@ -7,3 +7,17 @@ config HMS_ANYBUSS_BUS
  You can attach a single Anybus-S compatible card to it, which
  typically provides fieldbus and industrial ethernet
  functionality.
+
+if HMS_ANYBUSS_BUS
+
+config ARCX_ANYBUS_CONTROLLER
+   tristate "Arcx Anybus-S Controller"
+   depends on OF && GPIOLIB
+   help
+ Select this to get support for the Arcx Anybus controller.
+ It connects to the SoC via a parallel memory bus, and
+ embeds up to two Anybus-S buses (slots).
+ There is also a CAN power readout, unrelated to the Anybus,
+ modelled as a regulator.
+
+endif
diff --git a/drivers/fieldbus/anybuss/Makefile 
b/drivers/fieldbus/anybuss/Makefile
index b1c386cb4ed2..815155f02700 100644
--- a/drivers/fieldbus/anybuss/Makefile
+++ b/drivers/fieldbus/anybuss/Makefile
@@ -5,3 +5,5 @@
 
 obj-y  += anybuss_core.o
 anybuss_core-y += host.o
+
+obj-$(CONFIG_ARCX_ANYBUS_CONTROLLER) += arcx-anybus.o
diff --git a/drivers/fieldbus/anybuss/arcx-anybus.c 
b/drivers/fieldbus/anybuss/arcx-anybus.c
new file mode 100644
index ..63dad15bc0c0
--- /dev/null
+++ b/drivers/fieldbus/anybuss/arcx-anybus.c
@@ -0,0 +1,399 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Arcx Anybus-S Controller driver
+ *
+ * Copyright (C) 2018 Arcx Inc
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#define CPLD_STATUS1   0x80
+#define CPLD_CONTROL   0x80
+#define CPLD_CONTROL_CRST  0x40
+#define CPLD_CONTROL_RST1  0x04
+#define CPLD_CONTROL_RST2  0x80
+#define CPLD_STATUS1_AB0x02
+#define CPLD_STATUS1_CAN_POWER 0x01
+#define CPLD_DESIGN_LO 0x81
+#define CPLD_DESIGN_HI 0x82
+#define CPLD_CAP   0x83
+#define CPLD_CAP_COMPAT0x01
+#define CPLD_CAP_SEP_RESETS0x02
+
+struct controller_priv {
+   struct device *class_dev;
+   bool common_reset;
+   struct gpio_desc *reset_gpiod;
+   void __iomem *cpld_base;
+   spinlock_t regs_lock;
+   u8 control_reg;
+   char version[3];
+   u16 design_no;
+};
+
+static void do_reset(struct controller_priv *cd, u8 rst_bit, bool reset)
+{
+   unsigned long flags;
+
+   spin_lock_irqsave(>regs_lock, flags);
+   /*
+* CPLD_CONTROL is write-only, so cache its value in
+* cd->control_reg
+*/
+   if (reset)
+   cd->control_reg &= ~rst_bit;
+   else
+   cd->control_reg |= rst_bit;
+   writeb(cd->control_reg, cd->cpld_base + CPLD_CONTROL);
+   /*
+* h/w work-around:
+* the hardware is 'too fast', so a reset followed by an immediate
+* not-reset will _not_ change the anybus reset line in any way,
+* losing the reset. to prevent this from happening, introduce
+* a minimum reset duration.
+* Verified minimum safe duration required using a scope
+* on 14-June-2018: 100 us.
+*/
+   if (reset)
+   udelay(100);
+   spin_unlock_irqrestore(>regs_lock, flags);
+}
+
+static int anybuss_reset(struct controller_priv *cd,
+unsigned long id, bool reset)
+{
+   if (id >= 2)
+   return -EINVAL;
+   if (cd->common_reset)
+   do_reset(cd, CPLD_CONTROL_CRST, reset);
+   else
+   do_reset(cd, id ? CPLD_CONTROL_RST2 : CPLD_CONTROL_RST1, reset);
+   return 0;
+}
+
+static void export_reset_0(struct device *dev, bool assert)
+{
+   struct controller_priv *cd = dev_get_drvdata(dev);
+
+   anybuss_reset(cd, 0, assert);
+}
+
+static void export_reset_1(struct device *dev, bool assert)
+{
+   struct controller_priv *cd = dev_get_drvdata(dev);
+
+   

[PATCH v7 6/6] fieldbus_dev: support HMS Profinet IRT industrial controller

2019-01-22 Thread Sven Van Asbroeck
The Anybus-S PROFINET IRT communication module provides instant integration
to any Ethernet based LAN via SMTP, FTP, HTTP as well as PROFINET and
Modbus-TCP. Additional protocols can be implemented on top of TCP/IP
or UDP using the transparent socket interface.

Official documentation:
https://www.anybus.com/docs/librariesprovider7/default-document-library
/manuals-design-guides/hms-hmsi-168-52.pdf

This implementation is an Anybus-S client driver, designed to be
instantiated by the Anybus-S bus driver when it discovers the Profinet
card.

If loaded successfully, the driver registers itself as a fieldbus_dev,
and userspace can access it through the fieldbus_dev interface.

Signed-off-by: Sven Van Asbroeck 
---
 drivers/fieldbus/anybuss/Kconfig|  16 ++
 drivers/fieldbus/anybuss/Makefile   |   1 +
 drivers/fieldbus/anybuss/hms-profinet.c | 223 
 3 files changed, 240 insertions(+)
 create mode 100644 drivers/fieldbus/anybuss/hms-profinet.c

diff --git a/drivers/fieldbus/anybuss/Kconfig b/drivers/fieldbus/anybuss/Kconfig
index 7e563a78be13..2ae2daf71d70 100644
--- a/drivers/fieldbus/anybuss/Kconfig
+++ b/drivers/fieldbus/anybuss/Kconfig
@@ -20,4 +20,20 @@ config ARCX_ANYBUS_CONTROLLER
  There is also a CAN power readout, unrelated to the Anybus,
  modelled as a regulator.
 
+config HMS_PROFINET
+   tristate "HMS Profinet IRT Controller (Anybus-S)"
+   depends on FIELDBUS_DEV && HMS_ANYBUSS_BUS
+   help
+ If you say yes here you get support for the HMS Industrial
+ Networks Profinet IRT Controller.
+
+ It will be registered with the kernel as a fieldbus_dev,
+ so userspace can interact with it via the fieldbus_dev userspace
+ interface(s).
+
+ This driver can also be built as a module. If so, the module
+ will be called hms-profinet.
+
+ If unsure, say N.
+
 endif
diff --git a/drivers/fieldbus/anybuss/Makefile 
b/drivers/fieldbus/anybuss/Makefile
index 815155f02700..322963a452dc 100644
--- a/drivers/fieldbus/anybuss/Makefile
+++ b/drivers/fieldbus/anybuss/Makefile
@@ -7,3 +7,4 @@ obj-y   += anybuss_core.o
 anybuss_core-y += host.o
 
 obj-$(CONFIG_ARCX_ANYBUS_CONTROLLER) += arcx-anybus.o
+obj-$(CONFIG_HMS_PROFINET) += hms-profinet.o
diff --git a/drivers/fieldbus/anybuss/hms-profinet.c 
b/drivers/fieldbus/anybuss/hms-profinet.c
new file mode 100644
index ..eb51aa1e7885
--- /dev/null
+++ b/drivers/fieldbus/anybuss/hms-profinet.c
@@ -0,0 +1,223 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * HMS Profinet Client Driver
+ *
+ * Copyright (C) 2018 Arcx Inc
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define PROFI_DPRAM_SIZE   512
+
+/*
+ * ---
+ * Anybus Profinet mailbox messages - definitions
+ * ---
+ * note that we're depending on the layout of these structures being
+ * exactly as advertised.
+ */
+
+struct msgMacAddr {
+   u8 addr[6];
+};
+
+struct profi_priv {
+   struct fieldbus_dev fbdev;
+   struct anybuss_client *client;
+   struct mutex enable_lock;
+   bool power_on;
+};
+
+static ssize_t
+profi_read_area(struct fieldbus_dev *fbdev, char __user *buf, size_t size,
+   loff_t *offset)
+{
+   struct profi_priv *priv = container_of(fbdev, struct profi_priv, fbdev);
+
+   return anybuss_read_output(priv->client, buf, size, offset);
+}
+
+static ssize_t
+profi_write_area(struct fieldbus_dev *fbdev, const char __user *buf,
+   size_t size, loff_t *offset)
+{
+   struct profi_priv *priv = container_of(fbdev, struct profi_priv, fbdev);
+
+   return anybuss_write_input(priv->client, buf, size, offset);
+}
+
+static int profi_id_get(struct fieldbus_dev *fbdev, char *buf,
+   size_t max_size)
+{
+   struct profi_priv *priv = container_of(fbdev, struct profi_priv, fbdev);
+   struct msgMacAddr response;
+   int ret;
+
+   ret = anybuss_recv_msg(priv->client, 0x0010, ,
+   sizeof(response));
+   if (ret < 0)
+   return ret;
+   return snprintf(buf, max_size, "%02X:%02X:%02X:%02X:%02X:%02X\n",
+   response.addr[0], response.addr[1],
+   response.addr[2], response.addr[3],
+   response.addr[4], response.addr[5]);
+}
+
+static bool profi_enable_get(struct fieldbus_dev *fbdev)
+{
+   struct profi_priv *priv = container_of(fbdev, struct profi_priv, fbdev);
+   bool power_on;
+
+   mutex_lock(>enable_lock);
+   power_on = priv->power_on;
+   mutex_unlock(>enable_lock);
+
+   return power_on;
+}
+
+static int __profi_enable(struct profi_priv *priv)
+{
+   int ret;
+   struct anybuss_client *client = priv->client;
+   /* Initialization Sequence, Generic 

[PATCH v7 2/6] anybus-s: support HMS Anybus-S bus

2019-01-22 Thread Sven Van Asbroeck
The Anybus-S/Anybus-M is a series of interchangeable fieldbus communication
modules featuring on board memory and processing power. All software and
hardware functionality required to communicate on the fieldbus is
incorporated in the module itself, allowing the application to focus on
other tasks.

Typical applications are frequency inverters, HMI and visualization
devices, instruments, scales, robotics, PLC’s and intelligent measuring
devices.

Official documentation:
https://www.anybus.com/docs/librariesprovider7/default-document-library/
manuals-design-guides/hms-hmsi-27-275.pdf

Signed-off-by: Sven Van Asbroeck 
---
 drivers/fieldbus/Kconfig   |3 +-
 drivers/fieldbus/Makefile  |4 +-
 drivers/fieldbus/anybuss/Kconfig   |9 +
 drivers/fieldbus/anybuss/Makefile  |7 +
 drivers/fieldbus/anybuss/host.c| 1459 
 include/linux/anybuss-client.h |  104 ++
 include/linux/anybuss-controller.h |   47 +
 7 files changed, 1630 insertions(+), 3 deletions(-)
 create mode 100644 drivers/fieldbus/anybuss/Kconfig
 create mode 100644 drivers/fieldbus/anybuss/Makefile
 create mode 100644 drivers/fieldbus/anybuss/host.c
 create mode 100644 include/linux/anybuss-client.h
 create mode 100644 include/linux/anybuss-controller.h

diff --git a/drivers/fieldbus/Kconfig b/drivers/fieldbus/Kconfig
index 5c2bef950d04..b62f06bd522c 100644
--- a/drivers/fieldbus/Kconfig
+++ b/drivers/fieldbus/Kconfig
@@ -14,6 +14,5 @@ menuconfig FIELDBUS_DEV
 
  If unsure, say no.
 
-if FIELDBUS_DEV
+source "drivers/fieldbus/anybuss/Kconfig"
 
-endif
diff --git a/drivers/fieldbus/Makefile b/drivers/fieldbus/Makefile
index 23877def5803..432dd9c03569 100644
--- a/drivers/fieldbus/Makefile
+++ b/drivers/fieldbus/Makefile
@@ -6,4 +6,6 @@
 obj-$(CONFIG_FIELDBUS_DEV) += fieldbus_dev.o
 fieldbus_dev-y := dev_core.o
 
-# Devices
+# Anybus-S core and devices
+obj-$(CONFIG_HMS_ANYBUSS_BUS)  += anybuss/
+
diff --git a/drivers/fieldbus/anybuss/Kconfig b/drivers/fieldbus/anybuss/Kconfig
new file mode 100644
index ..5b495f25c11e
--- /dev/null
+++ b/drivers/fieldbus/anybuss/Kconfig
@@ -0,0 +1,9 @@
+config HMS_ANYBUSS_BUS
+   tristate "HMS Anybus-S Bus Support"
+   select REGMAP
+   depends on OF && FIELDBUS_DEV
+   help
+ Driver for the HMS Industrial Networks Anybus-S bus.
+ You can attach a single Anybus-S compatible card to it, which
+ typically provides fieldbus and industrial ethernet
+ functionality.
diff --git a/drivers/fieldbus/anybuss/Makefile 
b/drivers/fieldbus/anybuss/Makefile
new file mode 100644
index ..b1c386cb4ed2
--- /dev/null
+++ b/drivers/fieldbus/anybuss/Makefile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for anybuss drivers.
+#
+
+obj-y  += anybuss_core.o
+anybuss_core-y += host.o
diff --git a/drivers/fieldbus/anybuss/host.c b/drivers/fieldbus/anybuss/host.c
new file mode 100644
index ..e07e5983baa1
--- /dev/null
+++ b/drivers/fieldbus/anybuss/host.c
@@ -0,0 +1,1459 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * HMS Anybus-S Host Driver
+ *
+ * Copyright (C) 2018 Arcx Inc
+ */
+
+/*
+ * Architecture Overview
+ * =
+ * This driver (running on the CPU/SoC) and the Anybus-S card communicate
+ * by reading and writing data to/from the Anybus-S Dual-Port RAM (dpram).
+ * This is memory connected to both the SoC and Anybus-S card, which both sides
+ * can access freely and concurrently.
+ *
+ * Synchronization happens by means of two registers located in the dpram:
+ * IND_AB: written exclusively by the Anybus card; and
+ * IND_AP: written exclusively by this driver.
+ *
+ * Communication happens using one of the following mechanisms:
+ * 1. reserve, read/write, release dpram memory areas:
+ * using an IND_AB/IND_AP protocol, the driver is able to reserve certain
+ * memory areas. no dpram memory can be read or written except if reserved.
+ * (with a few limited exceptions)
+ * 2. send and receive data structures via a shared mailbox:
+ * using an IND_AB/IND_AP protocol, the driver and Anybus card are able to
+ * exchange commands and responses using a shared mailbox.
+ * 3. receive software interrupts:
+ * using an IND_AB/IND_AP protocol, the Anybus card is able to notify the
+ * driver of certain events such as: bus online/offline, data available.
+ * note that software interrupt event bits are located in a memory area
+ * which must be reserved before it can be accessed.
+ *
+ * The manual[1] is silent on whether these mechanisms can happen concurrently,
+ * or how they should be synchronized. However, section 13 (Driver Example)
+ * provides the following suggestion for developing a driver:
+ * a) an interrupt handler which updates global variables;
+ * b) a continuously-running task handling area requests (1 above)
+ * c) a continuously-running task handling mailbox 

[PATCH v7 1/6] fieldbus_dev: add Fieldbus Device subsystem.

2019-01-22 Thread Sven Van Asbroeck
Fieldbus device (client) adapters allow data exchange with a PLC aka.
"Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)

They are typically used when a Linux device wants to expose itself
as an actuator, motor, console light, switch, etc. over the fieldbus.

This framework is designed to provide a generic interface to Fieldbus
Devices from both the Linux Kernel and the userspace.

Signed-off-by: Sven Van Asbroeck 
---
 Documentation/ABI/testing/fieldbus-dev-cdev   |  31 ++
 .../ABI/testing/sysfs-class-fieldbus-dev  |  62 
 Documentation/fieldbus_dev/fieldbus_dev.txt   |  66 
 drivers/Kconfig   |   2 +
 drivers/Makefile  |   1 +
 drivers/fieldbus/Kconfig  |  19 +
 drivers/fieldbus/Makefile |   9 +
 drivers/fieldbus/dev_core.c   | 348 ++
 include/linux/fieldbus_dev.h  | 105 ++
 9 files changed, 643 insertions(+)
 create mode 100644 Documentation/ABI/testing/fieldbus-dev-cdev
 create mode 100644 Documentation/ABI/testing/sysfs-class-fieldbus-dev
 create mode 100644 Documentation/fieldbus_dev/fieldbus_dev.txt
 create mode 100644 drivers/fieldbus/Kconfig
 create mode 100644 drivers/fieldbus/Makefile
 create mode 100644 drivers/fieldbus/dev_core.c
 create mode 100644 include/linux/fieldbus_dev.h

diff --git a/Documentation/ABI/testing/fieldbus-dev-cdev 
b/Documentation/ABI/testing/fieldbus-dev-cdev
new file mode 100644
index ..2c71f63ce0f9
--- /dev/null
+++ b/Documentation/ABI/testing/fieldbus-dev-cdev
@@ -0,0 +1,31 @@
+What:  /dev/fieldbus_devX
+Date:  December 2018
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   The cdev interface to drivers for Fieldbus Device Memory
+   (aka. Process Memory).
+
+   The following file operations are supported:
+
+   open(2)
+   Create an I/O context associated with the file descriptor.
+
+   read(2)
+   Read from Process Memory's "read area".
+   Clears POLLERR | POLLPRI from the file descriptor.
+
+   write(2)
+   Write to Process Memory's "write area".
+
+   poll(2), select(2), epoll_wait(2) etc.
+   When a "Process Memory Read Area Changed" event occurs,
+   POLLERR | POLLPRI will be set on the file descriptor.
+   Note that POLLIN | POLLOUT events are always set, because the
+   process memory area is always readable and writable.
+
+   close(2)
+   Free up the I/O context that was associated
+   with the file descriptor.
+
+Users: TBD
diff --git a/Documentation/ABI/testing/sysfs-class-fieldbus-dev 
b/Documentation/ABI/testing/sysfs-class-fieldbus-dev
new file mode 100644
index ..f0e45ec34400
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-fieldbus-dev
@@ -0,0 +1,62 @@
+What:  /sys/class/fieldbus_dev/fieldbus_devX/card_name
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   Human-readable name of the Fieldbus Device.
+
+What:  /sys/class/fieldbus_dev/fieldbus_devX/fieldbus_type
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   The type of fieldbus implemented by this device.
+   Possible values:
+   'unknown'
+   'profinet'
+
+What:  /sys/class/fieldbus_dev/fieldbus_devX/fieldbus_id
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   The unique fieldbus id associated with this device.
+   The exact format of this id is fieldbus type dependent, e.g.
+   a mac address for profinet.
+
+What:  /sys/class/fieldbus_dev/fieldbus_devX/read_area_size
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   The size, in bytes, of the Process Memory read area.
+   Note: this area is accessible by reading from the associated
+   character device (/dev/fieldbus_devX).
+
+What:  /sys/class/fieldbus_dev/fieldbus_devX/write_area_size
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   The size, in bytes, of the Process Memory write area.
+   Note: this area is accessible by writing to the associated
+   character device (/dev/fieldbus_devX)
+
+What:  /sys/class/fieldbus_dev/fieldbus_devX/online
+KernelVersion: 4.21
+Contact:   Sven Van Asbroeck 
+Description:
+   Whether the fieldbus is online or offline.
+   Possible values:
+   '1' meaning 'online'
+   '0' meaning 'offline'
+   Note: an uevent is generated when this property changes.
+
+What:  

[PATCH v7 0/6] Add Fieldbus subsystem + support HMS Profinet card

2019-01-22 Thread Sven Van Asbroeck
This patch:
  1. adds a Fieldbus subsystem
  2. adds support for the HMS Industrial Networks AB Profinet card.

1. Fieldbus subsystem
-

Fieldbus device (client) adapters allow data exchange with a PLC aka.
"Fieldbus Controller" over a fieldbus (Profinet, FLNet, etc.)
They are typically used when a Linux device wants to expose itself
as an actuator, motor, console light, switch, etc. over the fieldbus.
The framework is designed to provide a generic interface to Fieldbus
Devices from both the Linux Kernel and the userspace.

2. Add support for HMS Profinet Card


Profinet is an industry technical standard for data communication over
Industrial Ethernet, designed for collecting data from, and controlling,
equipment in industrial systems, with a particular strength in delivering data
under tight time constraints (on the order of 1ms or less).

The profinet card itself is connected to the system via an industrial bus
called 'anybus'.

I have followed the bus driver/client driver pattern, and created an anybus
bus driver, plus a client driver for the profinet card.

In case this patch set gets (eventually) accepted, drivers for other anybus
client cards may follow: flnet, cc-link, ...

The anybus slot on the host is located on an 'anybus controller', which is
custom h/w designed by arcx. It exposes a dual anybus host implementation,
plus a power readout unrelated to the anybus.

v7:
use %zu printf formatter to display size_t

v6:
Randy Dunlap:
correctly/consistently indent Kconfig
spelling/punctuation improvements

Greg KH:
suggestion: simplify /sys/class/fieldbus_dev/fieldbus_devX/ -> 
/sys/class/fieldbus_dev/X/
can't simplify: create_device() also determines the name of the
associated char device. simplification would result in a char 
device
named /dev/X ?
applied above suggestion to arcx-controller driver, this works ok as it 
does not
have associated char device
class name left as-is (fieldbus_dev) to differentiate between
"fieldbus controller" and "fieldbus device" in the future
makefile clean-up
sysfs attributes: snprintf -> sprintf
except card_name, as it's externally provided and could 
potentially
be > PAGE_SIZE
enabled/online sysfs attributes converted to "0/1" values
using kstrtobool()

v5:
Greg KH:
fix licence nit
consistent use of e-mail address
replaced raw sysfs attribute with kobject_uevent() call
keep __ATTRIBUTE_GROUPS because we need is_visible field
Rob Herring:
controller devicetree entry now requires multiple address
regions and interrupts
controller child node(s) now mapped to child devices by
slot/host position (using devicetree reg = <>)
architectural overhaul to align closely to existing pci arch:

pci anybus  

Common bus code (spec), pci/pci_driver.canybus/dev_core.c
  calls bus_register()  no of compatibleno of compatible

Device on bus, calls
  XXX_client_driver_register()  hwmon/k8temp.c  fieldbus/hms-profinet.c

Controller, silicon driver  pci/pcie-tango.canybus/arcx-anybus.c
platform_driver calls   platform_driver calls
pci_host_probe()
anybus_host_common_probe()

v4:
general
create fieldbus_dev subsystem, with standardized 'simple'
userspace interface (sysfs + cdev)
remove redundant __packed keywords
use __be16/32 types wherever values are explicitly big-endian
hms-profinet:
remove configuration code, and uapi headers: not supported (yet)
when registering as a fieldbus_dev.
anybuss-host:
use struct kref to reference-count tasks
replace busy loops with usleep_range() loop after 10 tries
use threaded irq so time_before_eq(jiffies, timeout) will
continue to work
allow client devices to be assigned a devicetree node,
in the same way as pci/mmc/...

v3:
devicetree-bindings
adding the vendor prefix is now a separate commit
anybus-bridge:
moved misc driver to drivers/bus/
converted of_gpio_* to gpiod_* 

Re: [PATCH] ARM: dts: imx: Add support for Logic PD i.MX6QD EVM

2019-01-22 Thread Fabio Estevam
Hi Adam,

On Tue, Jan 22, 2019 at 12:07 PM Adam Ford  wrote:

> +   reg_audio: regulator-audio {
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_reg_audio>;
> +   compatible = "regulator-fixed";
> +   regulator-name = "3v3_aud";
> +   regulator-min-microvolt = <330>;
> +   regulator-max-microvolt = <330>;
> +   gpio = < 29 GPIO_ACTIVE_HIGH>;
> +   enable-active-high;
> +   regulator-always-on;

It seems that the 'regulator-always-on' property is not needed in this case.

> + {
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_i2c1>;
> +   clock-frequency = <40>;
> +   status = "okay";
> +
> +   codec: wm8962@1a {

Node name should be generic and label name should be specific, so:

wm8962: codec@1a {

> +   chosen {
> +   stdout-path = 
> +   };
> +
> +   memory@1000 {

Need to pass device_type = "memory";

> +   reg = <0x1000 0x8000>;
> +   };
> +
> +   reg_wl18xx_vmmc: regulator-wl18xx {
> +   compatible = "regulator-fixed";
> +   regulator-name = "vwl1837";
> +   regulator-min-microvolt = <330>;
> +   regulator-max-microvolt = <330>;
> +   gpio = < 0 GPIO_ACTIVE_HIGH>;
> +   startup-delay-us = <7>;
> +   enable-active-high;
> +   };
> +

No need for this blank line.

> +};

> + {
> +   clock-frequency = <10>;
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_i2c3>;
> +   status = "okay";
> +
> +   pmic: pfuze100@8 {

pfuze100: pmic@8

> +   tmp102_0: tmp102@4a {

generic node name, please.

> +   compatible = "ti,tmp102";
> +   reg = <0x4a>;
> +   pinctrl-names = "default";
> +   pinctrl-0 = <_tempsense>;
> +   interrupt-parent = <>;
> +   interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
> +   #thermal-sensor-cells = <1>;
> +   };
> +
> +   tmp102_1: tmp102@49 {

Ditto

> +   compatible = "ti,tmp102";
> +   reg = <0x49>;
> +   interrupt-parent = <>;
> +   interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
> +   #thermal-sensor-cells = <1>;
> +   };
> +
> +   at24c64_mfg: at24@51 {

Ditto

> +   compatible = "atmel,24c64";
> +   pagesize = <32>;
> +   read-only;  /* Manufacturing EEPROM programmed at factory 
> */
> +   reg = <0x51>;
> +   };
> +
> +   at24c64_usr: at24@52 {

Ditto

> +   panel-lvds0 {
> +   compatible = "ampire,am800480b3tmqw";

Could not found this compatible documented.

> + {
> +   ili_touch: ilitouch@26 {

Generic node name, please.

> +   compatible = "ili,ili2117a";

Could not found this compatible documented.


Re: [PATCH v3] fpga: altera_freeze_bridge: remove restriction to socfpga

2019-01-22 Thread Alan Tull
On Sat, Jan 19, 2019 at 6:41 PM Moritz Fischer
 wrote:
>
> On Tue, Jan 15, 2019 at 6:01 PM Alan Tull  wrote:
> >
> > The Altera Freeze Bridge should not be restricted to ARCH_SOCFPGA
> > since it can be used on other platforms such as Stratix10.
> >
> > Signed-off-by: Alan Tull 
> Reviewed-by: Moritz Fischer 

Thanks!

Alan


> > ---
> > v2: add depends on HAS_IOMEM
> > v3: put both dependencies on one line
> > ---
> >  drivers/fpga/Kconfig | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
> > index 0bb7b5c..c20445b 100644
> > --- a/drivers/fpga/Kconfig
> > +++ b/drivers/fpga/Kconfig
> > @@ -104,7 +104,7 @@ config SOCFPGA_FPGA_BRIDGE
> >
> >  config ALTERA_FREEZE_BRIDGE
> > tristate "Altera FPGA Freeze Bridge"
> > -   depends on ARCH_SOCFPGA && FPGA_BRIDGE
> > +   depends on FPGA_BRIDGE && HAS_IOMEM
> > help
> >   Say Y to enable drivers for Altera FPGA Freeze bridges.  A
> >   freeze bridge is a bridge that exists in the FPGA fabric to
> > --
> > 2.7.4
> >
>
> Thanks,
> Moritz


[PATCH 3/8] infiniband: hfi1: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Mike Marciniszyn 
Cc: Dennis Dalessandro 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/hfi1/debugfs.c |  2 --
 drivers/infiniband/hw/hfi1/fault.c   | 50 ++--
 2 files changed, 18 insertions(+), 34 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/debugfs.c 
b/drivers/infiniband/hw/hfi1/debugfs.c
index 52c00c67056f..961009e66047 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.c
+++ b/drivers/infiniband/hw/hfi1/debugfs.c
@@ -1335,8 +1335,6 @@ DEBUGFS_FILE_OPS(driver_stats);
 void hfi1_dbg_init(void)
 {
hfi1_dbg_root  = debugfs_create_dir(DRIVER_NAME, NULL);
-   if (!hfi1_dbg_root)
-   pr_warn("init of debugfs failed\n");
debugfs_create_file("driver_stats_names", 0444, hfi1_dbg_root, NULL, 
&_driver_stats_names_file_ops);
debugfs_create_file("driver_stats", 0444, hfi1_dbg_root, NULL, 
&_driver_stats_file_ops);
 }
diff --git a/drivers/infiniband/hw/hfi1/fault.c 
b/drivers/infiniband/hw/hfi1/fault.c
index dd09b8544568..195fe81e13ea 100644
--- a/drivers/infiniband/hw/hfi1/fault.c
+++ b/drivers/infiniband/hw/hfi1/fault.c
@@ -250,6 +250,7 @@ void hfi1_fault_exit_debugfs(struct hfi1_ibdev *ibd)
 int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd)
 {
struct dentry *parent = ibd->hfi1_ibdev_dbg;
+   struct dentry *fault_dir;
 
ibd->fault = kzalloc(sizeof(*ibd->fault), GFP_KERNEL);
if (!ibd->fault)
@@ -269,46 +270,31 @@ int hfi1_fault_init_debugfs(struct hfi1_ibdev *ibd)
bitmap_zero(ibd->fault->opcodes,
sizeof(ibd->fault->opcodes) * BITS_PER_BYTE);
 
-   ibd->fault->dir =
-   fault_create_debugfs_attr("fault", parent,
- >fault->attr);
-   if (IS_ERR(ibd->fault->dir)) {
+   fault_dir = fault_create_debugfs_attr("fault", parent,
+ >fault->attr);
+   if (IS_ERR(fault_dir)) {
kfree(ibd->fault);
ibd->fault = NULL;
return -ENOENT;
}
+   ibd->fault->dir = fault_dir;
 
-   debugfs_create_file("fault_stats", 0444, ibd->fault->dir, ibd,
+   debugfs_create_file("fault_stats", 0444, fault_dir, ibd,
&_fault_stats_file_ops);
-   if (!debugfs_create_bool("enable", 0600, ibd->fault->dir,
->fault->enable))
-   goto fail;
-   if (!debugfs_create_bool("suppress_err", 0600,
-ibd->fault->dir,
->fault->suppress_err))
-   goto fail;
-   if (!debugfs_create_bool("opcode_mode", 0600, ibd->fault->dir,
->fault->opcode))
-   goto fail;
-   if (!debugfs_create_file("opcodes", 0600, ibd->fault->dir,
-ibd->fault, &__fault_opcodes_fops))
-   goto fail;
-   if (!debugfs_create_u64("skip_pkts", 0600,
-   ibd->fault->dir,
-   >fault->fault_skip))
-   goto fail;
-   if (!debugfs_create_u64("skip_usec", 0600,
-   ibd->fault->dir,
-   >fault->fault_skip_usec))
-   goto fail;
-   if (!debugfs_create_u8("direction", 0600, ibd->fault->dir,
-  >fault->direction))
-   goto fail;
+   debugfs_create_bool("enable", 0600, fault_dir, >fault->enable);
+   debugfs_create_bool("suppress_err", 0600, fault_dir,
+   >fault->suppress_err);
+   debugfs_create_bool("opcode_mode", 0600, fault_dir,
+   >fault->opcode);
+   debugfs_create_file("opcodes", 0600, fault_dir, ibd->fault,
+   &__fault_opcodes_fops);
+   debugfs_create_u64("skip_pkts", 0600, fault_dir,
+  >fault->fault_skip);
+   debugfs_create_u64("skip_usec", 0600, fault_dir,
+  >fault->fault_skip_usec);
+   debugfs_create_u8("direction", 0600, fault_dir, >fault->direction);
 
return 0;
-fail:
-   hfi1_fault_exit_debugfs(ibd);
-   return -ENOMEM;
 }
 
 bool hfi1_dbg_fault_suppress_err(struct hfi1_ibdev *ibd)
-- 
2.20.1



[PATCH 4/8] infiniband: qib: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Mike Marciniszyn 
Cc: Dennis Dalessandro 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/qib/qib_debugfs.c | 26 +++--
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/drivers/infiniband/hw/qib/qib_debugfs.c 
b/drivers/infiniband/hw/qib/qib_debugfs.c
index 5ed1ed93380f..8546e69c6a07 100644
--- a/drivers/infiniband/hw/qib/qib_debugfs.c
+++ b/drivers/infiniband/hw/qib/qib_debugfs.c
@@ -66,15 +66,6 @@ static const struct file_operations _##name##_file_ops = { \
.release = seq_release \
 };
 
-#define DEBUGFS_FILE_CREATE(name) \
-do { \
-   struct dentry *ent; \
-   ent = debugfs_create_file(#name , 0400, ibd->qib_ibdev_dbg, \
-   ibd, &_##name##_file_ops); \
-   if (!ent) \
-   pr_warn("create of " #name " failed\n"); \
-} while (0)
-
 static void *_opcode_stats_seq_start(struct seq_file *s, loff_t *pos)
 {
struct qib_opcode_stats_perctx *opstats;
@@ -249,17 +240,16 @@ DEBUGFS_FILE(qp_stats)
 
 void qib_dbg_ibdev_init(struct qib_ibdev *ibd)
 {
+   struct dentry *root;
char name[10];
 
snprintf(name, sizeof(name), "qib%d", dd_from_dev(ibd)->unit);
-   ibd->qib_ibdev_dbg = debugfs_create_dir(name, qib_dbg_root);
-   if (!ibd->qib_ibdev_dbg) {
-   pr_warn("create of %s failed\n", name);
-   return;
-   }
-   DEBUGFS_FILE_CREATE(opcode_stats);
-   DEBUGFS_FILE_CREATE(ctx_stats);
-   DEBUGFS_FILE_CREATE(qp_stats);
+   root = debugfs_create_dir(name, qib_dbg_root);
+   ibd->qib_ibdev_dbg = root;
+
+   debugfs_create_file("opcode_stats", 0400, root, ibd, 
&_opcode_stats_file_ops);
+   debugfs_create_file("ctx_stats", 0400, root, ibd, &_ctx_stats_file_ops);
+   debugfs_create_file("qp_stats", 0400, root, ibd, &_qp_stats_file_ops);
 }
 
 void qib_dbg_ibdev_exit(struct qib_ibdev *ibd)
@@ -274,8 +264,6 @@ void qib_dbg_ibdev_exit(struct qib_ibdev *ibd)
 void qib_dbg_init(void)
 {
qib_dbg_root = debugfs_create_dir(QIB_DRV_NAME, NULL);
-   if (!qib_dbg_root)
-   pr_warn("init of debugfs failed\n");
 }
 
 void qib_dbg_exit(void)
-- 
2.20.1



[PATCH 7/8] infiniband: usnic: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Christian Benvenuti 
Cc: Nelson Escobar 
Cc: Parvi Kaustubhi 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/usnic/usnic_debugfs.c | 26 -
 1 file changed, 26 deletions(-)

diff --git a/drivers/infiniband/hw/usnic/usnic_debugfs.c 
b/drivers/infiniband/hw/usnic/usnic_debugfs.c
index a3115709fb03..e5a3f02fb078 100644
--- a/drivers/infiniband/hw/usnic/usnic_debugfs.c
+++ b/drivers/infiniband/hw/usnic/usnic_debugfs.c
@@ -113,42 +113,21 @@ static const struct file_operations flowinfo_ops = {
 void usnic_debugfs_init(void)
 {
debugfs_root = debugfs_create_dir(DRV_NAME, NULL);
-   if (IS_ERR(debugfs_root)) {
-   usnic_err("Failed to create debugfs root dir, check if debugfs 
is enabled in kernel configuration\n");
-   goto out_clear_root;
-   }
 
flows_dentry = debugfs_create_dir("flows", debugfs_root);
-   if (IS_ERR_OR_NULL(flows_dentry)) {
-   usnic_err("Failed to create debugfs flow dir with err %ld\n",
-   PTR_ERR(flows_dentry));
-   goto out_free_root;
-   }
 
debugfs_create_file("build-info", S_IRUGO, debugfs_root,
NULL, _debugfs_buildinfo_ops);
-   return;
-
-out_free_root:
-   debugfs_remove_recursive(debugfs_root);
-out_clear_root:
-   debugfs_root = NULL;
 }
 
 void usnic_debugfs_exit(void)
 {
-   if (!debugfs_root)
-   return;
-
debugfs_remove_recursive(debugfs_root);
debugfs_root = NULL;
 }
 
 void usnic_debugfs_flow_add(struct usnic_ib_qp_grp_flow *qp_flow)
 {
-   if (IS_ERR_OR_NULL(flows_dentry))
-   return;
-
scnprintf(qp_flow->dentry_name, sizeof(qp_flow->dentry_name),
"%u", qp_flow->flow->flow_id);
qp_flow->dbgfs_dentry = debugfs_create_file(qp_flow->dentry_name,
@@ -156,11 +135,6 @@ void usnic_debugfs_flow_add(struct usnic_ib_qp_grp_flow 
*qp_flow)
flows_dentry,
qp_flow,
_ops);
-   if (IS_ERR_OR_NULL(qp_flow->dbgfs_dentry)) {
-   usnic_err("Failed to create dbg fs entry for flow %u with error 
%ld\n",
-   qp_flow->flow->flow_id,
-   PTR_ERR(qp_flow->dbgfs_dentry));
-   }
 }
 
 void usnic_debugfs_flow_remove(struct usnic_ib_qp_grp_flow *qp_flow)
-- 
2.20.1



[PATCH] scsi: hpsa: clean up two indentation issues

2019-01-22 Thread Colin King
From: Colin Ian King 

There are two statements that are indented incorrectly. Fix these.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/hpsa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index ff67ef5d5347..528fdd10 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -1327,7 +1327,7 @@ static int hpsa_scsi_add_entry(struct ctlr_info *h,
dev_warn(>pdev->dev, "physical device with no LUN=0,"
" suspect firmware bug or unsupported hardware "
"configuration.\n");
-   return -1;
+   return -1;
}
 
 lun_assigned:
@@ -4110,7 +4110,7 @@ static int hpsa_gather_lun_info(struct ctlr_info *h,
"maximum logical LUNs (%d) exceeded.  "
"%d LUNs ignored.\n", HPSA_MAX_LUN,
*nlogicals - HPSA_MAX_LUN);
-   *nlogicals = HPSA_MAX_LUN;
+   *nlogicals = HPSA_MAX_LUN;
}
if (*nlogicals + *nphysicals > HPSA_MAX_PHYS_LUN) {
dev_warn(>pdev->dev,
-- 
2.19.1



[PATCH 6/8] infiniband: ocrdma: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Selvin Xavier 
Cc: Devesh Sharma 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: Leon Romanovsky 
Cc: Yuval Shaia 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 67 +++--
 1 file changed, 22 insertions(+), 45 deletions(-)

diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c 
b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
index 6be0ea109138..a902942adb5d 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_stats.c
@@ -767,88 +767,65 @@ void ocrdma_add_port_stats(struct ocrdma_dev *dev)
 
/* Create post stats base dir */
dev->dir = debugfs_create_dir(pci_name(pdev), ocrdma_dbgfs_dir);
-   if (!dev->dir)
-   goto err;
 
dev->rsrc_stats.type = OCRDMA_RSRC_STATS;
dev->rsrc_stats.dev = dev;
-   if (!debugfs_create_file("resource_stats", S_IRUSR, dev->dir,
->rsrc_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("resource_stats", S_IRUSR, dev->dir,
+   >rsrc_stats, _dbg_ops);
 
dev->rx_stats.type = OCRDMA_RXSTATS;
dev->rx_stats.dev = dev;
-   if (!debugfs_create_file("rx_stats", S_IRUSR, dev->dir,
->rx_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("rx_stats", S_IRUSR, dev->dir, >rx_stats,
+   _dbg_ops);
 
dev->wqe_stats.type = OCRDMA_WQESTATS;
dev->wqe_stats.dev = dev;
-   if (!debugfs_create_file("wqe_stats", S_IRUSR, dev->dir,
->wqe_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("wqe_stats", S_IRUSR, dev->dir, >wqe_stats,
+   _dbg_ops);
 
dev->tx_stats.type = OCRDMA_TXSTATS;
dev->tx_stats.dev = dev;
-   if (!debugfs_create_file("tx_stats", S_IRUSR, dev->dir,
->tx_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("tx_stats", S_IRUSR, dev->dir, >tx_stats,
+   _dbg_ops);
 
dev->db_err_stats.type = OCRDMA_DB_ERRSTATS;
dev->db_err_stats.dev = dev;
-   if (!debugfs_create_file("db_err_stats", S_IRUSR, dev->dir,
->db_err_stats, _dbg_ops))
-   goto err;
-
+   debugfs_create_file("db_err_stats", S_IRUSR, dev->dir,
+   >db_err_stats, _dbg_ops);
 
dev->tx_qp_err_stats.type = OCRDMA_TXQP_ERRSTATS;
dev->tx_qp_err_stats.dev = dev;
-   if (!debugfs_create_file("tx_qp_err_stats", S_IRUSR, dev->dir,
->tx_qp_err_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("tx_qp_err_stats", S_IRUSR, dev->dir,
+   >tx_qp_err_stats, _dbg_ops);
 
dev->rx_qp_err_stats.type = OCRDMA_RXQP_ERRSTATS;
dev->rx_qp_err_stats.dev = dev;
-   if (!debugfs_create_file("rx_qp_err_stats", S_IRUSR, dev->dir,
->rx_qp_err_stats, _dbg_ops))
-   goto err;
-
+   debugfs_create_file("rx_qp_err_stats", S_IRUSR, dev->dir,
+   >rx_qp_err_stats, _dbg_ops);
 
dev->tx_dbg_stats.type = OCRDMA_TX_DBG_STATS;
dev->tx_dbg_stats.dev = dev;
-   if (!debugfs_create_file("tx_dbg_stats", S_IRUSR, dev->dir,
->tx_dbg_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("tx_dbg_stats", S_IRUSR, dev->dir,
+   >tx_dbg_stats, _dbg_ops);
 
dev->rx_dbg_stats.type = OCRDMA_RX_DBG_STATS;
dev->rx_dbg_stats.dev = dev;
-   if (!debugfs_create_file("rx_dbg_stats", S_IRUSR, dev->dir,
->rx_dbg_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("rx_dbg_stats", S_IRUSR, dev->dir,
+   >rx_dbg_stats, _dbg_ops);
 
dev->driver_stats.type = OCRDMA_DRV_STATS;
dev->driver_stats.dev = dev;
-   if (!debugfs_create_file("driver_dbg_stats", S_IRUSR, dev->dir,
-   >driver_stats, _dbg_ops))
-   goto err;
+   debugfs_create_file("driver_dbg_stats", S_IRUSR, dev->dir,
+   >driver_stats, _dbg_ops);
 
dev->reset_stats.type = OCRDMA_RESET_STATS;
dev->reset_stats.dev = dev;
-   if (!debugfs_create_file("reset_stats", 0200, dev->dir,
-   >reset_stats, _dbg_ops))
-   goto err;
-
-
-   return;
-err:
-   debugfs_remove_recursive(dev->dir);
-   dev->dir = NULL;
+   debugfs_create_file("reset_stats", 0200, dev->dir, >reset_stats,
+  

[PATCH 8/8] infiniband: ipoib: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: Leon Romanovsky 
Cc: Kamal Heib 
Cc: Denis Drozdov 
Cc: Saeed Mahameed 
Cc: Erez Shitrit 
Cc: Yuval Shaia 
Cc: Dennis Dalessandro 
Cc: Alaa Hleihel 
Cc: Parav Pandit 
Cc: Kees Cook 
Cc: Arseny Maslennikov 
Cc: Evgenii Smirnov 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/ulp/ipoib/ipoib.h  | 4 ++--
 drivers/infiniband/ulp/ipoib/ipoib_fs.c   | 7 +--
 drivers/infiniband/ulp/ipoib/ipoib_main.c | 4 +---
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/infiniband/ulp/ipoib/ipoib.h 
b/drivers/infiniband/ulp/ipoib/ipoib.h
index 1da119d901a9..5941d660add1 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib.h
+++ b/drivers/infiniband/ulp/ipoib/ipoib.h
@@ -781,12 +781,12 @@ static inline void ipoib_cm_handle_tx_wc(struct 
net_device *dev, struct ib_wc *w
 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
 void ipoib_create_debug_files(struct net_device *dev);
 void ipoib_delete_debug_files(struct net_device *dev);
-int ipoib_register_debugfs(void);
+void ipoib_register_debugfs(void);
 void ipoib_unregister_debugfs(void);
 #else
 static inline void ipoib_create_debug_files(struct net_device *dev) { }
 static inline void ipoib_delete_debug_files(struct net_device *dev) { }
-static inline int ipoib_register_debugfs(void) { return 0; }
+static inline void ipoib_register_debugfs(void) { }
 static inline void ipoib_unregister_debugfs(void) { }
 #endif
 
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_fs.c 
b/drivers/infiniband/ulp/ipoib/ipoib_fs.c
index 178488028734..64c19f6fa931 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_fs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_fs.c
@@ -267,14 +267,10 @@ void ipoib_create_debug_files(struct net_device *dev)
snprintf(name, sizeof(name), "%s_mcg", dev->name);
priv->mcg_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO,
   ipoib_root, dev, 
_mcg_fops);
-   if (!priv->mcg_dentry)
-   ipoib_warn(priv, "failed to create mcg debug file\n");
 
snprintf(name, sizeof(name), "%s_path", dev->name);
priv->path_dentry = debugfs_create_file(name, S_IFREG | S_IRUGO,
ipoib_root, dev, 
_path_fops);
-   if (!priv->path_dentry)
-   ipoib_warn(priv, "failed to create path debug file\n");
 }
 
 void ipoib_delete_debug_files(struct net_device *dev)
@@ -286,10 +282,9 @@ void ipoib_delete_debug_files(struct net_device *dev)
priv->mcg_dentry = priv->path_dentry = NULL;
 }
 
-int ipoib_register_debugfs(void)
+void ipoib_register_debugfs(void)
 {
ipoib_root = debugfs_create_dir("ipoib", NULL);
-   return ipoib_root ? 0 : -ENOMEM;
 }
 
 void ipoib_unregister_debugfs(void)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c 
b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index d932f99201d1..45ef3b0f03c5 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -2577,9 +2577,7 @@ static int __init ipoib_init_module(void)
 */
BUILD_BUG_ON(IPOIB_CM_COPYBREAK > IPOIB_CM_HEAD_SIZE);
 
-   ret = ipoib_register_debugfs();
-   if (ret)
-   return ret;
+   ipoib_register_debugfs();
 
/*
 * We create a global workqueue here that is used for all flush
-- 
2.20.1



[PATCH 5/8] infiniband: mlx5: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Leon Romanovsky 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/mlx5/cong.c| 15 +++-
 drivers/infiniband/hw/mlx5/main.c|  8 ++---
 drivers/infiniband/hw/mlx5/mlx5_ib.h |  8 +
 drivers/infiniband/hw/mlx5/mr.c  | 51 +---
 4 files changed, 18 insertions(+), 64 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/cong.c 
b/drivers/infiniband/hw/mlx5/cong.c
index 7e4e358a4fd8..8ba439fabf7f 100644
--- a/drivers/infiniband/hw/mlx5/cong.c
+++ b/drivers/infiniband/hw/mlx5/cong.c
@@ -389,19 +389,19 @@ void mlx5_ib_cleanup_cong_debugfs(struct mlx5_ib_dev 
*dev, u8 port_num)
dev->port[port_num].dbg_cc_params = NULL;
 }
 
-int mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u8 port_num)
+void mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u8 port_num)
 {
struct mlx5_ib_dbg_cc_params *dbg_cc_params;
struct mlx5_core_dev *mdev;
int i;
 
if (!mlx5_debugfs_root)
-   goto out;
+   return;
 
/* Takes a 1-based port number */
mdev = mlx5_ib_get_native_port_mdev(dev, port_num + 1, NULL);
if (!mdev)
-   goto out;
+   return;
 
if (!MLX5_CAP_GEN(mdev, cc_query_allowed) ||
!MLX5_CAP_GEN(mdev, cc_modify_allowed))
@@ -415,8 +415,6 @@ int mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u8 
port_num)
 
dbg_cc_params->root = debugfs_create_dir("cc_params",
 mdev->priv.dbg_root);
-   if (!dbg_cc_params->root)
-   goto err;
 
for (i = 0; i < MLX5_IB_DBG_CC_MAX; i++) {
dbg_cc_params->params[i].offset = i;
@@ -427,14 +425,11 @@ int mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u8 
port_num)
0600, dbg_cc_params->root,
_cc_params->params[i],
_cc_fops);
-   if (!dbg_cc_params->params[i].dentry)
-   goto err;
}
 
 put_mdev:
mlx5_ib_put_native_port_mdev(dev, port_num + 1);
-out:
-   return 0;
+   return;
 
 err:
mlx5_ib_warn(dev, "cong debugfs failure\n");
@@ -445,5 +440,5 @@ int mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u8 
port_num)
 * We don't want to fail driver if debugfs failed to initialize,
 * so we are not forwarding error to the user.
 */
-   return 0;
+   return;
 }
diff --git a/drivers/infiniband/hw/mlx5/main.c 
b/drivers/infiniband/hw/mlx5/main.c
index 94fe253d4956..58e9adc94984 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -5508,9 +5508,7 @@ static bool mlx5_ib_bind_slave_port(struct mlx5_ib_dev 
*ibdev,
mpi->mdev_events.notifier_call = mlx5_ib_event_slave_port;
mlx5_notifier_register(mpi->mdev, >mdev_events);
 
-   err = mlx5_ib_init_cong_debugfs(ibdev, port_num);
-   if (err)
-   goto unbind;
+   mlx5_ib_init_cong_debugfs(ibdev, port_num);
 
return true;
 
@@ -6183,8 +6181,8 @@ void mlx5_ib_stage_counters_cleanup(struct mlx5_ib_dev 
*dev)
 
 static int mlx5_ib_stage_cong_debugfs_init(struct mlx5_ib_dev *dev)
 {
-   return mlx5_ib_init_cong_debugfs(dev,
-mlx5_core_native_port_num(dev->mdev) - 
1);
+   mlx5_ib_init_cong_debugfs(dev, mlx5_core_native_port_num(dev->mdev) - 
1);
+   return 0;
 }
 
 static void mlx5_ib_stage_cong_debugfs_cleanup(struct mlx5_ib_dev *dev)
diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h 
b/drivers/infiniband/hw/mlx5/mlx5_ib.h
index b06d3b1efea8..b75afc4dd5f6 100644
--- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
+++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
@@ -623,7 +623,6 @@ struct mlx5_cache_ent {
spinlock_t  lock;
 
 
-   struct dentry  *dir;
charname[4];
u32 order;
u32 xlt;
@@ -635,11 +634,6 @@ struct mlx5_cache_ent {
u32 miss;
u32 limit;
 
-   struct dentry  *fsize;
-   struct dentry  *fcur;
-   struct dentry  *fmiss;
-   struct dentry  *flimit;
-
struct mlx5_ib_dev *dev;
struct work_struct  work;
struct delayed_work dwork;
@@ -1254,7 +1248,7 @@ __be16 mlx5_get_roce_udp_sport(struct mlx5_ib_dev *dev,
   const struct ib_gid_attr *attr);
 
 void mlx5_ib_cleanup_cong_debugfs(struct mlx5_ib_dev *dev, u8 port_num);
-int mlx5_ib_init_cong_debugfs(struct mlx5_ib_dev *dev, u8 port_num);
+void 

[PATCH 2/8] infiniband: hfi1: drop crazy DEBUGFS_SEQ_FILE_CREATE() macro

2019-01-22 Thread Greg Kroah-Hartman
The macro was just making things harder to follow, and audit, so remove
it and call debugfs_create_file() directly.  Also, the macro did not
need to warn about the call failing as no one should ever care about any
debugfs functions failing.

Cc: Mike Marciniszyn 
Cc: Dennis Dalessandro 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/hfi1/debugfs.c | 50 
 drivers/infiniband/hw/hfi1/debugfs.h | 12 ---
 drivers/infiniband/hw/hfi1/fault.c   |  3 +-
 3 files changed, 24 insertions(+), 41 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/debugfs.c 
b/drivers/infiniband/hw/hfi1/debugfs.c
index 0a557795563c..52c00c67056f 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.c
+++ b/drivers/infiniband/hw/hfi1/debugfs.c
@@ -1167,6 +1167,7 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
char link[10];
struct hfi1_devdata *dd = dd_from_dev(ibd);
struct hfi1_pportdata *ppd;
+   struct dentry *root;
int unit = dd->unit;
int i, j;
 
@@ -1174,31 +1175,26 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
return;
snprintf(name, sizeof(name), "%s_%d", class_name(), unit);
snprintf(link, sizeof(link), "%d", unit);
-   ibd->hfi1_ibdev_dbg = debugfs_create_dir(name, hfi1_dbg_root);
-   if (!ibd->hfi1_ibdev_dbg) {
-   pr_warn("create of %s failed\n", name);
-   return;
-   }
+   root = debugfs_create_dir(name, hfi1_dbg_root);
+   ibd->hfi1_ibdev_dbg = root;
+
ibd->hfi1_ibdev_link =
debugfs_create_symlink(link, hfi1_dbg_root, name);
-   if (!ibd->hfi1_ibdev_link) {
-   pr_warn("create of %s symlink failed\n", name);
-   return;
-   }
-   DEBUGFS_SEQ_FILE_CREATE(opcode_stats, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(tx_opcode_stats, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(ctx_stats, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(qp_stats, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(sdes, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(rcds, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(pios, ibd->hfi1_ibdev_dbg, ibd);
-   DEBUGFS_SEQ_FILE_CREATE(sdma_cpu_list, ibd->hfi1_ibdev_dbg, ibd);
+
+   debugfs_create_file("opcode_stats", 0444, root, ibd, 
&_opcode_stats_file_ops);
+   debugfs_create_file("tx_opcode_stats", 0444, root, ibd, 
&_tx_opcode_stats_file_ops);
+   debugfs_create_file("ctx_stats", 0444, root, ibd, &_ctx_stats_file_ops);
+   debugfs_create_file("qp_stats", 0444, root, ibd, &_qp_stats_file_ops);
+   debugfs_create_file("sdes", 0444, root, ibd, &_sdes_file_ops);
+   debugfs_create_file("rcds", 0444, root, ibd, &_rcds_file_ops);
+   debugfs_create_file("pios", 0444, root, ibd, &_pios_file_ops);
+   debugfs_create_file("sdma_cpu_list", 0444, root, ibd, 
&_sdma_cpu_list_file_ops);
+
/* dev counter files */
for (i = 0; i < ARRAY_SIZE(cntr_ops); i++)
-   DEBUGFS_FILE_CREATE(cntr_ops[i].name,
-   ibd->hfi1_ibdev_dbg,
-   dd,
-   _ops[i].ops, S_IRUGO);
+   debugfs_create_file(cntr_ops[i].name, 0444, root, dd,
+   _ops[i].ops);
+
/* per port files */
for (ppd = dd->pport, j = 0; j < dd->num_pports; j++, ppd++)
for (i = 0; i < ARRAY_SIZE(port_cntr_ops); i++) {
@@ -1206,12 +1202,10 @@ void hfi1_dbg_ibdev_init(struct hfi1_ibdev *ibd)
 sizeof(name),
 port_cntr_ops[i].name,
 j + 1);
-   DEBUGFS_FILE_CREATE(name,
-   ibd->hfi1_ibdev_dbg,
-   ppd,
-   _cntr_ops[i].ops,
+   debugfs_create_file(name,
!port_cntr_ops[i].ops.write ?
-   S_IRUGO : S_IRUGO | S_IWUSR);
+   S_IRUGO : S_IRUGO | S_IWUSR,
+   root, ppd, _cntr_ops[i].ops);
}
 
hfi1_fault_init_debugfs(ibd);
@@ -1343,8 +1337,8 @@ void hfi1_dbg_init(void)
hfi1_dbg_root  = debugfs_create_dir(DRIVER_NAME, NULL);
if (!hfi1_dbg_root)
pr_warn("init of debugfs failed\n");
-   DEBUGFS_SEQ_FILE_CREATE(driver_stats_names, hfi1_dbg_root, NULL);
-   DEBUGFS_SEQ_FILE_CREATE(driver_stats, hfi1_dbg_root, NULL);
+   debugfs_create_file("driver_stats_names", 0444, hfi1_dbg_root, NULL, 
&_driver_stats_names_file_ops);
+   debugfs_create_file("driver_stats", 0444, hfi1_dbg_root, NULL, 

[PATCH 1/8] infiniband: cxgb4: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Steve Wise 
Cc: Doug Ledford 
Cc: Jason Gunthorpe 
Cc: linux-r...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/infiniband/hw/cxgb4/device.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/device.c 
b/drivers/infiniband/hw/cxgb4/device.c
index c13c0ba30f63..9c10fff6dcfb 100644
--- a/drivers/infiniband/hw/cxgb4/device.c
+++ b/drivers/infiniband/hw/cxgb4/device.c
@@ -720,11 +720,8 @@ static const struct file_operations ep_debugfs_fops = {
.read= debugfs_read,
 };
 
-static int setup_debugfs(struct c4iw_dev *devp)
+static void setup_debugfs(struct c4iw_dev *devp)
 {
-   if (!devp->debugfs_root)
-   return -1;
-
debugfs_create_file_size("qps", S_IWUSR, devp->debugfs_root,
 (void *)devp, _debugfs_fops, 4096);
 
@@ -740,7 +737,6 @@ static int setup_debugfs(struct c4iw_dev *devp)
if (c4iw_wr_log)
debugfs_create_file_size("wr_log", S_IWUSR, devp->debugfs_root,
 (void *)devp, _log_debugfs_fops, 
4096);
-   return 0;
 }
 
 void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev,
@@ -1553,8 +1549,6 @@ static int __init c4iw_init_module(void)
return err;
 
c4iw_debugfs_root = debugfs_create_dir(DRV_NAME, NULL);
-   if (!c4iw_debugfs_root)
-   pr_warn("could not create debugfs entry, continuing\n");
 
reg_workq = create_singlethread_workqueue("Register_iWARP_device");
if (!reg_workq) {
-- 
2.20.1



Re: [PATCH] workqueue: Try to catch flush_work() without INIT_WORK().

2019-01-22 Thread Daniel Jordan
On Sat, Jan 19, 2019 at 11:41:22AM +0900, Tetsuo Handa wrote:
> On 2019/01/19 4:48, Daniel Jordan wrote:
> > On Sat, Jan 19, 2019 at 02:04:58AM +0900, Tetsuo Handa wrote:
> > __queue_work has a sanity check already for work, but using list_empty.  
> > Seems
> > slightly better to be consistent?
> > 
> 
> list_empty() won't work, for "struct work_struct" is embedded into a struct
> which is allocated by kzalloc().

Please check list_empty's definition again, it compares the address of the node
to its next pointer, so it should work for a zeroed node.  I'll reiterate that
it seems slightly better to be consistent in "is work_struct initialized?"
checks, but it's not a big deal and I'm fine either way.

> From 1bbf8d9c7aaef78d7f483d2131261162485c6f72 Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa 
> Date: Sat, 19 Jan 2019 01:38:53 +0900
> Subject: [PATCH] drm/vkms: Fix flush_work() without INIT_WORK().
> 
> syzbot is hitting a lockdep warning [1] because flush_work() is called
> without INIT_WORK() after kzalloc() at vkms_atomic_crtc_reset().
> 
> Commit 6c234fe37c57627a ("drm/vkms: Implement CRC debugfs API") added
> INIT_WORK() to only vkms_atomic_crtc_duplicate_state() side. Assuming
> that lifecycle of crc_work is appropriately managed, fix this problem
> by adding INIT_WORK() to vkms_atomic_crtc_reset() side.
> 
> [1] 
> https://syzkaller.appspot.com/bug?id=a5954455fcfa51c29ca2ab55b203076337e1c770
> 
> Reported-and-tested-by: syzbot 
> 
> Signed-off-by: Tetsuo Handa 
> ---
>  drivers/gpu/drm/vkms/vkms_crtc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/gpu/drm/vkms/vkms_crtc.c 
> b/drivers/gpu/drm/vkms/vkms_crtc.c
> index 177bbcb..3c37d8c 100644
> --- a/drivers/gpu/drm/vkms/vkms_crtc.c
> +++ b/drivers/gpu/drm/vkms/vkms_crtc.c
> @@ -104,6 +104,7 @@ static void vkms_atomic_crtc_reset(struct drm_crtc *crtc)
>   vkms_state = kzalloc(sizeof(*vkms_state), GFP_KERNEL);
>   if (!vkms_state)
>   return;
> + INIT_WORK(_state->crc_work, vkms_crc_work_handle);
>  
>   crtc->state = _state->base;
>   crtc->state->crtc = crtc;

Great, thanks, I think mentioning this path would improve the changelog.


[PATCH 0/8] IB: cleanup debugfs usage

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not.  Fix up a bunch of infiniband-specific code to not care
about the results of debugfs.

Greg Kroah-Hartman (8):
  infiniband: cxgb4: no need to check return value of debugfs_create functions
  infiniband: hfi1: drop crazy DEBUGFS_SEQ_FILE_CREATE() macro
  infiniband: hfi1: no need to check return value of debugfs_create functions
  infiniband: qib: no need to check return value of debugfs_create functions
  infiniband: mlx5: no need to check return value of debugfs_create functions
  infiniband: ocrdma: no need to check return value of debugfs_create functions
  infiniband: usnic: no need to check return value of debugfs_create functions
  infiniband: ipoib: no need to check return value of debugfs_create functions

 drivers/infiniband/hw/cxgb4/device.c|  8 +--
 drivers/infiniband/hw/hfi1/debugfs.c| 52 +++-
 drivers/infiniband/hw/hfi1/debugfs.h| 12 
 drivers/infiniband/hw/hfi1/fault.c  | 53 ++--
 drivers/infiniband/hw/mlx5/cong.c   | 15 ++---
 drivers/infiniband/hw/mlx5/main.c   |  8 +--
 drivers/infiniband/hw/mlx5/mlx5_ib.h|  8 +--
 drivers/infiniband/hw/mlx5/mr.c | 51 +++-
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c | 67 +++--
 drivers/infiniband/hw/qib/qib_debugfs.c | 26 +++-
 drivers/infiniband/hw/usnic/usnic_debugfs.c | 26 
 drivers/infiniband/ulp/ipoib/ipoib.h|  4 +-
 drivers/infiniband/ulp/ipoib/ipoib_fs.c |  7 +--
 drivers/infiniband/ulp/ipoib/ipoib_main.c   |  4 +-
 14 files changed, 94 insertions(+), 247 deletions(-)

-- 
2.20.1



[PATCH 3/7] crypto: axis: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Jesper Nilsson 
Cc: Lars Persson 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-arm-ker...@axis.com
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/axis/artpec6_crypto.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/crypto/axis/artpec6_crypto.c 
b/drivers/crypto/axis/artpec6_crypto.c
index f3442c2bdbdc..1a1858cea979 100644
--- a/drivers/crypto/axis/artpec6_crypto.c
+++ b/drivers/crypto/axis/artpec6_crypto.c
@@ -2984,12 +2984,6 @@ static void artpec6_crypto_init_debugfs(void)
 {
dbgfs_root = debugfs_create_dir("artpec6_crypto", NULL);
 
-   if (!dbgfs_root || IS_ERR(dbgfs_root)) {
-   dbgfs_root = NULL;
-   pr_err("%s: Could not initialise debugfs!\n", MODULE_NAME);
-   return;
-   }
-
 #ifdef CONFIG_FAULT_INJECTION
fault_create_debugfs_attr("fail_status_read", dbgfs_root,
  _crypto_fail_status_read);
@@ -3001,9 +2995,6 @@ static void artpec6_crypto_init_debugfs(void)
 
 static void artpec6_crypto_free_debugfs(void)
 {
-   if (!dbgfs_root)
-   return;
-
debugfs_remove_recursive(dbgfs_root);
dbgfs_root = NULL;
 }
-- 
2.20.1



[PATCH 0/7] crypto: cleanup debugfs usage

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not.  Fix up a bunch of crypto-specific code to not care
about the results of debugfs.

Greg Kroah-Hartman (7):
  crypto: qat: no need to check return value of debugfs_create functions
  crypto: ccrree: no need to check return value of debugfs_create
functions
  crypto: axis: no need to check return value of debugfs_create
functions
  crypto: cavium: zip: no need to check return value of debugfs_create
functions
  crypto: cavium: nitrox: no need to check return value of
debugfs_create functions
  crypto: ccp: no need to check return value of debugfs_create functions
  crypto: caam: no need to check return value of debugfs_create
functions

 drivers/crypto/axis/artpec6_crypto.c  |  9 
 drivers/crypto/caam/ctrl.c| 21 +++-
 drivers/crypto/caam/intern.h  |  1 -
 drivers/crypto/cavium/nitrox/nitrox_debugfs.c | 27 ++
 drivers/crypto/cavium/nitrox/nitrox_debugfs.h |  5 +-
 drivers/crypto/cavium/nitrox/nitrox_main.c|  4 +-
 drivers/crypto/cavium/zip/zip_main.c  | 52 ---
 drivers/crypto/ccp/ccp-debugfs.c  | 36 +++--
 drivers/crypto/ccree/cc_debugfs.c | 22 ++--
 drivers/crypto/ccree/cc_debugfs.h |  8 +--
 drivers/crypto/ccree/cc_driver.c  |  7 +--
 drivers/crypto/qat/qat_c3xxx/adf_drv.c|  5 --
 drivers/crypto/qat/qat_c3xxxvf/adf_drv.c  |  5 --
 drivers/crypto/qat/qat_c62x/adf_drv.c |  5 --
 drivers/crypto/qat/qat_c62xvf/adf_drv.c   |  5 --
 drivers/crypto/qat/qat_common/adf_cfg.c   |  7 ---
 drivers/crypto/qat/qat_common/adf_transport.c |  6 ---
 .../qat/qat_common/adf_transport_debug.c  | 15 --
 drivers/crypto/qat/qat_dh895xcc/adf_drv.c |  5 --
 drivers/crypto/qat/qat_dh895xccvf/adf_drv.c   |  5 --
 20 files changed, 38 insertions(+), 212 deletions(-)

-- 
2.20.1



[PATCH 6/7] crypto: ccp: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Tom Lendacky 
Cc: Gary Hook 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/ccp/ccp-debugfs.c | 36 +++-
 1 file changed, 7 insertions(+), 29 deletions(-)

diff --git a/drivers/crypto/ccp/ccp-debugfs.c b/drivers/crypto/ccp/ccp-debugfs.c
index 1a734bd2070a..4bd26af7098d 100644
--- a/drivers/crypto/ccp/ccp-debugfs.c
+++ b/drivers/crypto/ccp/ccp-debugfs.c
@@ -286,10 +286,7 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
 {
struct ccp_cmd_queue *cmd_q;
char name[MAX_NAME_LEN + 1];
-   struct dentry *debugfs_info;
-   struct dentry *debugfs_stats;
struct dentry *debugfs_q_instance;
-   struct dentry *debugfs_q_stats;
int i;
 
if (!debugfs_initialized())
@@ -299,24 +296,14 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
if (!ccp_debugfs_dir)
ccp_debugfs_dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
mutex_unlock(_debugfs_lock);
-   if (!ccp_debugfs_dir)
-   return;
 
ccp->debugfs_instance = debugfs_create_dir(ccp->name, ccp_debugfs_dir);
-   if (!ccp->debugfs_instance)
-   goto err;
 
-   debugfs_info = debugfs_create_file("info", 0400,
-  ccp->debugfs_instance, ccp,
-  _debugfs_info_ops);
-   if (!debugfs_info)
-   goto err;
+   debugfs_create_file("info", 0400, ccp->debugfs_instance, ccp,
+   _debugfs_info_ops);
 
-   debugfs_stats = debugfs_create_file("stats", 0600,
-   ccp->debugfs_instance, ccp,
-   _debugfs_stats_ops);
-   if (!debugfs_stats)
-   goto err;
+   debugfs_create_file("stats", 0600, ccp->debugfs_instance, ccp,
+   _debugfs_stats_ops);
 
for (i = 0; i < ccp->cmd_q_count; i++) {
cmd_q = >cmd_q[i];
@@ -325,21 +312,12 @@ void ccp5_debugfs_setup(struct ccp_device *ccp)
 
debugfs_q_instance =
debugfs_create_dir(name, ccp->debugfs_instance);
-   if (!debugfs_q_instance)
-   goto err;
-
-   debugfs_q_stats =
-   debugfs_create_file("stats", 0600,
-   debugfs_q_instance, cmd_q,
-   _debugfs_queue_ops);
-   if (!debugfs_q_stats)
-   goto err;
+
+   debugfs_create_file("stats", 0600, debugfs_q_instance, cmd_q,
+   _debugfs_queue_ops);
}
 
return;
-
-err:
-   debugfs_remove_recursive(ccp->debugfs_instance);
 }
 
 void ccp5_debugfs_destroy(void)
-- 
2.20.1



[PATCH 2/7] crypto: ccrree: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Yael Chemla 
Cc: Gilad Ben-Yossef 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/ccree/cc_debugfs.c | 22 +++---
 drivers/crypto/ccree/cc_debugfs.h |  8 ++--
 drivers/crypto/ccree/cc_driver.c  |  7 +--
 3 files changed, 6 insertions(+), 31 deletions(-)

diff --git a/drivers/crypto/ccree/cc_debugfs.c 
b/drivers/crypto/ccree/cc_debugfs.c
index 5ca184e42483..5fa05a7bcf36 100644
--- a/drivers/crypto/ccree/cc_debugfs.c
+++ b/drivers/crypto/ccree/cc_debugfs.c
@@ -39,11 +39,9 @@ static struct debugfs_reg32 debug_regs[] = {
CC_DEBUG_REG(AXIM_MON_COMP),
 };
 
-int __init cc_debugfs_global_init(void)
+void __init cc_debugfs_global_init(void)
 {
cc_debugfs_dir = debugfs_create_dir("ccree", NULL);
-
-   return !cc_debugfs_dir;
 }
 
 void __exit cc_debugfs_global_fini(void)
@@ -56,7 +54,6 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
struct device *dev = drvdata_to_dev(drvdata);
struct cc_debugfs_ctx *ctx;
struct debugfs_regset32 *regset;
-   struct dentry *file;
 
debug_regs[0].offset = drvdata->sig_offset;
debug_regs[1].offset = drvdata->ver_offset;
@@ -74,22 +71,9 @@ int cc_debugfs_init(struct cc_drvdata *drvdata)
regset->base = drvdata->cc_base;
 
ctx->dir = debugfs_create_dir(drvdata->plat_dev->name, cc_debugfs_dir);
-   if (!ctx->dir)
-   return -ENFILE;
-
-   file = debugfs_create_regset32("regs", 0400, ctx->dir, regset);
-   if (!file) {
-   debugfs_remove(ctx->dir);
-   return -ENFILE;
-   }
 
-   file = debugfs_create_bool("coherent", 0400, ctx->dir,
-  >coherent);
-
-   if (!file) {
-   debugfs_remove_recursive(ctx->dir);
-   return -ENFILE;
-   }
+   debugfs_create_regset32("regs", 0400, ctx->dir, regset);
+   debugfs_create_bool("coherent", 0400, ctx->dir, >coherent);
 
drvdata->debugfs = ctx;
 
diff --git a/drivers/crypto/ccree/cc_debugfs.h 
b/drivers/crypto/ccree/cc_debugfs.h
index 5b5320eca7d2..01cbd9a95659 100644
--- a/drivers/crypto/ccree/cc_debugfs.h
+++ b/drivers/crypto/ccree/cc_debugfs.h
@@ -5,7 +5,7 @@
 #define __CC_DEBUGFS_H__
 
 #ifdef CONFIG_DEBUG_FS
-int cc_debugfs_global_init(void);
+void cc_debugfs_global_init(void);
 void cc_debugfs_global_fini(void);
 
 int cc_debugfs_init(struct cc_drvdata *drvdata);
@@ -13,11 +13,7 @@ void cc_debugfs_fini(struct cc_drvdata *drvdata);
 
 #else
 
-static inline int cc_debugfs_global_init(void)
-{
-   return 0;
-}
-
+static inline void cc_debugfs_global_init(void) {}
 static inline void cc_debugfs_global_fini(void) {}
 
 static inline int cc_debugfs_init(struct cc_drvdata *drvdata)
diff --git a/drivers/crypto/ccree/cc_driver.c b/drivers/crypto/ccree/cc_driver.c
index 8ada308d72ee..662738e53ced 100644
--- a/drivers/crypto/ccree/cc_driver.c
+++ b/drivers/crypto/ccree/cc_driver.c
@@ -538,13 +538,8 @@ static struct platform_driver ccree_driver = {
 
 static int __init ccree_init(void)
 {
-   int ret;
-
cc_hash_global_init();
-
-   ret = cc_debugfs_global_init();
-   if (ret)
-   return ret;
+   cc_debugfs_global_init();
 
return platform_driver_register(_driver);
 }
-- 
2.20.1



[PATCH 5/7] crypto: cavium: nitrox: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: Srikanth Jampala 
Cc: Yangtao Li 
Cc: Gadam Sreerama 
Cc: Eric Biggers 
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/cavium/nitrox/nitrox_debugfs.c | 27 ---
 drivers/crypto/cavium/nitrox/nitrox_debugfs.h |  5 ++--
 drivers/crypto/cavium/nitrox/nitrox_main.c|  4 +--
 3 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/drivers/crypto/cavium/nitrox/nitrox_debugfs.c 
b/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
index 0196b992280f..848ec93d4333 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_debugfs.c
@@ -55,31 +55,14 @@ void nitrox_debugfs_exit(struct nitrox_device *ndev)
ndev->debugfs_dir = NULL;
 }
 
-int nitrox_debugfs_init(struct nitrox_device *ndev)
+void nitrox_debugfs_init(struct nitrox_device *ndev)
 {
-   struct dentry *dir, *f;
+   struct dentry *dir;
 
dir = debugfs_create_dir(KBUILD_MODNAME, NULL);
-   if (!dir)
-   return -ENOMEM;
 
ndev->debugfs_dir = dir;
-   f = debugfs_create_file("firmware", 0400, dir, ndev,
-   _fops);
-   if (!f)
-   goto err;
-   f = debugfs_create_file("device", 0400, dir, ndev,
-   _fops);
-   if (!f)
-   goto err;
-   f = debugfs_create_file("stats", 0400, dir, ndev,
-   _fops);
-   if (!f)
-   goto err;
-
-   return 0;
-
-err:
-   nitrox_debugfs_exit(ndev);
-   return -ENODEV;
+   debugfs_create_file("firmware", 0400, dir, ndev, _fops);
+   debugfs_create_file("device", 0400, dir, ndev, _fops);
+   debugfs_create_file("stats", 0400, dir, ndev, _fops);
 }
diff --git a/drivers/crypto/cavium/nitrox/nitrox_debugfs.h 
b/drivers/crypto/cavium/nitrox/nitrox_debugfs.h
index a8d85ffa619c..f177b79bbab0 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_debugfs.h
+++ b/drivers/crypto/cavium/nitrox/nitrox_debugfs.h
@@ -5,12 +5,11 @@
 #include "nitrox_dev.h"
 
 #ifdef CONFIG_DEBUG_FS
-int nitrox_debugfs_init(struct nitrox_device *ndev);
+void nitrox_debugfs_init(struct nitrox_device *ndev);
 void nitrox_debugfs_exit(struct nitrox_device *ndev);
 #else
-static inline int nitrox_debugfs_init(struct nitrox_device *ndev)
+static inline void nitrox_debugfs_init(struct nitrox_device *ndev)
 {
-   return 0;
 }
 
 static inline void nitrox_debugfs_exit(struct nitrox_device *ndev)
diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c 
b/drivers/crypto/cavium/nitrox/nitrox_main.c
index 014e9863c20e..faa78f651238 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_main.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
@@ -404,9 +404,7 @@ static int nitrox_probe(struct pci_dev *pdev,
if (err)
goto pf_hw_fail;
 
-   err = nitrox_debugfs_init(ndev);
-   if (err)
-   goto pf_hw_fail;
+   nitrox_debugfs_init(ndev);
 
/* clear the statistics */
atomic64_set(>stats.posted, 0);
-- 
2.20.1



Re: [PATCH v6 07/16] sched/core: uclamp: Add system default clamps

2019-01-22 Thread Peter Zijlstra
On Tue, Jan 22, 2019 at 02:43:29PM +, Patrick Bellasi wrote:
> On 22-Jan 14:56, Peter Zijlstra wrote:
> > On Tue, Jan 15, 2019 at 10:15:04AM +, Patrick Bellasi wrote:
> > 
> > > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > > index 84294925d006..c8f391d1cdc5 100644
> > > --- a/include/linux/sched.h
> > > +++ b/include/linux/sched.h
> > > @@ -625,6 +625,11 @@ struct uclamp_se {
> > >   unsigned int bucket_id  : bits_per(UCLAMP_BUCKETS);
> > >   unsigned int mapped : 1;
> > >   unsigned int active : 1;
> > > + /* Clamp bucket and value actually used by a RUNNABLE task */
> > > + struct {
> > > + unsigned int value  : bits_per(SCHED_CAPACITY_SCALE);
> > > + unsigned int bucket_id  : bits_per(UCLAMP_BUCKETS);
> > > + } effective;
> > 
> > I am confuzled by this thing..  so uclamp_se already has a value,bucket,
> > which per the prior code is the effective one.
> > 
> > Now; I think I see why you want another value; you need the second to
> > store the original value for when the system limits change and we must
> > re-evaluate.
> 
> Yes, that's one reason, the other one being to properly support
> CGroup when we add them in the following patches.
> 
> Effective will always track the value/bucket in which the task has
> been refcounted at enqueue time and it depends on the aggregated
> value.

> > Should you not update all tasks?
> 
> That's true, but that's also an expensive operation, that's why now
> I'm doing only lazy updates at next enqueue time.

Aaah, so you refcount on the original value, which allows you to skip
fixing up all tasks. I missed that bit.


> Do you think that could be acceptable?

Think so, it's a sysctl poke, 'nobody' ever does that.


[PATCH 2/4] tty: sisusb_con, cleanup configs

2019-01-22 Thread Jiri Slaby
There are two macros defined:
1) ifdef CONFIG_COMPAT => define SISUSB_NEW_CONFIG_COMPAT
2) ifdef CONFIG_USB_SISUSBVGA_CON => define INCL_SISUSB_CON

Remove the latter and make use only of the former. This removes one
layer of obfuscation.

Signed-off-by: Jiri Slaby 
---
 drivers/usb/misc/sisusbvga/sisusb.c  | 32 
 drivers/usb/misc/sisusbvga/sisusb.h  | 15 +--
 drivers/usb/misc/sisusbvga/sisusb_con.c  |  2 +-
 drivers/usb/misc/sisusbvga/sisusb_init.c |  4 +--
 4 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb.c 
b/drivers/usb/misc/sisusbvga/sisusb.c
index 3198d0477cf8..9560fde621ee 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -53,7 +53,7 @@
 #include "sisusb.h"
 #include "sisusb_init.h"
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
 #include 
 #endif
 
@@ -61,7 +61,7 @@
 
 /* Forward declarations / clean-up routines */
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
 static int sisusb_first_vc;
 static int sisusb_last_vc;
 module_param_named(first, sisusb_first_vc, int, 0);
@@ -1198,7 +1198,7 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data 
*sisusb, u32 addr,
 
 /* High level: Gfx (indexed) register access */
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
 int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data)
 {
return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data);
@@ -1272,7 +1272,7 @@ int sisusb_setidxregand(struct sisusb_usb_data *sisusb, 
int port,
 
 /* Write/read video ram */
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
 int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data)
 {
return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data);
@@ -2255,7 +2255,7 @@ static int sisusb_init_gfxdevice(struct sisusb_usb_data 
*sisusb, int initscreen)
 }
 
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
 
 /* Set up default text mode:
  * - Set text mode (0x03)
@@ -2448,7 +2448,7 @@ void sisusb_delete(struct kref *kref)
sisusb->sisusb_dev = NULL;
sisusb_free_buffers(sisusb);
sisusb_free_urbs(sisusb);
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
kfree(sisusb->SiS_Pr);
 #endif
kfree(sisusb);
@@ -2844,7 +2844,7 @@ static int sisusb_handle_command(struct sisusb_usb_data 
*sisusb,
 
case SUCMD_HANDLETEXTMODE:
retval = 0;
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
/* Gfx core must be initialized, SiS_Pr must exist */
if (!sisusb->gfxinit || !sisusb->SiS_Pr)
return -ENODEV;
@@ -2860,7 +2860,7 @@ static int sisusb_handle_command(struct sisusb_usb_data 
*sisusb,
 #endif
break;
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
case SUCMD_SETMODE:
/* Gfx core must be initialized, SiS_Pr must exist */
if (!sisusb->gfxinit || !sisusb->SiS_Pr)
@@ -2944,7 +2944,7 @@ static long sisusb_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
x.sisusb_vramsize = sisusb->vramsize;
x.sisusb_minor = sisusb->minor;
x.sisusb_fbdevactive = 0;
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
x.sisusb_conactive  = sisusb->haveconsole ? 1 : 0;
 #else
x.sisusb_conactive  = 0;
@@ -2975,7 +2975,7 @@ static long sisusb_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
return retval;
 }
 
-#ifdef SISUSB_NEW_CONFIG_COMPAT
+#ifdef CONFIG_COMPAT
 static long sisusb_compat_ioctl(struct file *f, unsigned int cmd,
unsigned long arg)
 {
@@ -2998,7 +2998,7 @@ static const struct file_operations usb_sisusb_fops = {
.read = sisusb_read,
.write =sisusb_write,
.llseek =   sisusb_lseek,
-#ifdef SISUSB_NEW_CONFIG_COMPAT
+#ifdef CONFIG_COMPAT
.compat_ioctl = sisusb_compat_ioctl,
 #endif
.unlocked_ioctl = sisusb_ioctl
@@ -3091,7 +3091,7 @@ static int sisusb_probe(struct usb_interface *intf,
dev_info(>sisusb_dev->dev, "Allocated %d output buffers\n",
sisusb->numobufs);
 
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
/* Allocate our SiS_Pr */
sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL);
if (!sisusb->SiS_Pr) {
@@ -3112,7 +3112,7 @@ static int sisusb_probe(struct usb_interface *intf,
 
if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) {
int initscreen = 1;
-#ifdef INCL_SISUSB_CON
+#ifdef CONFIG_USB_SISUSBVGA_CON
if (sisusb_first_vc > 0 && sisusb_last_vc > 0 &&
sisusb_first_vc <= sisusb_last_vc &&
sisusb_last_vc <= MAX_NR_CONSOLES)
@@ -3134,7 +3134,7 @@ static int sisusb_probe(struct 

[PATCH 4/7] crypto: cavium: zip: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: Robert Richter 
Cc: Jan Glauber 
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/cavium/zip/zip_main.c | 52 ++--
 1 file changed, 11 insertions(+), 41 deletions(-)

diff --git a/drivers/crypto/cavium/zip/zip_main.c 
b/drivers/crypto/cavium/zip/zip_main.c
index be055b9547f6..e6b09e784e66 100644
--- a/drivers/crypto/cavium/zip/zip_main.c
+++ b/drivers/crypto/cavium/zip/zip_main.c
@@ -618,41 +618,23 @@ static const struct file_operations zip_regs_fops = {
 /* Root directory for thunderx_zip debugfs entry */
 static struct dentry *zip_debugfs_root;
 
-static int __init zip_debugfs_init(void)
+static void __init zip_debugfs_init(void)
 {
-   struct dentry *zip_stats, *zip_clear, *zip_regs;
-
if (!debugfs_initialized())
-   return -ENODEV;
+   return;
 
zip_debugfs_root = debugfs_create_dir("thunderx_zip", NULL);
-   if (!zip_debugfs_root)
-   return -ENOMEM;
 
/* Creating files for entries inside thunderx_zip directory */
-   zip_stats = debugfs_create_file("zip_stats", 0444,
-   zip_debugfs_root,
-   NULL, _stats_fops);
-   if (!zip_stats)
-   goto failed_to_create;
-
-   zip_clear = debugfs_create_file("zip_clear", 0444,
-   zip_debugfs_root,
-   NULL, _clear_fops);
-   if (!zip_clear)
-   goto failed_to_create;
-
-   zip_regs = debugfs_create_file("zip_regs", 0444,
-  zip_debugfs_root,
-  NULL, _regs_fops);
-   if (!zip_regs)
-   goto failed_to_create;
+   debugfs_create_file("zip_stats", 0444, zip_debugfs_root, NULL,
+   _stats_fops);
 
-   return 0;
+   debugfs_create_file("zip_clear", 0444, zip_debugfs_root, NULL,
+   _clear_fops);
+
+   debugfs_create_file("zip_regs", 0444, zip_debugfs_root, NULL,
+   _regs_fops);
 
-failed_to_create:
-   debugfs_remove_recursive(zip_debugfs_root);
-   return -ENOENT;
 }
 
 static void __exit zip_debugfs_exit(void)
@@ -661,13 +643,8 @@ static void __exit zip_debugfs_exit(void)
 }
 
 #else
-static int __init zip_debugfs_init(void)
-{
-   return 0;
-}
-
+static void __init zip_debugfs_init(void) { }
 static void __exit zip_debugfs_exit(void) { }
-
 #endif
 /* debugfs - end */
 
@@ -691,17 +668,10 @@ static int __init zip_init_module(void)
}
 
/* comp-decomp statistics are handled with debugfs interface */
-   ret = zip_debugfs_init();
-   if (ret < 0) {
-   zip_err("ZIP: debugfs initialization failed\n");
-   goto err_crypto_unregister;
-   }
+   zip_debugfs_init();
 
return ret;
 
-err_crypto_unregister:
-   zip_unregister_compression_device();
-
 err_pci_unregister:
pci_unregister_driver(_driver);
return ret;
-- 
2.20.1



[PATCH 7/7] crypto: caam: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: "Horia Geantă" 
Cc: Aymen Sghaier 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/caam/ctrl.c   | 21 ++---
 drivers/crypto/caam/intern.h |  1 -
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index 16bbc72f041a..87c13fb6028c 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -863,27 +863,18 @@ static int caam_probe(struct platform_device *pdev)
/* Internal covering keys (useful in non-secure mode only) */
ctrlpriv->ctl_kek_wrap.data = (__force void *)>ctrl->kek[0];
ctrlpriv->ctl_kek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
-   ctrlpriv->ctl_kek = debugfs_create_blob("kek",
-   S_IRUSR |
-   S_IRGRP | S_IROTH,
-   ctrlpriv->ctl,
-   >ctl_kek_wrap);
+   debugfs_create_blob("kek", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
+   >ctl_kek_wrap);
 
ctrlpriv->ctl_tkek_wrap.data = (__force void *)>ctrl->tkek[0];
ctrlpriv->ctl_tkek_wrap.size = KEK_KEY_SIZE * sizeof(u32);
-   ctrlpriv->ctl_tkek = debugfs_create_blob("tkek",
-S_IRUSR |
-S_IRGRP | S_IROTH,
-ctrlpriv->ctl,
->ctl_tkek_wrap);
+   debugfs_create_blob("tkek", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
+   >ctl_tkek_wrap);
 
ctrlpriv->ctl_tdsk_wrap.data = (__force void *)>ctrl->tdsk[0];
ctrlpriv->ctl_tdsk_wrap.size = KEK_KEY_SIZE * sizeof(u32);
-   ctrlpriv->ctl_tdsk = debugfs_create_blob("tdsk",
-S_IRUSR |
-S_IRGRP | S_IROTH,
-ctrlpriv->ctl,
->ctl_tdsk_wrap);
+   debugfs_create_blob("tdsk", S_IRUSR | S_IRGRP | S_IROTH, ctrlpriv->ctl,
+   >ctl_tdsk_wrap);
 #endif
return 0;
 
diff --git a/drivers/crypto/caam/intern.h b/drivers/crypto/caam/intern.h
index babc78abd155..5869ad58d497 100644
--- a/drivers/crypto/caam/intern.h
+++ b/drivers/crypto/caam/intern.h
@@ -106,7 +106,6 @@ struct caam_drv_private {
struct dentry *dfs_root;
struct dentry *ctl; /* controller dir */
struct debugfs_blob_wrapper ctl_kek_wrap, ctl_tkek_wrap, ctl_tdsk_wrap;
-   struct dentry *ctl_kek, *ctl_tkek, *ctl_tdsk;
 #endif
 };
 
-- 
2.20.1



[PATCH 1/7] crypto: qat: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Giovanni Cabiddu 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: Conor McLoughlin 
Cc: Waiman Long 
Cc: qat-li...@intel.com
Cc: linux-cry...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/crypto/qat/qat_c3xxx/adf_drv.c|  5 -
 drivers/crypto/qat/qat_c3xxxvf/adf_drv.c  |  5 -
 drivers/crypto/qat/qat_c62x/adf_drv.c |  5 -
 drivers/crypto/qat/qat_c62xvf/adf_drv.c   |  5 -
 drivers/crypto/qat/qat_common/adf_cfg.c   |  7 ---
 drivers/crypto/qat/qat_common/adf_transport.c |  6 --
 .../crypto/qat/qat_common/adf_transport_debug.c   | 15 ---
 drivers/crypto/qat/qat_dh895xcc/adf_drv.c |  5 -
 drivers/crypto/qat/qat_dh895xccvf/adf_drv.c   |  5 -
 9 files changed, 58 deletions(-)

diff --git a/drivers/crypto/qat/qat_c3xxx/adf_drv.c 
b/drivers/crypto/qat/qat_c3xxx/adf_drv.c
index 763c2166ee0e..d937cc7248a5 100644
--- a/drivers/crypto/qat/qat_c3xxx/adf_drv.c
+++ b/drivers/crypto/qat/qat_c3xxx/adf_drv.c
@@ -193,11 +193,6 @@ static int adf_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 PCI_FUNC(pdev->devfn));
 
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
-   if (!accel_dev->debugfs_dir) {
-   dev_err(>dev, "Could not create debugfs dir %s\n", name);
-   ret = -EINVAL;
-   goto out_err;
-   }
 
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c 
b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
index 613c7d5644ce..1dc5ac859f7b 100644
--- a/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
+++ b/drivers/crypto/qat/qat_c3xxxvf/adf_drv.c
@@ -177,11 +177,6 @@ static int adf_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 PCI_FUNC(pdev->devfn));
 
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
-   if (!accel_dev->debugfs_dir) {
-   dev_err(>dev, "Could not create debugfs dir %s\n", name);
-   ret = -EINVAL;
-   goto out_err;
-   }
 
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_c62x/adf_drv.c 
b/drivers/crypto/qat/qat_c62x/adf_drv.c
index 9cb832963357..2bc06c89d2fe 100644
--- a/drivers/crypto/qat/qat_c62x/adf_drv.c
+++ b/drivers/crypto/qat/qat_c62x/adf_drv.c
@@ -193,11 +193,6 @@ static int adf_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 PCI_FUNC(pdev->devfn));
 
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
-   if (!accel_dev->debugfs_dir) {
-   dev_err(>dev, "Could not create debugfs dir %s\n", name);
-   ret = -EINVAL;
-   goto out_err;
-   }
 
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_c62xvf/adf_drv.c 
b/drivers/crypto/qat/qat_c62xvf/adf_drv.c
index 278452b8ef81..a68358b31292 100644
--- a/drivers/crypto/qat/qat_c62xvf/adf_drv.c
+++ b/drivers/crypto/qat/qat_c62xvf/adf_drv.c
@@ -177,11 +177,6 @@ static int adf_probe(struct pci_dev *pdev, const struct 
pci_device_id *ent)
 PCI_FUNC(pdev->devfn));
 
accel_dev->debugfs_dir = debugfs_create_dir(name, NULL);
-   if (!accel_dev->debugfs_dir) {
-   dev_err(>dev, "Could not create debugfs dir %s\n", name);
-   ret = -EINVAL;
-   goto out_err;
-   }
 
/* Create device configuration table */
ret = adf_cfg_dev_add(accel_dev);
diff --git a/drivers/crypto/qat/qat_common/adf_cfg.c 
b/drivers/crypto/qat/qat_common/adf_cfg.c
index d0879790561f..5c7fdb0fc53d 100644
--- a/drivers/crypto/qat/qat_common/adf_cfg.c
+++ b/drivers/crypto/qat/qat_common/adf_cfg.c
@@ -141,13 +141,6 @@ int adf_cfg_dev_add(struct adf_accel_dev *accel_dev)
  accel_dev->debugfs_dir,
  dev_cfg_data,
  _dev_cfg_fops);
-   if (!dev_cfg_data->debug) {
-   dev_err(_DEV(accel_dev),
-   "Failed to create qat cfg debugfs entry.\n");
-   kfree(dev_cfg_data);
-   accel_dev->cfg = NULL;
-   return -EFAULT;
-   }
return 0;
 }
 EXPORT_SYMBOL_GPL(adf_cfg_dev_add);
diff --git a/drivers/crypto/qat/qat_common/adf_transport.c 
b/drivers/crypto/qat/qat_common/adf_transport.c
index 57d2622728a5..ac658ce46836 100644
--- a/drivers/crypto/qat/qat_common/adf_transport.c
+++ b/drivers/crypto/qat/qat_common/adf_transport.c
@@ -486,12 +486,6 @@ int adf_init_etr_data(struct adf_accel_dev *accel_dev)
/* 

Re: [PATCH v6 1/2] PM-runtime: update accounting_timestamp only when enable

2019-01-22 Thread Rafael J. Wysocki
On Tue, Jan 22, 2019 at 3:24 PM Vincent Guittot
 wrote:
>
> Initializing accounting_timestamp to something different from 0 during
> pm_runtime_init() doesn't make sense and put useless ordering constraint 
> between
> timekeeping_init() and pm_runtime_init().
> PM runtime should start accounting time only when it is enable and discard
> the period when disabled.
> Set accounting_timestamp to now when enabling PM runtime.
>
> Suggested-by: "Rafael J. Wysocki" 
> Signed-off-by: Vincent Guittot 
> ---
>  drivers/base/power/runtime.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
> index fb5e2b6..7df1d05 100644
> --- a/drivers/base/power/runtime.c
> +++ b/drivers/base/power/runtime.c
> @@ -1306,6 +1306,10 @@ void pm_runtime_enable(struct device *dev)
>
> spin_lock_irqsave(>power.lock, flags);
>
> +   /* About to enable runtime pm, set accounting_timestamp to now */
> +   if (dev->power.disable_depth == 1)
> +   dev->power.accounting_timestamp = jiffies;

I would do this in the dev->power.disable_depth > 0 branch below.
Just check if disable_depth is zero after decrementing it and update
accounting_timestamp if so.

> +
> if (dev->power.disable_depth > 0)
> dev->power.disable_depth--;
> else
> @@ -1506,7 +1510,7 @@ void pm_runtime_init(struct device *dev)
> dev->power.request_pending = false;
> dev->power.request = RPM_REQ_NONE;
> dev->power.deferred_resume = false;
> -   dev->power.accounting_timestamp = jiffies;
> +   dev->power.accounting_timestamp = 0;
> INIT_WORK(>power.work, pm_runtime_work);
>
> dev->power.timer_expires = 0;
> --
> 2.7.4
>


Re: [PATCH v6 11/16] sched/fair: Add uclamp support to energy_compute()

2019-01-22 Thread Quentin Perret
On Tuesday 22 Jan 2019 at 15:01:37 (+), Patrick Bellasi wrote:
> > I'm not saying it's useful, I'm saying userspace can decide to do that
> > if it thinks it is a good idea. The default should be min_cap = 1024 for
> > RT, no questions. But you _can_ change it at runtime if you want to.
> > That's my point. And doing that basically provides the same behaviour as
> > what we have right now in terms of EAS calculation (but it changes the
> > freq selection obviously) which is why I'm not fundamentally opposed to
> > your patch.
> 
> Well, I think it's tricky to say whether the current or new approach
> is better... it probably depends on the use-case.

Agreed.

> > So in short, I'm fine with the behavioural change, but please at least
> > mention it somewhere :-)
> 
> Anyway... agree, it's just that to add some documentation I need to
> get what you are pointing out ;)
> 
> Will come up with some additional text to be added to the changelog

Sounds good.

> Maybe we can add a more detailed explanation of the different
> behaviors you can get in the EAS documentation which is coming to
> mainline ?

Yeah, if you feel like it, I guess that won't hurt :-)

Thanks,
Quentin


Re: [PATCH v3 1/2] media: imx: csi: Disable SMFC before disabling IDMA channel

2019-01-22 Thread Gaël PORTAY
Philipp,

On Mon, Jan 21, 2019 at 12:49:10PM +0100, Philipp Zabel wrote:
> Hi,
> 
> On Fri, 2019-01-18 at 17:04 -0800, Steve Longerbeam wrote:
> > Disable the SMFC before disabling the IDMA channel, instead of after,
> > in csi_idmac_unsetup().
> > 
> > This fixes a complete system hard lockup on the SabreAuto when streaming
> > from the ADV7180, by repeatedly sending a stream off immediately followed
> > by stream on:
> > 
> > while true; do v4l2-ctl  -d4 --stream-mmap --stream-count=3; done
> > 
> > Eventually this either causes the system lockup or EOF timeouts at all
> > subsequent stream on, until a system reset.
> > 
> > The lockup occurs when disabling the IDMA channel at stream off. Stopping
> > the video data stream entering the IDMA channel before disabling the
> > channel itself appears to be a reliable fix for the hard lockup. That can
> > be done either by disabling the SMFC or the CSI before disabling the
> > channel. Disabling the SMFC before the channel is the easiest solution,
> > so do that.
> > 
> > Fixes: 4a34ec8e470cb ("[media] media: imx: Add CSI subdev driver")
> > 
> > Suggested-by: Peter Seiderer 
> > Reported-by: Gaël PORTAY 
> > Signed-off-by: Steve Longerbeam 
> 
> Gaël, could we get a Tested-by: for this as well?
> 

I have tested the patchset v4 (not that one), and it has passed my test.

Regards,
Gael


[PATCH 4/4] sisusb: remove useless macros and compact the code

2019-01-22 Thread Jiri Slaby
Remove macros which are only wrappers around standard operations. When
we expand them into code, we see that sisusbcon_memsetw can simply use
memset16 and sisusbcon_putcs can just call memcpy. So make the code
compact.

Signed-off-by: Jiri Slaby 
---
 drivers/usb/misc/sisusbvga/sisusb_con.c | 48 -
 1 file changed, 15 insertions(+), 33 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 8e6d1b02e7c2..cd0155310fea 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -70,11 +70,6 @@
 #include "sisusb.h"
 #include "sisusb_init.h"
 
-#define sisusbcon_writew(val, addr)(*(addr) = (val))
-#define sisusbcon_readw(addr)  (*(addr))
-#define sisusbcon_memmovew(d, s, c)memmove(d, s, c)
-#define sisusbcon_memcpyw(d, s, c) memcpy(d, s, c)
-
 /* vc_data -> sisusb conversion table */
 static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES];
 
@@ -84,9 +79,7 @@ static const struct consw sisusb_con;
 static inline void
 sisusbcon_memsetw(u16 *s, u16 c, unsigned int count)
 {
-   count /= 2;
-   while (count--)
-   sisusbcon_writew(c, s++);
+   memset16(s, c, count / 2);
 }
 
 static inline void
@@ -344,13 +337,11 @@ sisusbcon_invert_region(struct vc_data *vc, u16 *p, int 
count)
 */
 
while (count--) {
-   u16 a = sisusbcon_readw(p);
-
-   a = ((a) & 0x88ff)|
-   (((a) & 0x7000) >> 4) |
-   (((a) & 0x0700) << 4);
+   u16 a = *p;
 
-   sisusbcon_writew(a, p++);
+   *p++ = ((a) & 0x88ff)|
+  (((a) & 0x7000) >> 4) |
+  (((a) & 0x0700) << 4);
}
 }
 
@@ -399,8 +390,6 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s,
 int count, int y, int x)
 {
struct sisusb_usb_data *sisusb;
-   u16 *dest;
-   int i;
 
sisusb = sisusb_get_sisusb_lock_and_check(c->vc_num);
if (!sisusb)
@@ -412,10 +401,7 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s,
 * because the vt does this AFTER calling us.
 */
 
-   dest = sisusb_vaddr(sisusb, c, x, y);
-
-   for (i = count; i > 0; i--)
-   sisusbcon_writew(sisusbcon_readw(s++), dest++);
+   memcpy(sisusb_vaddr(sisusb, c, x, y), s, count * 2);
 
if (sisusb_is_inactive(c, sisusb)) {
mutex_unlock(>lock);
@@ -521,8 +507,7 @@ sisusbcon_switch(struct vc_data *c)
(int)(sisusb->scrbuf + sisusb->scrbuf_size - 
c->vc_origin));
 
/* Restore the screen contents */
-   sisusbcon_memcpyw((u16 *)c->vc_origin, (u16 *)c->vc_screenbuf,
-   length);
+   memcpy((u16 *)c->vc_origin, (u16 *)c->vc_screenbuf, length);
 
sisusb_copy_memory(sisusb, (char *)c->vc_origin,
sisusb_haddr(sisusb, c, 0, 0), length);
@@ -559,8 +544,7 @@ sisusbcon_save_screen(struct vc_data *c)
(int)(sisusb->scrbuf + sisusb->scrbuf_size - 
c->vc_origin));
 
/* Save the screen contents to vc's private buffer */
-   sisusbcon_memcpyw((u16 *)c->vc_screenbuf, (u16 *)c->vc_origin,
-   length);
+   memcpy((u16 *)c->vc_screenbuf, (u16 *)c->vc_origin, length);
 
mutex_unlock(>lock);
 }
@@ -797,7 +781,7 @@ sisusbcon_scroll_area(struct vc_data *c, struct 
sisusb_usb_data *sisusb,
switch (dir) {
 
case SM_UP:
-   sisusbcon_memmovew(sisusb_vaddr(sisusb, c, 0, t),
+   memmove(sisusb_vaddr(sisusb, c, 0, t),
   sisusb_vaddr(sisusb, c, 0, t + 
lines),
   (b - t - lines) * cols * 2);
sisusbcon_memsetw(sisusb_vaddr(sisusb, c, 0, b - lines),
@@ -805,7 +789,7 @@ sisusbcon_scroll_area(struct vc_data *c, struct 
sisusb_usb_data *sisusb,
break;
 
case SM_DOWN:
-   sisusbcon_memmovew(sisusb_vaddr(sisusb, c, 0, t + 
lines),
+   memmove(sisusb_vaddr(sisusb, c, 0, t + lines),
   sisusb_vaddr(sisusb, c, 0, t),
   (b - t - lines) * cols * 2);
sisusbcon_memsetw(sisusb_vaddr(sisusb, c, 0, t), eattr,
@@ -874,7 +858,7 @@ sisusbcon_scroll(struct vc_data *c, unsigned int t, 
unsigned int b,
 
if (c->vc_scr_end + delta >=
sisusb->scrbuf + sisusb->scrbuf_size) {
-   sisusbcon_memcpyw((u16 *)sisusb->scrbuf,
+   memcpy((u16 *)sisusb->scrbuf,
  (u16 *)(oldorigin + delta),

[PATCH 1/4] tty: sisusb_con, convert addr macros to functions

2019-01-22 Thread Jiri Slaby
Convert SISUSB_VADDR and SISUSB_HADDR to inline functions. Now, there
are no more hidden accesses to local variables (vc_data and
sisusb_usb_data).

sisusb_haddr returns unsigned long from now on, not u16 *, as ulong is
what every caller expects -- we can remove some casts.

Call sites were aligned to be readable too.

Use sisusb_haddr on 4 more places in sisusbcon_blank and
sisusbcon_scroll. It was open coded there with [x, y] being [0, 0].

Signed-off-by: Jiri Slaby 
---
 drivers/usb/misc/sisusbvga/sisusb_con.c | 78 -
 1 file changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index c4f017e1d17a..28faf566b8fb 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -356,15 +356,22 @@ sisusbcon_invert_region(struct vc_data *vc, u16 *p, int 
count)
}
 }
 
-#define SISUSB_VADDR(x,y) \
-   ((u16 *)c->vc_origin + \
-   (y) * sisusb->sisusb_num_columns + \
-   (x))
+static inline void *sisusb_vaddr(const struct sisusb_usb_data *sisusb,
+   const struct vc_data *c, unsigned int x, unsigned int y)
+{
+   return (u16 *)c->vc_origin + y * sisusb->sisusb_num_columns + x;
+}
+
+static inline unsigned long sisusb_haddr(const struct sisusb_usb_data *sisusb,
+ const struct vc_data *c, unsigned int x, unsigned int y)
+{
+   unsigned long offset = c->vc_origin - sisusb->scrbuf;
+
+   /* 2 bytes per each character */
+   offset += 2 * (y * sisusb->sisusb_num_columns + x);
 
-#define SISUSB_HADDR(x,y) \
-   ((u16 *)(sisusb->vrambase + (c->vc_origin - sisusb->scrbuf)) + \
-   (y) * sisusb->sisusb_num_columns + \
-   (x))
+   return sisusb->vrambase + offset;
+}
 
 /* Interface routine */
 static void
@@ -382,9 +389,8 @@ sisusbcon_putc(struct vc_data *c, int ch, int y, int x)
return;
}
 
-
-   sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y),
-   (long)SISUSB_HADDR(x, y), 2);
+   sisusb_copy_memory(sisusb, sisusb_vaddr(sisusb, c, x, y),
+   sisusb_haddr(sisusb, c, x, y), 2);
 
mutex_unlock(>lock);
 }
@@ -408,7 +414,7 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s,
 * because the vt does this AFTER calling us.
 */
 
-   dest = SISUSB_VADDR(x, y);
+   dest = sisusb_vaddr(sisusb, c, x, y);
 
for (i = count; i > 0; i--)
sisusbcon_writew(sisusbcon_readw(s++), dest++);
@@ -418,8 +424,8 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s,
return;
}
 
-   sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y),
-   (long)SISUSB_HADDR(x, y), count * 2);
+   sisusb_copy_memory(sisusb, sisusb_vaddr(sisusb, c, x, y),
+   sisusb_haddr(sisusb, c, x, y), count * 2);
 
mutex_unlock(>lock);
 }
@@ -446,7 +452,7 @@ sisusbcon_clear(struct vc_data *c, int y, int x, int 
height, int width)
 * this AFTER calling us.
 */
 
-   dest = SISUSB_VADDR(x, y);
+   dest = sisusb_vaddr(sisusb, c, x, y);
 
cols = sisusb->sisusb_num_columns;
 
@@ -472,8 +478,8 @@ sisusbcon_clear(struct vc_data *c, int y, int x, int 
height, int width)
length = ((height * cols) - x - (cols - width - x)) * 2;
 
 
-   sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(x, y),
-   (long)SISUSB_HADDR(x, y), length);
+   sisusb_copy_memory(sisusb, sisusb_vaddr(sisusb, c, x, y),
+   sisusb_haddr(sisusb, c, x, y), length);
 
mutex_unlock(>lock);
 }
@@ -520,9 +526,8 @@ sisusbcon_switch(struct vc_data *c)
sisusbcon_memcpyw((u16 *)c->vc_origin, (u16 *)c->vc_screenbuf,
length);
 
-   sisusb_copy_memory(sisusb, (unsigned char *)c->vc_origin,
-   (long)SISUSB_HADDR(0, 0),
-   length);
+   sisusb_copy_memory(sisusb, (char *)c->vc_origin,
+   sisusb_haddr(sisusb, c, 0, 0), length);
 
mutex_unlock(>lock);
 
@@ -628,10 +633,8 @@ sisusbcon_blank(struct vc_data *c, int blank, int 
mode_switch)
sisusbcon_memsetw((u16 *)c->vc_origin,
c->vc_video_erase_char,
c->vc_screenbuf_size);
-   sisusb_copy_memory(sisusb,
-   (unsigned char *)c->vc_origin,
-   (u32)(sisusb->vrambase +
-   (c->vc_origin - sisusb->scrbuf)),
+   sisusb_copy_memory(sisusb, (char *)c->vc_origin,
+   sisusb_haddr(sisusb, c, 0, 0),
c->vc_screenbuf_size);
sisusb->con_blanked = 1;
ret = 1;
@@ -796,24 

[PATCH 3/4] sisusb: let files build only when needed

2019-01-22 Thread Jiri Slaby
After the previous patch we see, that whole files are ifdeffed depending
on CONFIG options. So do not build the files at all if the CONFIG is not
enabled. (I.e. move the check from .c to Makefile.)

Signed-off-by: Jiri Slaby 
---
 drivers/usb/misc/sisusbvga/Makefile  | 3 ++-
 drivers/usb/misc/sisusbvga/sisusb_con.c  | 7 ---
 drivers/usb/misc/sisusbvga/sisusb_init.c | 5 -
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/misc/sisusbvga/Makefile 
b/drivers/usb/misc/sisusbvga/Makefile
index 6ed3a638261a..6551bce68ac5 100644
--- a/drivers/usb/misc/sisusbvga/Makefile
+++ b/drivers/usb/misc/sisusbvga/Makefile
@@ -5,4 +5,5 @@
 
 obj-$(CONFIG_USB_SISUSBVGA) += sisusbvga.o
 
-sisusbvga-y := sisusb.o sisusb_init.o sisusb_con.o
+sisusbvga-y := sisusb.o
+sisusbvga-$(CONFIG_USB_SISUSBVGA_CON) += sisusb_con.o sisusb_init.o
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c 
b/drivers/usb/misc/sisusbvga/sisusb_con.c
index 10c15723a7c5..8e6d1b02e7c2 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -70,8 +70,6 @@
 #include "sisusb.h"
 #include "sisusb_init.h"
 
-#ifdef CONFIG_USB_SISUSBVGA_CON
-
 #define sisusbcon_writew(val, addr)(*(addr) = (val))
 #define sisusbcon_readw(addr)  (*(addr))
 #define sisusbcon_memmovew(d, s, c)memmove(d, s, c)
@@ -1534,8 +1532,3 @@ void __init sisusb_init_concode(void)
for (i = 0; i < MAX_NR_CONSOLES; i++)
mysisusbs[i] = NULL;
 }
-
-#endif /* INCL_CON */
-
-
-
diff --git a/drivers/usb/misc/sisusbvga/sisusb_init.c 
b/drivers/usb/misc/sisusbvga/sisusb_init.c
index 0f7170f5b53f..66f6ab5acd97 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_init.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_init.c
@@ -44,9 +44,6 @@
 #include 
 
 #include "sisusb.h"
-
-#ifdef CONFIG_USB_SISUSBVGA_CON
-
 #include "sisusb_init.h"
 
 /*/
@@ -955,5 +952,3 @@ int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned 
short VModeNo)
 
return SiSUSBSetMode(SiS_Pr, ModeNo);
 }
-
-#endif /* CONFIG_USB_SISUSBVGA_CON */
-- 
2.20.1



[PATCH] scsi: atp870u: clean up code style and indentation issues

2019-01-22 Thread Colin King
From: Colin Ian King 

Clean up { brace to fix cppcheck warning. Remove some trailing spaces
at end of a statement.  Also clean up an indentation issue.

Signed-off-by: Colin Ian King 
---
 drivers/scsi/atp870u.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 1267200380f8..446a789cdaf5 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -194,12 +194,11 @@ static irqreturn_t atp870u_intr_handle(int irq, void 
*dev_id)
((unsigned char *) )[2] = 
atp_readb_io(dev, c, 0x12);
((unsigned char *) )[1] = 
atp_readb_io(dev, c, 0x13);
((unsigned char *) )[0] = 
atp_readb_io(dev, c, 0x14);
-   if (dev->id[c][target_id].last_len != adrcnt)
-   {
-   k = dev->id[c][target_id].last_len;
+   if (dev->id[c][target_id].last_len != adrcnt) {
+   k = dev->id[c][target_id].last_len;
k -= adrcnt;
dev->id[c][target_id].tran_len = k; 
   
-   dev->id[c][target_id].last_len = adrcnt;
   
+   dev->id[c][target_id].last_len = adrcnt;
}
 #ifdef ED_DBGP
printk("dev->id[c][target_id].last_len = %d 
dev->id[c][target_id].tran_len = 
%d\n",dev->id[c][target_id].last_len,dev->id[c][target_id].tran_len);
-- 
2.19.1



[PATCH 2/7] scsi: csiostor: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: Varun Prakash 
Cc: Bjorn Helgaas 
Cc: Johannes Thumshirn 
Cc: Oza Pawandeep 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/csiostor/csio_init.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_init.c 
b/drivers/scsi/csiostor/csio_init.c
index cf629380a981..460e4ee1c8fe 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -167,14 +167,10 @@ csio_dfs_destroy(struct csio_hw *hw)
  * csio_dfs_init - Debug filesystem initialization for the module.
  *
  */
-static int
+static void
 csio_dfs_init(void)
 {
csio_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
-   if (!csio_debugfs_root)
-   pr_warn("Could not create debugfs entry, continuing\n");
-
-   return 0;
 }
 
 /*
-- 
2.20.1



[PATCH 7/7] scsi: qla2xxx: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: qla2xxx-upstr...@qlogic.com
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/qla2xxx/qla_dfs.c | 43 +-
 1 file changed, 1 insertion(+), 42 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 0b190082aa8d..ead17288e2a7 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -446,11 +446,6 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
 
atomic_set(_dfs_root_count, 0);
qla2x00_dfs_root = debugfs_create_dir(QLA2XXX_DRIVER_NAME, NULL);
-   if (!qla2x00_dfs_root) {
-   ql_log(ql_log_warn, vha, 0x00f7,
-   "Unable to create debugfs root directory.\n");
-   goto out;
-   }
 
 create_dir:
if (ha->dfs_dir)
@@ -458,64 +453,28 @@ qla2x00_dfs_setup(scsi_qla_host_t *vha)
 
mutex_init(>fce_mutex);
ha->dfs_dir = debugfs_create_dir(vha->host_str, qla2x00_dfs_root);
-   if (!ha->dfs_dir) {
-   ql_log(ql_log_warn, vha, 0x00f8,
-   "Unable to create debugfs ha directory.\n");
-   goto out;
-   }
 
atomic_inc(_dfs_root_count);
 
 create_nodes:
ha->dfs_fw_resource_cnt = debugfs_create_file("fw_resource_count",
S_IRUSR, ha->dfs_dir, vha, _fw_resource_cnt_ops);
-   if (!ha->dfs_fw_resource_cnt) {
-   ql_log(ql_log_warn, vha, 0x00fd,
-   "Unable to create debugFS fw_resource_count node.\n");
-   goto out;
-   }
 
ha->dfs_tgt_counters = debugfs_create_file("tgt_counters", S_IRUSR,
ha->dfs_dir, vha, _tgt_counters_ops);
-   if (!ha->dfs_tgt_counters) {
-   ql_log(ql_log_warn, vha, 0xd301,
-   "Unable to create debugFS tgt_counters node.\n");
-   goto out;
-   }
 
ha->tgt.dfs_tgt_port_database = debugfs_create_file("tgt_port_database",
S_IRUSR,  ha->dfs_dir, vha, _tgt_port_database_ops);
-   if (!ha->tgt.dfs_tgt_port_database) {
-   ql_log(ql_log_warn, vha, 0xd03f,
-   "Unable to create debugFS tgt_port_database node.\n");
-   goto out;
-   }
 
ha->dfs_fce = debugfs_create_file("fce", S_IRUSR, ha->dfs_dir, vha,
_fce_ops);
-   if (!ha->dfs_fce) {
-   ql_log(ql_log_warn, vha, 0x00f9,
-   "Unable to create debugfs fce node.\n");
-   goto out;
-   }
 
ha->tgt.dfs_tgt_sess = debugfs_create_file("tgt_sess",
S_IRUSR, ha->dfs_dir, vha, _tgt_sess_ops);
-   if (!ha->tgt.dfs_tgt_sess) {
-   ql_log(ql_log_warn, vha, 0xd040,
-   "Unable to create debugFS tgt_sess node.\n");
-   goto out;
-   }
 
-   if (IS_QLA27XX(ha) || IS_QLA83XX(ha)) {
+   if (IS_QLA27XX(ha) || IS_QLA83XX(ha))
ha->tgt.dfs_naqp = debugfs_create_file("naqp",
0400, ha->dfs_dir, vha, _naqp_ops);
-   if (!ha->tgt.dfs_naqp) {
-   ql_log(ql_log_warn, vha, 0xd011,
-   "Unable to create debugFS naqp node.\n");
-   goto out;
-   }
-   }
 out:
return 0;
 }
-- 
2.20.1



[PATCH 5/7] scsi: lpfc: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: James Smart 
Cc: Dick Kennedy 
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/lpfc/lpfc_debugfs.c | 170 ---
 1 file changed, 170 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index a58f0b3f03a9..a851dee09587 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -5280,11 +5280,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
if (!lpfc_debugfs_root) {
lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
atomic_set(_debugfs_hba_count, 0);
-   if (!lpfc_debugfs_root) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-"0408 Cannot create debugfs root\n");
-   goto debug_failed;
-   }
}
if (!lpfc_debugfs_start_time)
lpfc_debugfs_start_time = jiffies;
@@ -5295,11 +5290,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
pport_setup = true;
phba->hba_debugfs_root =
debugfs_create_dir(name, lpfc_debugfs_root);
-   if (!phba->hba_debugfs_root) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-"0412 Cannot create debugfs hba\n");
-   goto debug_failed;
-   }
atomic_inc(_debugfs_hba_count);
atomic_set(>debugfs_vport_count, 0);
 
@@ -5309,11 +5299,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
 phba->hba_debugfs_root,
 phba, _debugfs_op_hbqinfo);
-   if (!phba->debug_hbqinfo) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-   "0411 Cannot create debugfs hbqinfo\n");
-   goto debug_failed;
-   }
 
/* Setup dumpHBASlim */
if (phba->sli_rev < LPFC_SLI_REV4) {
@@ -5323,12 +5308,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
S_IFREG|S_IRUGO|S_IWUSR,
phba->hba_debugfs_root,
phba, _debugfs_op_dumpHBASlim);
-   if (!phba->debug_dumpHBASlim) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-"0413 Cannot create debugfs "
-   "dumpHBASlim\n");
-   goto debug_failed;
-   }
} else
phba->debug_dumpHBASlim = NULL;
 
@@ -5340,12 +5319,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
S_IFREG|S_IRUGO|S_IWUSR,
phba->hba_debugfs_root,
phba, _debugfs_op_dumpHostSlim);
-   if (!phba->debug_dumpHostSlim) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-"0414 Cannot create debugfs "
-"dumpHostSlim\n");
-   goto debug_failed;
-   }
} else
phba->debug_dumpHostSlim = NULL;
 
@@ -5355,11 +5328,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
 phba->hba_debugfs_root,
 phba, _debugfs_op_dumpData);
-   if (!phba->debug_dumpData) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-   "0800 Cannot create debugfs dumpData\n");
-   goto debug_failed;
-   }
 
/* Setup dumpDif */
snprintf(name, sizeof(name), "dumpDif");
@@ -5367,11 +5335,6 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
 phba->hba_debugfs_root,
 phba, _debugfs_op_dumpDif);
-   if (!phba->debug_dumpDif) {
-   lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
-   "0801 Cannot create debugfs dumpDif\n");
-   goto debug_failed;
-   }
 
/* Setup DIF Error 

[PATCH] parport_pc: fix find_superio io compare code, should use equal test.

2019-01-22 Thread qiaochong
From: QiaoChong 

git blame drivers/parport/parport_pc.c

181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1376) static 
struct superio_struct *find_superio(struct parport *p)
^1da177e4c3f4 (Linus Torvalds2005-04-16 15:20:36 -0700 1377) {
181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1378)
int i;
181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1379)
for (i = 0; i < NR_SUPERIOS; i++)
181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1380)
if (superios[i].io != p->base)
181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1381)
return [i];
181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1382)
return NULL;
181bf1e815a2a (Alan Cox  2009-06-11 13:08:10 +0100 1383) }
73e0d48b8c28f (Michael Buesch2009-06-11 13:06:31 +0100 1384)

git log -1 -p 181bf1e815a2a

-static int get_superio_dma(struct parport *p)
+static struct superio_struct *find_superio(struct parport *p)
 {
-   int i = 0;
+   int i;
+   for (i = 0; i < NR_SUPERIOS; i++)
+   if (superios[i].io != p->base)
+   return [i];
+   return NULL;
+}

-   while ((i < NR_SUPERIOS) && (superios[i].io != p->base))
-   i++;
-   if (i != NR_SUPERIOS)
-   return superios[i].dma;

the code before 181bf1e815a2a  also mean superio[i].io == p->base, fixup it.

Signed-off-by: QiaoChong 
---
 drivers/parport/parport_pc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index 9c8249f744792..6296dbb83d470 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -1377,7 +1377,7 @@ static struct superio_struct *find_superio(struct parport 
*p)
 {
int i;
for (i = 0; i < NR_SUPERIOS; i++)
-   if (superios[i].io != p->base)
+   if (superios[i].io == p->base)
return [i];
return NULL;
 }
-- 
2.17.1




[PATCH 0/7] SCSI: cleanup debugfs usage

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not.  Fix up a bunch of x86-specific code to not care about
the results of debugfs.

Greg Kroah-Hartman (7):
  scsi: bfa: no need to check return value of debugfs_create functions
  scsi: csiostor: no need to check return value of debugfs_create
functions
  scsi: fnic: no need to check return value of debugfs_create functions
  scsi: snic: no need to check return value of debugfs_create functions
  scsi: lpfc: no need to check return value of debugfs_create functions
  scsi: qlogic: no need to check return value of debugfs_create
functions
  scsi: qla2xxx: no need to check return value of debugfs_create
functions

 drivers/scsi/bfa/bfad_debugfs.c   |  17 ---
 drivers/scsi/csiostor/csio_init.c |   6 +-
 drivers/scsi/fnic/fnic_debugfs.c  |  88 +---
 drivers/scsi/fnic/fnic_main.c |   7 +-
 drivers/scsi/fnic/fnic_stats.h|   2 +-
 drivers/scsi/fnic/fnic_trace.c|  17 +--
 drivers/scsi/fnic/fnic_trace.h|   4 +-
 drivers/scsi/lpfc/lpfc_debugfs.c  | 170 --
 drivers/scsi/qedf/qedf_debugfs.c  |  18 +---
 drivers/scsi/qedi/qedi_debugfs.c  |  17 +--
 drivers/scsi/qla2xxx/qla_dfs.c|  43 +---
 drivers/scsi/snic/snic_debugfs.c  | 133 +--
 drivers/scsi/snic/snic_main.c |  14 +--
 drivers/scsi/snic/snic_stats.h|   2 +-
 drivers/scsi/snic/snic_trc.c  |  12 +--
 drivers/scsi/snic/snic_trc.h  |   4 +-
 16 files changed, 48 insertions(+), 506 deletions(-)

-- 
2.20.1



[PATCH 4/7] scsi: snic: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Karan Tilak Kumar 
Cc: Sesidhar Baddela 
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/snic/snic_debugfs.c | 133 ++-
 drivers/scsi/snic/snic_main.c|  14 +---
 drivers/scsi/snic/snic_stats.h   |   2 +-
 drivers/scsi/snic/snic_trc.c |  12 +--
 drivers/scsi/snic/snic_trc.h |   4 +-
 5 files changed, 32 insertions(+), 133 deletions(-)

diff --git a/drivers/scsi/snic/snic_debugfs.c b/drivers/scsi/snic/snic_debugfs.c
index 0abe17c1a73b..2b349365592f 100644
--- a/drivers/scsi/snic/snic_debugfs.c
+++ b/drivers/scsi/snic/snic_debugfs.c
@@ -30,33 +30,13 @@
  * fnic directory and statistics directory for trace buffer and
  * stats logging
  */
-
-int
-snic_debugfs_init(void)
+void snic_debugfs_init(void)
 {
-   int rc = -1;
-   struct dentry *de = NULL;
-
-   de = debugfs_create_dir("snic", NULL);
-   if (!de) {
-   SNIC_DBG("Cannot create debugfs root\n");
-
-   return rc;
-   }
-   snic_glob->trc_root = de;
-
-   de = debugfs_create_dir("statistics", snic_glob->trc_root);
-   if (!de) {
-   SNIC_DBG("Cannot create Statistics directory\n");
+   snic_glob->trc_root = debugfs_create_dir("snic", NULL);
 
-   return rc;
-   }
-   snic_glob->stats_root = de;
-
-   rc = 0;
-
-   return rc;
-} /* end of snic_debugfs_init */
+   snic_glob->stats_root = debugfs_create_dir("statistics",
+  snic_glob->trc_root);
+}
 
 /*
  * snic_debugfs_term - Tear down debugfs intrastructure
@@ -391,56 +371,23 @@ static const struct file_operations snic_reset_stats_fops 
= {
  * It will create file stats and reset_stats under statistics/host# directory
  * to log per snic stats
  */
-int
-snic_stats_debugfs_init(struct snic *snic)
+void snic_stats_debugfs_init(struct snic *snic)
 {
-   int rc = -1;
char name[16];
-   struct dentry *de = NULL;
 
snprintf(name, sizeof(name), "host%d", snic->shost->host_no);
-   if (!snic_glob->stats_root) {
-   SNIC_DBG("snic_stats root doesn't exist\n");
-
-   return rc;
-   }
-
-   de = debugfs_create_dir(name, snic_glob->stats_root);
-   if (!de) {
-   SNIC_DBG("Cannot create host directory\n");
-
-   return rc;
-   }
-   snic->stats_host = de;
-
-   de = debugfs_create_file("stats",
-   S_IFREG|S_IRUGO,
-   snic->stats_host,
-   snic,
-   _stats_fops);
-   if (!de) {
-   SNIC_DBG("Cannot create host's stats file\n");
-
-   return rc;
-   }
-   snic->stats_file = de;
-
-   de = debugfs_create_file("reset_stats",
-   S_IFREG|S_IRUGO|S_IWUSR,
-   snic->stats_host,
-   snic,
-   _reset_stats_fops);
 
-   if (!de) {
-   SNIC_DBG("Cannot create host's reset_stats file\n");
+   snic->stats_host = debugfs_create_dir(name, snic_glob->stats_root);
 
-   return rc;
-   }
-   snic->reset_stats_file = de;
-   rc = 0;
+   snic->stats_file = debugfs_create_file("stats", S_IFREG|S_IRUGO,
+  snic->stats_host, snic,
+  _stats_fops);
 
-   return rc;
-} /* end of snic_stats_debugfs_init */
+   snic->reset_stats_file = debugfs_create_file("reset_stats",
+S_IFREG|S_IRUGO|S_IWUSR,
+snic->stats_host, snic,
+_reset_stats_fops);
+}
 
 /*
  * snic_stats_debugfs_remove - Tear down debugfs infrastructure of stats
@@ -517,46 +464,18 @@ static const struct file_operations snic_trc_fops = {
  * snic_trc_debugfs_init : creates trace/tracing_enable files for trace
  * under debugfs
  */
-int
-snic_trc_debugfs_init(void)
+void snic_trc_debugfs_init(void)
 {
-   struct dentry *de = NULL;
-   int ret = -1;
-
-   if (!snic_glob->trc_root) {
-   SNIC_ERR("Debugfs root directory for snic doesn't exist.\n");
-
-   return ret;
-   }
-
-   de = debugfs_create_bool("tracing_enable",
-S_IFREG | S_IRUGO | S_IWUSR,
-snic_glob->trc_root,
-_glob->trc.enable);
-
-   if (!de) {
-   SNIC_ERR("Can't create trace_enable file.\n");
-
-   return ret;
-   }
-   

[PATCH 3/7] scsi: fnic: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Satish Kharat 
Cc: Sesidhar Baddela 
Cc: Karan Tilak Kumar 
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/fnic/fnic_debugfs.c | 88 ++--
 drivers/scsi/fnic/fnic_main.c|  7 +--
 drivers/scsi/fnic/fnic_stats.h   |  2 +-
 drivers/scsi/fnic/fnic_trace.c   | 17 ++
 drivers/scsi/fnic/fnic_trace.h   |  4 +-
 5 files changed, 10 insertions(+), 108 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c
index 139fffa3658a..21991c99db7c 100644
--- a/drivers/scsi/fnic/fnic_debugfs.c
+++ b/drivers/scsi/fnic/fnic_debugfs.c
@@ -54,23 +54,9 @@ int fnic_debugfs_init(void)
 {
int rc = -1;
fnic_trace_debugfs_root = debugfs_create_dir("fnic", NULL);
-   if (!fnic_trace_debugfs_root) {
-   printk(KERN_DEBUG "Cannot create debugfs root\n");
-   return rc;
-   }
-
-   if (!fnic_trace_debugfs_root) {
-   printk(KERN_DEBUG
-   "fnic root directory doesn't exist in debugfs\n");
-   return rc;
-   }
 
fnic_stats_debugfs_root = debugfs_create_dir("statistics",
fnic_trace_debugfs_root);
-   if (!fnic_stats_debugfs_root) {
-   printk(KERN_DEBUG "Cannot create Statistics directory\n");
-   return rc;
-   }
 
/* Allocate memory to structure */
fc_trc_flag = (struct fc_trace_flag_type *)
@@ -356,39 +342,19 @@ static const struct file_operations 
fnic_trace_debugfs_fops = {
  * it will also create file trace_enable to control enable/disable of
  * trace logging into trace buffer.
  */
-int fnic_trace_debugfs_init(void)
+void fnic_trace_debugfs_init(void)
 {
-   int rc = -1;
-   if (!fnic_trace_debugfs_root) {
-   printk(KERN_DEBUG
-   "FNIC Debugfs root directory doesn't exist\n");
-   return rc;
-   }
fnic_trace_enable = debugfs_create_file("tracing_enable",
S_IFREG|S_IRUGO|S_IWUSR,
fnic_trace_debugfs_root,
&(fc_trc_flag->fnic_trace),
_trace_ctrl_fops);
 
-   if (!fnic_trace_enable) {
-   printk(KERN_DEBUG
-   "Cannot create trace_enable file under debugfs\n");
-   return rc;
-   }
-
fnic_trace_debugfs_file = debugfs_create_file("trace",
S_IFREG|S_IRUGO|S_IWUSR,
fnic_trace_debugfs_root,
&(fc_trc_flag->fnic_trace),
_trace_debugfs_fops);
-
-   if (!fnic_trace_debugfs_file) {
-   printk(KERN_DEBUG
-   "Cannot create trace file under debugfs\n");
-   return rc;
-   }
-   rc = 0;
-   return rc;
 }
 
 /*
@@ -419,37 +385,20 @@ void fnic_trace_debugfs_terminate(void)
  * trace logging into trace buffer.
  */
 
-int fnic_fc_trace_debugfs_init(void)
+void fnic_fc_trace_debugfs_init(void)
 {
-   int rc = -1;
-
-   if (!fnic_trace_debugfs_root) {
-   pr_err("fnic:Debugfs root directory doesn't exist\n");
-   return rc;
-   }
-
fnic_fc_trace_enable = debugfs_create_file("fc_trace_enable",
S_IFREG|S_IRUGO|S_IWUSR,
fnic_trace_debugfs_root,
&(fc_trc_flag->fc_trace),
_trace_ctrl_fops);
 
-   if (!fnic_fc_trace_enable) {
-   pr_err("fnic: Failed create fc_trace_enable file\n");
-   return rc;
-   }
-
fnic_fc_trace_clear = debugfs_create_file("fc_trace_clear",
S_IFREG|S_IRUGO|S_IWUSR,
fnic_trace_debugfs_root,
&(fc_trc_flag->fc_clear),
_trace_ctrl_fops);
 
-   if (!fnic_fc_trace_clear) {
-   pr_err("fnic: Failed to create fc_trace_enable file\n");
-   return rc;
-   }
-
fnic_fc_rdata_trace_debugfs_file =
debugfs_create_file("fc_trace_rdata",
S_IFREG|S_IRUGO|S_IWUSR,
@@ -457,24 +406,12 @@ int fnic_fc_trace_debugfs_init(void)
&(fc_trc_flag->fc_normal_file),
_trace_debugfs_fops);
 
-   if (!fnic_fc_rdata_trace_debugfs_file) {
-   pr_err("fnic: 

[PATCH 6/7] scsi: qlogic: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: qlogic-storage-upstr...@cavium.com
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/qedf/qedf_debugfs.c | 18 ++
 drivers/scsi/qedi/qedi_debugfs.c | 17 ++---
 2 files changed, 4 insertions(+), 31 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_debugfs.c b/drivers/scsi/qedf/qedf_debugfs.c
index c29c162a494f..a32d8ee4666e 100644
--- a/drivers/scsi/qedf/qedf_debugfs.c
+++ b/drivers/scsi/qedf/qedf_debugfs.c
@@ -27,30 +27,19 @@ qedf_dbg_host_init(struct qedf_dbg_ctx *qedf,
const struct file_operations *fops)
 {
char host_dirname[32];
-   struct dentry *file_dentry = NULL;
 
QEDF_INFO(qedf, QEDF_LOG_DEBUGFS, "Creating debugfs host node\n");
/* create pf dir */
sprintf(host_dirname, "host%u", qedf->host_no);
qedf->bdf_dentry = debugfs_create_dir(host_dirname, qedf_dbg_root);
-   if (!qedf->bdf_dentry)
-   return;
 
/* create debugfs files */
while (dops) {
if (!(dops->name))
break;
 
-   file_dentry = debugfs_create_file(dops->name, 0600,
- qedf->bdf_dentry, qedf,
- fops);
-   if (!file_dentry) {
-   QEDF_INFO(qedf, QEDF_LOG_DEBUGFS,
-  "Debugfs entry %s creation failed\n",
-  dops->name);
-   debugfs_remove_recursive(qedf->bdf_dentry);
-   return;
-   }
+   debugfs_create_file(dops->name, 0600, qedf->bdf_dentry, qedf,
+   fops);
dops++;
fops++;
}
@@ -80,9 +69,6 @@ qedf_dbg_init(char *drv_name)
 
/* create qed dir in root of debugfs. NULL means debugfs root */
qedf_dbg_root = debugfs_create_dir(drv_name, NULL);
-   if (!qedf_dbg_root)
-   QEDF_INFO(NULL, QEDF_LOG_DEBUGFS, "Init of debugfs "
-  "failed\n");
 }
 
 /**
diff --git a/drivers/scsi/qedi/qedi_debugfs.c b/drivers/scsi/qedi/qedi_debugfs.c
index fd914ca4149a..5667e4752e2e 100644
--- a/drivers/scsi/qedi/qedi_debugfs.c
+++ b/drivers/scsi/qedi/qedi_debugfs.c
@@ -23,27 +23,16 @@ qedi_dbg_host_init(struct qedi_dbg_ctx *qedi,
   const struct file_operations *fops)
 {
char host_dirname[32];
-   struct dentry *file_dentry = NULL;
 
sprintf(host_dirname, "host%u", qedi->host_no);
qedi->bdf_dentry = debugfs_create_dir(host_dirname, qedi_dbg_root);
-   if (!qedi->bdf_dentry)
-   return;
 
while (dops) {
if (!(dops->name))
break;
 
-   file_dentry = debugfs_create_file(dops->name, 0600,
- qedi->bdf_dentry, qedi,
- fops);
-   if (!file_dentry) {
-   QEDI_INFO(qedi, QEDI_LOG_DEBUGFS,
- "Debugfs entry %s creation failed\n",
- dops->name);
-   debugfs_remove_recursive(qedi->bdf_dentry);
-   return;
-   }
+   debugfs_create_file(dops->name, 0600, qedi->bdf_dentry, qedi,
+   fops);
dops++;
fops++;
}
@@ -60,8 +49,6 @@ void
 qedi_dbg_init(char *drv_name)
 {
qedi_dbg_root = debugfs_create_dir(drv_name, NULL);
-   if (!qedi_dbg_root)
-   QEDI_INFO(NULL, QEDI_LOG_DEBUGFS, "Init of debugfs failed\n");
 }
 
 void
-- 
2.20.1



[PATCH 1/7] scsi: bfa: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Anil Gurumurthy 
Cc: Sudarsana Kalluru 
Cc: "James E.J. Bottomley" 
Cc: "Martin K. Petersen" 
Cc: linux-s...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/scsi/bfa/bfad_debugfs.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/scsi/bfa/bfad_debugfs.c b/drivers/scsi/bfa/bfad_debugfs.c
index 349cfe7d055e..ece165851cf6 100644
--- a/drivers/scsi/bfa/bfad_debugfs.c
+++ b/drivers/scsi/bfa/bfad_debugfs.c
@@ -460,11 +460,6 @@ bfad_debugfs_init(struct bfad_port_s *port)
if (!bfa_debugfs_root) {
bfa_debugfs_root = debugfs_create_dir("bfa", NULL);
atomic_set(_debugfs_port_count, 0);
-   if (!bfa_debugfs_root) {
-   printk(KERN_WARNING
-   "BFA debugfs root dir creation failed\n");
-   goto err;
-   }
}
 
/* Setup the pci_dev debugfs directory for the port */
@@ -472,12 +467,6 @@ bfad_debugfs_init(struct bfad_port_s *port)
if (!port->port_debugfs_root) {
port->port_debugfs_root =
debugfs_create_dir(name, bfa_debugfs_root);
-   if (!port->port_debugfs_root) {
-   printk(KERN_WARNING
-   "bfa %s: debugfs root creation failed\n",
-   bfad->pci_name);
-   goto err;
-   }
 
atomic_inc(_debugfs_port_count);
 
@@ -489,12 +478,6 @@ bfad_debugfs_init(struct bfad_port_s *port)
port->port_debugfs_root,
port,
file->fops);
-   if (!bfad->bfad_dentry_files[i]) {
-   printk(KERN_WARNING
-   "bfa %s: debugfs %s creation failed\n",
-   bfad->pci_name, file->name);
-   goto err;
-   }
}
}
 
-- 
2.20.1



Re: [PATCH 7/9] videobuf2/videobuf2-dma-sg.c: Convert to use vm_insert_range_buggy

2019-01-22 Thread Marek Szyprowski
Hi Souptick,

On 2019-01-11 16:11, Souptick Joarder wrote:
> Convert to use vm_insert_range_buggy to map range of kernel memory
> to user vma.
>
> This driver has ignored vm_pgoff. We could later "fix" these drivers
> to behave according to the normal vm_pgoff offsetting simply by
> removing the _buggy suffix on the function name and if that causes
> regressions, it gives us an easy way to revert.

Just a generic note about videobuf2: videobuf2-dma-sg is ignoring vm_pgoff by 
design. vm_pgoff is used as a 'cookie' to select a buffer to mmap and 
videobuf2-core already checks that. If userspace provides an offset, which 
doesn't match any of the registered 'cookies' (reported to userspace via 
separate v4l2 ioctl), an error is returned.

I'm sorry for the late reply.

> There is an existing bug inside gem_mmap_obj(), where user passed
> length is not checked against buf->num_pages. For any value of
> length > buf->num_pages it will end up overrun buf->pages[i],
> which could lead to a potential bug.
>
> This has been addressed by passing buf->num_pages as input to
> vm_insert_range_buggy() and inside this API error condition is
> checked which will avoid overrun the page boundary.
>
> Signed-off-by: Souptick Joarder 
> ---
>  drivers/media/common/videobuf2/videobuf2-dma-sg.c | 22 ++
>  1 file changed, 6 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c 
> b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> index 015e737..ef046b4 100644
> --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c
> @@ -328,28 +328,18 @@ static unsigned int vb2_dma_sg_num_users(void *buf_priv)
>  static int vb2_dma_sg_mmap(void *buf_priv, struct vm_area_struct *vma)
>  {
>   struct vb2_dma_sg_buf *buf = buf_priv;
> - unsigned long uaddr = vma->vm_start;
> - unsigned long usize = vma->vm_end - vma->vm_start;
> - int i = 0;
> + int err;
>  
>   if (!buf) {
>   printk(KERN_ERR "No memory to map\n");
>   return -EINVAL;
>   }
>  
> - do {
> - int ret;
> -
> - ret = vm_insert_page(vma, uaddr, buf->pages[i++]);
> - if (ret) {
> - printk(KERN_ERR "Remapping memory, error: %d\n", ret);
> - return ret;
> - }
> -
> - uaddr += PAGE_SIZE;
> - usize -= PAGE_SIZE;
> - } while (usize > 0);
> -
> + err = vm_insert_range_buggy(vma, buf->pages, buf->num_pages);
> + if (err) {
> + printk(KERN_ERR "Remapping memory, error: %d\n", err);
> + return err;
> + }
>  
>   /*
>* Use common vm_area operations to track buffer refcount.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R Institute Poland



Re: [PATCH v3 8/9] platform/chrome: Add peakshift and adv_batt_charging

2019-01-22 Thread Enric Balletbo Serra
Hi Nick,

I'd like to have some feedback from power-supply subsystem if it's possible,
so adding Sebastian. Don't forget to add him for the next versions.

Missatge de Nick Crews  del dia ds., 19 de gen.
2019 a les 1:15:
>
> From: Nick Crews 
>
> Create "peakshift" and "advanced_battery_charging" directories
> within the "properties" directory, and create the relevant
> attributes within these. These properties have to do with
> configuring some of the advanced power management options that
> prolong battery health and reduce energy use at peak hours
> of the day.
>
> Scheduling events uses a 24 hour clock, and only supports time
> intervals of 15 minutes. For example, to set
> advanced_battery_charging to start at 4:15pm and to last for
> 6 hours and 45 minutes, you would use the argument "16 15 6 45".
>
> > cd /sys/bus/platform/devices/GOOG000C\:00
> > cat properties/peakshift/peakshift_battery_threshold
> > 015
> [means 15 percent]
> > cat properties/peakshift/peakshift_monday
> 16 00 20 30 00 00
> [starts at 4:00 pm, ends at 8:30, charging resumes at midnight]
> > echo "16 00 20 31 00 00" > properties/peakshift/peakshift_monday
> -bash: echo: write error: Invalid argument
> > dmesg | tail -n1
> [40.34534] wilco_ec GOOG00C:00: minutes must be at the quarter hour
> > echo "16 0 20 45 0 0" > properties/peakshift/peakshift_monday
> > cat properties/peakshift/peakshift_monday
> 16 00 20 45 00 00
>
> Signed-off-by: Nick Crews 
> Signed-off-by: Nick Crews 
> ---
>
> Changes in v3:
> - rm some useless references to internal docs from documentation
>
> Changes in v2:
> - rm license boiler plate
> - rm "wilco_ec_adv_power - " prefix from docstring
> - Add documentation
> - make format strings in read() and store() functions static
>
>  .../ABI/testing/sysfs-platform-wilco-ec   |  88 +++
>  drivers/platform/chrome/wilco_ec/Makefile |   3 +-
>  drivers/platform/chrome/wilco_ec/adv_power.c  | 544 ++
>  drivers/platform/chrome/wilco_ec/adv_power.h  | 183 ++
>  drivers/platform/chrome/wilco_ec/sysfs.c  | 104 
>  5 files changed, 921 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/platform/chrome/wilco_ec/adv_power.c
>  create mode 100644 drivers/platform/chrome/wilco_ec/adv_power.h
>
> diff --git a/Documentation/ABI/testing/sysfs-platform-wilco-ec 
> b/Documentation/ABI/testing/sysfs-platform-wilco-ec
> index aadb29a17a47..bac3340c9d90 100644
> --- a/Documentation/ABI/testing/sysfs-platform-wilco-ec
> +++ b/Documentation/ABI/testing/sysfs-platform-wilco-ec
> @@ -106,3 +106,91 @@ Description:
>
> Input should be parseable by kstrtobool().
> Output will be either "0\n" or "1\n".
> +
> +What:  
> /sys/bus/platform/devices/GOOG000C\:00/properties/peakshift/
> +Date:  January 2019
> +KernelVersion: 4.19
> +Description:
> +   For each weekday a start and end time to run in Peak Shift 
> mode
> +   can be set. During these times the system will run from the
> +   battery even if the AC is attached as long as the battery 
> stays
> +   above the threshold specified. After the end time specified 
> the
> +   system will run from AC if attached but will not charge the
> +   battery. The system will again function normally using AC and
> +   recharging the battery after the specified Charge Start time.
> +
> +   The input buffer must have the format "start_hr start_min 
> end_hr
> +   end_min charge_start_hr charge_start_min" The hour fields must
> +   be in the range [0-23], and the minutes must be one of (0, 15,
> +   30, 45). The string must be parseable by sscanf() using the
> +   format string "%d %d %d %d %d %d". An example valid input is
> +   "6 15   009 45 23 0", which corresponds to 6:15, 9:45, and 
> 23:00
> +
> +   The output buffer will be filled with the format "start_hr
> +   start_min end_hr end_min charge_start_hr charge_start_min" The
> +   hour fields will be in the range [0-23], and the minutes will 
> be
> +   one of (0, 15, 30, 45). Each number will be zero padded to two
> +   characters. An example output is "06 15 09 45 23 00", which
> +   corresponds to 6:15, 9:45, and 23:00
> +
> +What:  
> /sys/bus/platform/devices/GOOG000C\:00/properties/peakshift/enable
> +Date:  January 2019
> +KernelVersion: 4.19
> +Description:
> +   Enable/disable the peakshift power management policy.
> +
> +   Input should be parseable by kstrtobool().
> +   Output will be either "0\n" or "1\n".
> +
> +What:  
> /sys/bus/platform/devices/GOOG000C\:00/properties/peakshift/battery_threshold
> +Date:  January 2019
> +KernelVersion: 4.19
> +Description:
> +   Read/write the battery percentage threshold for which the
> +   

Re: [PATCHv4 1/4] arm64: dts: qcom: sdm845: Add Coresight support

2019-01-22 Thread Sai Prakash Ranjan

Hi Suzuki,

Thanks for looking into this. Please find my response inline.

On 1/22/2019 7:30 PM, Suzuki K Poulose wrote:

Hi Sai,

On 01/22/2019 01:37 PM, Sai Prakash Ranjan wrote:

Add coresight components found on Qualcomm SDM845 SoC.

Signed-off-by: Sai Prakash Ranjan 



Sorry, but I hadn't noticed the PID override strings below. Please
find the question.


[..]


+    /*
+ * On QCOM SDM845, we bypass the normal AMBA bus discovery
+ * method by forcing the peripheral ID because of the wrong
+ * value read from ETM PID registers.
+ */


What is the value read back from the ETM PIDx registers ? Do they
provide inconsistent or incompatible value w.r.t the ETM/Coresight
architecture ? If it is an unsupported CPU with proper values,
you must add them to the table in etm4x driver.



The values read from ETM PIDx registers are actually inconsistent
and is different for some ETMs.

Below are the PIDs read for SDM845:

[5.996448] resname=etm@704 pid=001bb803
[6.052891] resname=etm@714 pid=001bb803

 .. (Same pid=001bb803 for etm@724 to etm@754 but differs
for other 2 cpus as shown below)

[6.266687] resname=etm@764 pid=001bb802
[6.329171] resname=etm@774 pid=001bb802

This is the case for MSM8996 also as shown below where PID
value is not correct and has to be hardcoded.

For MSM8996:

resname=etm@3b4 pid=102f0205


+    etm@704 {
+    compatible = "arm,coresight-etm4x", "arm,primecell";
+    arm,primecell-periphid = <0x000bb95d> > +    reg 
= <0 0x0704 0 0x1000>;

+
+    cpu = <>;
+


You seem to be specifying the PID of A53 ETM all over, while at least
one of your cores is ETMv4.2 (from the other patch) and A53 is not
ETMv4.2. As above, it would be good to add the PID to the table.



As explained in above comment, PID values read are not correct. Please 
let me know if I am not clear.


Thanks,
Sai

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


Re: [PATCH v3 6/9] platform/chrome: Add event handling

2019-01-22 Thread Enric Balletbo Serra
Hi Nick,

I'd like to have some feedback from input subsystem if it's possible,
so adding linux-in...@vger.kernel.org and Dmitry. Don't forget to add
them for the next versions.

Missatge de Nick Crews  del dia ds., 19 de gen.
2019 a les 1:16:
>
> From: Duncan Laurie 
>
> The Wilco Embedded Controller can return extended events that
> are not handled by standard ACPI objects.  These events can
> include hotkeys which map to standard functions like brightness
> controls, or information about EC controlled features like the
> charger or battery.
>
> These events are triggered with an ACPI Notify(0x90) and the
> event data buffer is read through an ACPI method provided by
> the BIOS which reads the event buffer from EC RAM.
>
> These events are then processed, with hotkey events being sent
> to the input subsystem and other events put into a queue which
> can be read by a userspace daemon via a sysfs attribute.
>
> > evtest /dev/input/event6
> Input driver version is 1.0.1
> Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
> Input device name: "Wilco EC hotkeys"
> Supported events:
>   Event type 0 (EV_SYN)
>   Event type 1 (EV_KEY)
> Event code 224 (KEY_BRIGHTNESSDOWN)
> Event code 225 (KEY_BRIGHTNESSUP)
> Event code 240 (KEY_UNKNOWN)
>   Event type 4 (EV_MSC)
> Event code 4 (MSC_SCAN)
> Properties:
> Testing ... (interrupt to exit)
> Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value 57
> Event: type 1 (EV_KEY), code 224 (KEY_BRIGHTNESSDOWN), value 1
> Event: -- SYN_REPORT 
> Event: type 1 (EV_KEY), code 224 (KEY_BRIGHTNESSDOWN), value 0
> Event: -- SYN_REPORT 
> Event: type 4 (EV_MSC), code 4 (MSC_SCAN), value 58
> Event: type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 1
> Event: -- SYN_REPORT 
> Event: type 1 (EV_KEY), code 225 (KEY_BRIGHTNESSUP), value 0
> Event: -- SYN_REPORT 
>
> Signed-off-by: Duncan Laurie 
> Signed-off-by: Nick Crews 
> ---
>
> Changes in v3:
> - change err check from "if (ret < 0)" to "if (ret)"
>
> Changes in v2:
> - rm "wilco_ec_event -" prefix from docstring
> - rm license boiler plate
> - Add sysfs directory documentation
> - Fix cosmetics
> - events are init()ed before subdrivers now
>
>  drivers/platform/chrome/wilco_ec/Makefile |   2 +-
>  drivers/platform/chrome/wilco_ec/core.c   |  14 +-
>  drivers/platform/chrome/wilco_ec/event.c  | 347 ++
>  include/linux/platform_data/wilco-ec.h|  34 +++
>  4 files changed, 395 insertions(+), 2 deletions(-)
>  create mode 100644 drivers/platform/chrome/wilco_ec/event.c
>
> diff --git a/drivers/platform/chrome/wilco_ec/Makefile 
> b/drivers/platform/chrome/wilco_ec/Makefile
> index 84ad2772247c..18070d0f8b5e 100644
> --- a/drivers/platform/chrome/wilco_ec/Makefile
> +++ b/drivers/platform/chrome/wilco_ec/Makefile
> @@ -1,5 +1,5 @@
>  # SPDX-License-Identifier: GPL-2.0
>
>  wilco_ec-objs  := core.o mailbox.o debugfs.o sysfs.o 
> \
> -  legacy.o
> +  legacy.o event.o
>  obj-$(CONFIG_WILCO_EC) += wilco_ec.o
> diff --git a/drivers/platform/chrome/wilco_ec/core.c 
> b/drivers/platform/chrome/wilco_ec/core.c
> index dd8b896b3833..65588cfcc7a2 100644
> --- a/drivers/platform/chrome/wilco_ec/core.c
> +++ b/drivers/platform/chrome/wilco_ec/core.c
> @@ -77,6 +77,13 @@ static int wilco_ec_probe(struct platform_device *pdev)
> goto rm_debugfs;
> }
>
> +   /* Prepare to handle events */
> +   ret = wilco_ec_event_init(ec);
> +   if (ret) {
> +   dev_err(dev, "Failed to setup event handling\n");
> +   goto remove_sysfs;
> +   }
> +
> /*
>  * Register a RTC platform device that will get picked up by the RTC
>  * subsystem. This platform device will get freed when its parent 
> device
> @@ -88,11 +95,13 @@ static int wilco_ec_probe(struct platform_device *pdev)
> if (IS_ERR(child_pdev)) {
> dev_err(dev, "Failed to create RTC platform device\n");
> ret = PTR_ERR(child_pdev);
> -   goto remove_sysfs;
> +   goto remove_events;
> }
>
> return 0;
>
> +remove_events:
> +   wilco_ec_event_remove(ec);
>  remove_sysfs:
> wilco_ec_sysfs_remove(ec);
>  rm_debugfs:
> @@ -106,6 +115,9 @@ static int wilco_ec_remove(struct platform_device *pdev)
>  {
> struct wilco_ec_device *ec = platform_get_drvdata(pdev);
>
> +   /* Stop handling EC events */
> +   wilco_ec_event_remove(ec);
> +
> /* Remove sysfs attributes */
> wilco_ec_sysfs_remove(ec);
>
> diff --git a/drivers/platform/chrome/wilco_ec/event.c 
> b/drivers/platform/chrome/wilco_ec/event.c
> new file mode 100644
> index ..7601c02dffe8
> --- /dev/null
> +++ b/drivers/platform/chrome/wilco_ec/event.c
> @@ -0,0 +1,347 @@
> +// 

Re: [PATCH v6 11/16] sched/fair: Add uclamp support to energy_compute()

2019-01-22 Thread Patrick Bellasi
On 22-Jan 14:39, Quentin Perret wrote:
> On Tuesday 22 Jan 2019 at 14:26:06 (+), Patrick Bellasi wrote:
> > On 22-Jan 13:29, Quentin Perret wrote:
> > > On Tuesday 22 Jan 2019 at 12:45:46 (+), Patrick Bellasi wrote:
> > > > On 22-Jan 12:13, Quentin Perret wrote:
> > > > > On Tuesday 15 Jan 2019 at 10:15:08 (+), Patrick Bellasi wrote:
> > > > > > The Energy Aware Scheduler (AES) estimates the energy impact of 
> > > > > > waking

[...]

> > > Ah, sorry, I guess my message was misleading. I'm saying this is
> > > changing the way _EAS_ deals with RT tasks. Right now we don't actually
> > > consider the RT-go-to-max thing at all in the EAS prediction. Your
> > > patch is changing that AFAICT. It actually changes the way EAS sees RT
> > > tasks even without uclamp ...
> > 
> > Lemme see if I get it right.
> > 
> > Currently, whenever we look at CPU utilization for ENERGY_UTIL, we
> > always use cpu_util_rt() for RT tasks:
> > 
> > ---8<---
> > util = util_cfs;
> > util += cpu_util_rt(rq);
> > util += dl_util;
> > ---8<---
> > 
> > Thus, even when RT tasks are RUNNABLE, we don't always assume the CPU
> > running at the max capacity but just whatever is the aggregated
> > utilization across all the classes.
> > 
> > With uclamp, we have:
> > 
> > ---8<---
> > util = cpu_util_rt(rq) + util_cfs;
> > if (type == FREQUENCY_UTIL)
> > util = uclamp_util_with(rq, util, p);
> > dl_util = cpu_util_dl(rq);
> > if (type == ENERGY_UTIL)
> > util += dl_util;
> > ---8<---
> > 
> > So, I would say that, in terms of ENERGY_UTIL we do the same both
> > w/ and w/o uclamp. Isn't it?
> 
> Yes but now you use FREQUENCY_UTIL for computing 'max_util' in the EAS
> prediction.

Right, I overlook that "little" detail... :/

> Let's take an example. You have a perf domain with two CPUs. One CPU is
> busy running a RT task, the other CPU runs a CFS task. Right now in
> compute_energy() we only use ENERGY_UTIL, so 'max_util' ends up being
> the max between the utilization of the two tasks. So we don't predict
> we're going to max freq.

+1

> With your patch, we use FREQUENCY_UTIL to compute 'max_util', so we
> _will_ predict that we're going to max freq.

Right, with the default conf yes.

> And we will do that even if CONFIG_UCLAMP_TASK=n.

While this should not happen, as I wrote in the RT integration patch,
that's happening because I'm missing some compilation guard or
similar. In this configurations we should always go to max... will
look into that.

> The default EAS calculation will be different with your patch when there
> are runnable RT tasks in the system. This needs to be documented, I
> think.

Sure...

> > > But I'm not hostile to the idea since it's possible to enable uclamp and
> > > set the min cap to 0 for RT if you want. So there is a story there.
> > > However, I think this needs be documented somewhere, at the very least.
> > 
> > The only difference I see is that the actual frequency could be
> > different (lower then max) when a clamped RT task is RUNNABLE.
> > 
> > Are you worried that running RT on a lower freq could have side
> > effects on the estimated busy time the CPU ?
> > 
> > I also still don't completely get why you say it could be useful to
> >"set the min cap to 0 for RT if you want"
> 
> I'm not saying it's useful, I'm saying userspace can decide to do that
> if it thinks it is a good idea. The default should be min_cap = 1024 for
> RT, no questions. But you _can_ change it at runtime if you want to.
> That's my point. And doing that basically provides the same behaviour as
> what we have right now in terms of EAS calculation (but it changes the
> freq selection obviously) which is why I'm not fundamentally opposed to
> your patch.

Well, I think it's tricky to say whether the current or new approach
is better... it probably depends on the use-case.

> So in short, I'm fine with the behavioural change, but please at least
> mention it somewhere :-)

Anyway... agree, it's just that to add some documentation I need to
get what you are pointing out ;)

Will come up with some additional text to be added to the changelog

Maybe we can add a more detailed explanation of the different
behaviors you can get in the EAS documentation which is coming to
mainline ?

> Thanks,
> Quentin

-- 
#include 

Patrick Bellasi


Re: [PATCH v13 0/8] Introduce on-chip interconnect API

2019-01-22 Thread Greg KH
On Tue, Jan 22, 2019 at 04:45:20PM +0200, Georgi Djakov wrote:
> On 1/22/19 14:42, Greg KH wrote:
> > On Wed, Jan 16, 2019 at 06:10:55PM +0200, Georgi Djakov wrote:
> [..]
> > 
> > All now queued up, thanks.
> > 
> > greg k-h
> 
> Hi Greg,
> 
> Thanks for considering these patches! Actually i have a branch named
> icc-next [1] which is pulled into linux-next. I will drop these same
> patches to avoid conflicts.
> 
> If all is well, i was wondering how to proceed with follow-up patches.
> Some consumers of this API are already floating on the lists. How about
> sending you a pull request before the merge window with the collected
> patches?

Sure, that works, or you can just send them as patches, either works for
me.

greg k-h


[PATCH 2/5] mips: ralink: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: John Crispin 
Cc: Ralf Baechle 
Cc: Paul Burton 
Cc: James Hogan 
Cc: linux-m...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/mips/ralink/bootrom.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/arch/mips/ralink/bootrom.c b/arch/mips/ralink/bootrom.c
index e1fa5972a81d..648f5eb2ba68 100644
--- a/arch/mips/ralink/bootrom.c
+++ b/arch/mips/ralink/bootrom.c
@@ -35,13 +35,7 @@ static const struct file_operations bootrom_file_ops = {
 
 static int bootrom_setup(void)
 {
-   if (!debugfs_create_file("bootrom", 0444,
-   NULL, NULL, _file_ops)) {
-   pr_err("Failed to create bootrom debugfs file\n");
-
-   return -EINVAL;
-   }
-
+   debugfs_create_file("bootrom", 0444, NULL, NULL, _file_ops);
return 0;
 }
 
-- 
2.20.1



[PATCH 5/5] mips: kernel: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Ralf Baechle 
Cc: Paul Burton 
Cc: James Hogan 
Cc: Yangtao Li 
Cc: Andrew Morton 
Cc: Mike Rapoport 
Cc: Mathieu Malaterre 
Cc: Huacai Chen 
Cc: Marcin Nowakowski 
Cc: Yasha Cherikovsky 
Cc: linux-m...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/mips/kernel/mips-r2-to-r6-emul.c | 21 -
 arch/mips/kernel/segment.c| 15 +++
 arch/mips/kernel/setup.c  |  7 +--
 arch/mips/kernel/spinlock_test.c  | 21 -
 arch/mips/kernel/unaligned.c  | 16 
 5 files changed, 16 insertions(+), 64 deletions(-)

diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c 
b/arch/mips/kernel/mips-r2-to-r6-emul.c
index c50c89a978f1..b4d210bfcdae 100644
--- a/arch/mips/kernel/mips-r2-to-r6-emul.c
+++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
@@ -2351,23 +2351,10 @@ DEFINE_SHOW_ATTRIBUTE(mipsr2_clear);
 
 static int __init mipsr2_init_debugfs(void)
 {
-   struct dentry   *mipsr2_emul;
-
-   if (!mips_debugfs_dir)
-   return -ENODEV;
-
-   mipsr2_emul = debugfs_create_file("r2_emul_stats", S_IRUGO,
- mips_debugfs_dir, NULL,
- _emul_fops);
-   if (!mipsr2_emul)
-   return -ENOMEM;
-
-   mipsr2_emul = debugfs_create_file("r2_emul_stats_clear", S_IRUGO,
- mips_debugfs_dir, NULL,
- _clear_fops);
-   if (!mipsr2_emul)
-   return -ENOMEM;
-
+   debugfs_create_file("r2_emul_stats", S_IRUGO, mips_debugfs_dir, NULL,
+   _emul_fops);
+   debugfs_create_file("r2_emul_stats_clear", S_IRUGO, mips_debugfs_dir,
+   NULL, _clear_fops);
return 0;
 }
 
diff --git a/arch/mips/kernel/segment.c b/arch/mips/kernel/segment.c
index 2703f218202e..0a9bd7b0983b 100644
--- a/arch/mips/kernel/segment.c
+++ b/arch/mips/kernel/segment.c
@@ -95,18 +95,9 @@ static const struct file_operations segments_fops = {
 
 static int __init segments_info(void)
 {
-   struct dentry *segments;
-
-   if (cpu_has_segments) {
-   if (!mips_debugfs_dir)
-   return -ENODEV;
-
-   segments = debugfs_create_file("segments", S_IRUGO,
-  mips_debugfs_dir, NULL,
-  _fops);
-   if (!segments)
-   return -ENOMEM;
-   }
+   if (cpu_has_segments)
+   debugfs_create_file("segments", S_IRUGO, mips_debugfs_dir, NULL,
+   _fops);
return 0;
 }
 
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 8c6c48ed786a..44434e50a355 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -1010,12 +1010,7 @@ unsigned long fw_passed_dtb;
 struct dentry *mips_debugfs_dir;
 static int __init debugfs_mips(void)
 {
-   struct dentry *d;
-
-   d = debugfs_create_dir("mips", NULL);
-   if (!d)
-   return -ENOMEM;
-   mips_debugfs_dir = d;
+   mips_debugfs_dir = debugfs_create_dir("mips", NULL);
return 0;
 }
 arch_initcall(debugfs_mips);
diff --git a/arch/mips/kernel/spinlock_test.c b/arch/mips/kernel/spinlock_test.c
index eaed550e79a2..ab4e3e1b138d 100644
--- a/arch/mips/kernel/spinlock_test.c
+++ b/arch/mips/kernel/spinlock_test.c
@@ -118,23 +118,10 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, 
"%llu\n");
 
 static int __init spinlock_test(void)
 {
-   struct dentry *d;
-
-   if (!mips_debugfs_dir)
-   return -ENODEV;
-
-   d = debugfs_create_file("spin_single", S_IRUGO,
-   mips_debugfs_dir, NULL,
-   _ss);
-   if (!d)
-   return -ENOMEM;
-
-   d = debugfs_create_file("spin_multi", S_IRUGO,
-   mips_debugfs_dir, NULL,
-   _multi);
-   if (!d)
-   return -ENOMEM;
-
+   debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL,
+   _ss);
+   debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL,
+   _multi);
return 0;
 }
 device_initcall(spinlock_test);
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 595ca9c85111..0ed20a64b285 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -2374,18 +2374,10 @@ asmlinkage void do_ade(struct pt_regs *regs)
 #ifdef CONFIG_DEBUG_FS
 static int __init debugfs_unaligned(void)
 {
-   struct dentry *d;
-
-   if (!mips_debugfs_dir)
-   return -ENODEV;
-   d = 

[PATCH 3/5] mips: mm: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Ralf Baechle 
Cc: Paul Burton 
Cc: James Hogan 
Cc: Andy Shevchenko 
Cc: linux-m...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/mips/mm/sc-debugfs.c | 15 +++
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/arch/mips/mm/sc-debugfs.c b/arch/mips/mm/sc-debugfs.c
index 2a116084216f..9507421de335 100644
--- a/arch/mips/mm/sc-debugfs.c
+++ b/arch/mips/mm/sc-debugfs.c
@@ -55,20 +55,11 @@ static const struct file_operations sc_prefetch_fops = {
 
 static int __init sc_debugfs_init(void)
 {
-   struct dentry *dir, *file;
-
-   if (!mips_debugfs_dir)
-   return -ENODEV;
+   struct dentry *dir;
 
dir = debugfs_create_dir("l2cache", mips_debugfs_dir);
-   if (IS_ERR(dir))
-   return PTR_ERR(dir);
-
-   file = debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir,
-  NULL, _prefetch_fops);
-   if (!file)
-   return -ENOMEM;
-
+   debugfs_create_file("prefetch", S_IRUGO | S_IWUSR, dir, NULL,
+   _prefetch_fops);
return 0;
 }
 late_initcall(sc_debugfs_init);
-- 
2.20.1



[PATCH 1/5] mips: cavium: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Ralf Baechle 
Cc: Paul Burton 
Cc: James Hogan 
Cc: linux-m...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/mips/cavium-octeon/oct_ilm.c | 31 ---
 1 file changed, 4 insertions(+), 27 deletions(-)

diff --git a/arch/mips/cavium-octeon/oct_ilm.c 
b/arch/mips/cavium-octeon/oct_ilm.c
index 2d68a39f1443..0b6ec4c17896 100644
--- a/arch/mips/cavium-octeon/oct_ilm.c
+++ b/arch/mips/cavium-octeon/oct_ilm.c
@@ -63,31 +63,12 @@ static int reset_statistics(void *data, u64 value)
 
 DEFINE_SIMPLE_ATTRIBUTE(reset_statistics_ops, NULL, reset_statistics, 
"%llu\n");
 
-static int init_debufs(void)
+static void init_debugfs(void)
 {
-   struct dentry *show_dentry;
dir = debugfs_create_dir("oct_ilm", 0);
-   if (!dir) {
-   pr_err("oct_ilm: failed to create debugfs entry oct_ilm\n");
-   return -1;
-   }
-
-   show_dentry = debugfs_create_file("statistics", 0222, dir, NULL,
- _ilm_ops);
-   if (!show_dentry) {
-   pr_err("oct_ilm: failed to create debugfs entry 
oct_ilm/statistics\n");
-   return -1;
-   }
-
-   show_dentry = debugfs_create_file("reset", 0222, dir, NULL,
- _statistics_ops);
-   if (!show_dentry) {
-   pr_err("oct_ilm: failed to create debugfs entry 
oct_ilm/reset\n");
-   return -1;
-   }
-
+   debugfs_create_file("statistics", 0222, dir, NULL, _ilm_ops);
+   debugfs_create_file("reset", 0222, dir, NULL, _statistics_ops);
return 0;
-
 }
 
 static void init_latency_info(struct latency_info *li, int startup)
@@ -169,11 +150,7 @@ static __init int oct_ilm_module_init(void)
int rc;
int irq = OCTEON_IRQ_TIMER0 + TIMER_NUM;
 
-   rc = init_debufs();
-   if (rc) {
-   WARN(1, "Could not create debugfs entries");
-   return rc;
-   }
+   init_debugfs();
 
rc = request_irq(irq, cvm_oct_ciu_timer_interrupt, IRQF_NO_THREAD,
 "oct_ilm", 0);
-- 
2.20.1



[PATCH 4/5] mips: math-emu: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Ralf Baechle 
Cc: Paul Burton 
Cc: James Hogan 
Cc: Yangtao Li 
Cc: linux-m...@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/mips/math-emu/me-debugfs.c | 23 ---
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git a/arch/mips/math-emu/me-debugfs.c b/arch/mips/math-emu/me-debugfs.c
index 58798f527356..387724860fa6 100644
--- a/arch/mips/math-emu/me-debugfs.c
+++ b/arch/mips/math-emu/me-debugfs.c
@@ -189,32 +189,21 @@ static int __init debugfs_fpuemu(void)
 {
struct dentry *fpuemu_debugfs_base_dir;
struct dentry *fpuemu_debugfs_inst_dir;
-   struct dentry *d, *reset_file;
-
-   if (!mips_debugfs_dir)
-   return -ENODEV;
 
fpuemu_debugfs_base_dir = debugfs_create_dir("fpuemustats",
 mips_debugfs_dir);
-   if (!fpuemu_debugfs_base_dir)
-   return -ENOMEM;
 
-   reset_file = debugfs_create_file("fpuemustats_clear", 0444,
-mips_debugfs_dir, NULL,
-_clear_fops);
-   if (!reset_file)
-   return -ENOMEM;
+   debugfs_create_file("fpuemustats_clear", 0444, mips_debugfs_dir, NULL,
+   _clear_fops);
 
 #define FPU_EMU_STAT_OFFSET(m) \
offsetof(struct mips_fpu_emulator_stats, m)
 
 #define FPU_STAT_CREATE(m) \
 do {   \
-   d = debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir,  \
+   debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir,  \
(void *)FPU_EMU_STAT_OFFSET(m), \
_fpuemu_stat); \
-   if (!d) \
-   return -ENOMEM; \
 } while (0)
 
FPU_STAT_CREATE(emulated);
@@ -233,8 +222,6 @@ do {
\
 
fpuemu_debugfs_inst_dir = debugfs_create_dir("instructions",
 fpuemu_debugfs_base_dir);
-   if (!fpuemu_debugfs_inst_dir)
-   return -ENOMEM;
 
 #define FPU_STAT_CREATE_EX(m)  \
 do {   \
@@ -242,11 +229,9 @@ do {   
\
\
adjust_instruction_counter_name(name, #m);  \
\
-   d = debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir,\
+   debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir,\
(void *)FPU_EMU_STAT_OFFSET(m), \
_fpuemu_stat); \
-   if (!d) \
-   return -ENOMEM; \
 } while (0)
 
FPU_STAT_CREATE_EX(abs_s);
-- 
2.20.1



Re: [PATCH v11 perf, bpf-next 7/9] perf tools: synthesize PERF_RECORD_* for loaded BPF programs

2019-01-22 Thread Arnaldo Carvalho de Melo
Em Tue, Jan 22, 2019 at 03:51:19PM +0100, Jiri Olsa escreveu:
> On Tue, Jan 22, 2019 at 12:31:17PM -0200, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Jan 22, 2019 at 12:13:20PM -0200, Arnaldo Carvalho de Melo escreveu:
> > > Em Fri, Jan 18, 2019 at 11:46:55AM -0300, Arnaldo Carvalho de Melo 
> > > escreveu:
> > > > Em Thu, Jan 17, 2019 at 08:15:19AM -0800, Song Liu escreveu:
> > > > > This patch synthesize PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT 
> > > > > for
> > > > > BPF programs loaded before perf-record. This is achieved by gathering
> > > > > information about all BPF programs via sys_bpf.
> > > > 
> > > > Ditto
> > > 
> > > This is breaking 'perf sched', see below, the fix seems trivial:
> > > 
> > > [root@quaco ~]# perf sched record -a sleep 2
> > > [ perf record: Woken up 1 times to write data ]
> > > 0x5b60 [0x138]: failed to process type: 17
> > > [ perf record: Captured and wrote 1.539 MB perf.data ]
> > > [root@quaco ~]# perf sched lat
> > > 0x5b60 [0x138]: failed to process type: 17
> > > Failed to process events, error -22
> > > [root@quaco ~]#
> > 
> > So:
> > 
> >perf_session__process_event (event->header.type = 17 
> > (PERF_RECORD_KSYMBOL)
> >  if (tool->ordered_events)
> >ret = perf_evlist__parse_sample_timestamp(evlist, event, );
> >if (ret && ret != -1)
> > return ret;
> > 
> > So it returns here with -EFAULT, i.e. this is failing:
> > 
> > int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
> > union perf_event *event,
> > u64 *timestamp)
> > {
> > struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event);
> > 
> > if (!evsel)
> > return -EFAULT;
> > return perf_evsel__parse_sample_timestamp(evsel, event, timestamp);
> > }
> > 
> > It isn't mapping the event ID it finds back to an evsel.. Jiri, ideas?
> > 
> > This is happening so far only for 'perf sched', perf record with two
> > events works.
> 
> I saw also perf mem failing because of this.. will check

Right, seems something with the synthesizing of existing bpf progs,
which always there are some nowadays, for instance, on this fedora29
system:

[root@quaco tmp]# bpftool prog
13: cgroup_skb  tag 7be49e3934a125ba  gpl
loaded_at 2019-01-21T13:30:27-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 13,14
14: cgroup_skb  tag 2a142ef67aaad174  gpl
loaded_at 2019-01-21T13:30:27-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 13,14
15: cgroup_skb  tag 7be49e3934a125ba  gpl
loaded_at 2019-01-21T13:30:27-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 15,16
16: cgroup_skb  tag 2a142ef67aaad174  gpl
loaded_at 2019-01-21T13:30:27-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 15,16
17: cgroup_skb  tag 7be49e3934a125ba  gpl
loaded_at 2019-01-21T13:30:29-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 17,18
18: cgroup_skb  tag 2a142ef67aaad174  gpl
loaded_at 2019-01-21T13:30:29-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 17,18
21: cgroup_skb  tag 7be49e3934a125ba  gpl
loaded_at 2019-01-21T13:30:29-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 21,22
22: cgroup_skb  tag 2a142ef67aaad174  gpl
loaded_at 2019-01-21T13:30:29-0200  uid 0
xlated 296B  jited 229B  memlock 4096B  map_ids 21,22
[root@quaco tmp]#

When with a bunch of tracepoints, that is what 'perf mem', 'perf kmem',
'perf sched', etc does, it ends up failing here:

ret = perf_evlist__parse_sample_timestamp(evlist, event, 
);

So it is not passed to 

   ret = perf_session__queue_event(session, event, timestamp, 
file_offset);

in perf_session__process_event, this happens right when processing
buildids in 'perf record', and also in 'perf report', so that is
something badly synthesized that hits perf.data for PERF_RECORD_KSYMBOL.

- Arnaldo


[PATCH 0/5] mips: cleanup debugfs usage

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not.  Fix up a bunch of x86-specific code to not care about
the results of debugfs.

Greg Kroah-Hartman (5):
  mips: cavium: no need to check return value of debugfs_create
functions
  mips: ralink: no need to check return value of debugfs_create
functions
  mips: mm: no need to check return value of debugfs_create functions
  mips: math-emu: no need to check return value of debugfs_create
functions
  mips: kernel: no need to check return value of debugfs_create
functions

 arch/mips/cavium-octeon/oct_ilm.c | 31 ---
 arch/mips/kernel/mips-r2-to-r6-emul.c | 21 --
 arch/mips/kernel/segment.c| 15 +++--
 arch/mips/kernel/setup.c  |  7 +-
 arch/mips/kernel/spinlock_test.c  | 21 --
 arch/mips/kernel/unaligned.c  | 16 --
 arch/mips/math-emu/me-debugfs.c   | 23 
 arch/mips/mm/sc-debugfs.c | 15 +++--
 arch/mips/ralink/bootrom.c|  8 +--
 9 files changed, 28 insertions(+), 129 deletions(-)

-- 
2.20.1



Re: [PATCH v6 05/16] sched/core: uclamp: Update CPU's refcount on clamp changes

2019-01-22 Thread Peter Zijlstra
On Tue, Jan 22, 2019 at 02:01:15PM +, Patrick Bellasi wrote:
> On 22-Jan 14:28, Peter Zijlstra wrote:
> > On Tue, Jan 22, 2019 at 10:43:05AM +, Patrick Bellasi wrote:
> > > On 22-Jan 10:37, Peter Zijlstra wrote:
> > 
> > > > Sure, I get that. What I don't get is why you're adding that (2) here.
> > > > Like said, __sched_setscheduler() already does a dequeue/enqueue under
> > > > rq->lock, which should already take care of that.
> > > 
> > > Oh, ok... got it what you mean now.
> > > 
> > > With:
> > > 
> > >[PATCH v6 01/16] sched/core: Allow sched_setattr() to use the current 
> > > policy
> > ><20190115101513.2822-2-patrick.bell...@arm.com>
> > > 
> > > we can call __sched_setscheduler() with:
> > > 
> > >attr->sched_flags & SCHED_FLAG_KEEP_POLICY
> > > 
> > > whenever we want just to change the clamp values of a task without
> > > changing its class. Thus, we can end up returning from
> > > __sched_setscheduler() without doing an actual dequeue/enqueue.
> > 
> > I don't see that happening.. when KEEP_POLICY we set attr.sched_policy =
> > SETPARAM_POLICY. That is then checked again in __setscheduler_param(),
> > which is in the middle of that dequeue/enqueue.
> 
> Yes, I think I've forgot a check before we actually dequeue the task.
> 
> The current code does:
> 
> ---8<---
>SYSCALL_DEFINE3(sched_setattr)
> 
> // A) request to keep the same policy
> if (attr.sched_flags & SCHED_FLAG_KEEP_POLICY)
> attr.sched_policy = SETPARAM_POLICY;
> 
> sched_setattr()
> // B) actually enforce the same policy
> if (policy < 0)
> policy = oldpolicy = p->policy;
> 
> // C) tune the clamp values
> if (attr->sched_flags & SCHED_FLAG_UTIL_CLAMP)
> retval = __setscheduler_uclamp(p, attr);
> 
> // D) tune attributes if policy is the same
> if (unlikely(policy == p->policy))
> if (fair_policy(policy) && attr->sched_nice != task_nice(p))
> goto change;
> if (rt_policy(policy) && attr->sched_priority != 
> p->rt_priority)
> goto change;
> if (dl_policy(policy) && dl_param_changed(p, attr))
> goto change;

  if (util_changed)
  goto change;

?

> return 0;
> change:
> 
> // E) dequeue/enqueue task
> ---8<---
> 
> So, probably in D) I've missed a check on SCHED_FLAG_KEEP_POLICY to
> enforce a return in that case...
> 
> > Also, and this might be 'broken', SETPARAM_POLICY _does_ reset all the
> > other attributes, it only preserves policy, but it will (re)set nice
> > level for example (see that same function).
> 
> Mmm... right... my bad! :/
> 
> > So maybe we want to introduce another (few?) FLAG_KEEP flag(s) that
> > preserve the other bits; I'm thinking at least KEEP_PARAM and KEEP_UTIL
> > or something.
> 
> Yes, I would say we have two options:
> 
>  1) SCHED_FLAG_KEEP_POLICY enforces all the scheduling class specific
> attributes, but cross class attributes (e.g. uclamp)
>
>  2) add SCHED_KEEP_NICE, SCHED_KEEP_PRIO, and SCED_KEEP_PARAMS
> and use them in the if conditions in D)

So the current KEEP_POLICY basically provides sched_setparam(), and
given we have that as a syscall, that is supposedly a useful
functionality.

Also, NICE/PRIO/DL* is all the same thing and depends on the policy,
KEEP_PARAM should cover the lot

And I suppose the UTIL_CLAMP is !KEEP_UTIL; we could go either way
around with that flag.

> In both cases the goal should be to return from code block D).

I don't think so; we really do want to 'goto change' for util changes
too I think. Why duplicate part of that logic?


Re: [PATCH v3 5/9] platform/chrome: rtc: Add RTC driver

2019-01-22 Thread Enric Balletbo Serra
Hi Nick,

Missatge de Nick Crews  del dia ds., 19 de gen.
2019 a les 1:17:
>
> From: Duncan Laurie 
>
> This Embedded Controller has an internal RTC that is exposed
> as a standard RTC class driver with read/write functionality.
>
> The driver is added to the drivers/rtc/ so that the maintainer of that
> directory will be able to comment on this change, as that maintainer is
> the expert on this system. In addition, the driver code is called
> indirectly after a corresponding device is registered from core.c,
> as opposed to core.c registering the driver callbacks directly.
>
> > hwclock --show --rtc /dev/rtc1
> 2007-12-31 16:01:20.460959-08:00
> > hwclock --systohc --rtc /dev/rtc1
> > hwclock --show --rtc /dev/rtc1
> 2018-11-29 17:08:00.780793-08:00
>
> Signed-off-by: Duncan Laurie 
> Signed-off-by: Nick Crews 
> ---
>
> Changes in v3:
> - rm #define for driver name
> - Don't compute weekday when reading from RTC.
>   Still set weekday when writing, as RTC needs this
>   to control advanced power scheduling
> - rm check for invalid month data
> - Set range_min and range_max on rtc_device
>
> Changes in v2:
> - rm license boiler plate
> - rm "wilco_ec_rtc -" prefix in docstring
> - Make rtc driver its own module within the drivers/rtc/ directory
> - Register a rtc device from core.c that is picked up by this driver
>
>  drivers/platform/chrome/wilco_ec/core.c |  17 +++

Acked-by: Enric Balletbo i Serra 

>  drivers/rtc/Kconfig |  11 ++
>  drivers/rtc/Makefile|   1 +
>  drivers/rtc/rtc-wilco-ec.c  | 177 
>  4 files changed, 206 insertions(+)
>  create mode 100644 drivers/rtc/rtc-wilco-ec.c
>
> diff --git a/drivers/platform/chrome/wilco_ec/core.c 
> b/drivers/platform/chrome/wilco_ec/core.c
> index 9b4a25e63b56..dd8b896b3833 100644
> --- a/drivers/platform/chrome/wilco_ec/core.c
> +++ b/drivers/platform/chrome/wilco_ec/core.c
> @@ -34,6 +34,7 @@ static int wilco_ec_probe(struct platform_device *pdev)
>  {
> struct device *dev = >dev;
> struct wilco_ec_device *ec;
> +   struct platform_device *child_pdev;
> int ret;
>
> ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
> @@ -76,8 +77,24 @@ static int wilco_ec_probe(struct platform_device *pdev)
> goto rm_debugfs;
> }
>
> +   /*
> +* Register a RTC platform device that will get picked up by the RTC
> +* subsystem. This platform device will get freed when its parent 
> device
> +* dev is unregistered.
> +*/
> +   child_pdev = platform_device_register_data(dev, "rtc-wilco-ec",
> +  PLATFORM_DEVID_AUTO,
> +  NULL, 0);
> +   if (IS_ERR(child_pdev)) {
> +   dev_err(dev, "Failed to create RTC platform device\n");
> +   ret = PTR_ERR(child_pdev);
> +   goto remove_sysfs;
> +   }
> +
> return 0;
>
> +remove_sysfs:
> +   wilco_ec_sysfs_remove(ec);
>  rm_debugfs:
> wilco_ec_debugfs_remove(ec);
>  destroy_mec:
> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 225b0b8516f3..d5063c791515 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1814,4 +1814,15 @@ config RTC_DRV_GOLDFISH
>   Goldfish is a code name for the virtual platform developed by Google
>   for Android emulation.
>
> +config RTC_DRV_WILCO_EC
> +   tristate "Wilco EC RTC"
> +   depends on WILCO_EC
> +   default m
> +   help
> + If you say yes here, you get read/write support for the Real Time
> + Clock on the Wilco Embedded Controller (Wilco is a kind of 
> Chromebook)
> +
> + This can also be built as a module. If so, the module will
> + be named "rtc_wilco_ec".
> +
>  endif # RTC_CLASS
> diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
> index df022d820bee..6255ea78da25 100644
> --- a/drivers/rtc/Makefile
> +++ b/drivers/rtc/Makefile
> @@ -172,6 +172,7 @@ obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o
>  obj-$(CONFIG_RTC_DRV_VR41XX)   += rtc-vr41xx.o
>  obj-$(CONFIG_RTC_DRV_VRTC) += rtc-mrst.o
>  obj-$(CONFIG_RTC_DRV_VT8500)   += rtc-vt8500.o
> +obj-$(CONFIG_RTC_DRV_WILCO_EC) += rtc-wilco-ec.o
>  obj-$(CONFIG_RTC_DRV_WM831X)   += rtc-wm831x.o
>  obj-$(CONFIG_RTC_DRV_WM8350)   += rtc-wm8350.o
>  obj-$(CONFIG_RTC_DRV_X1205)+= rtc-x1205.o
> diff --git a/drivers/rtc/rtc-wilco-ec.c b/drivers/rtc/rtc-wilco-ec.c
> new file mode 100644
> index ..b721cc3f17f0
> --- /dev/null
> +++ b/drivers/rtc/rtc-wilco-ec.c
> @@ -0,0 +1,177 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * RTC interface for Wilco Embedded Controller with R/W abilities
> + *
> + * Copyright 2018 Google LLC
> + *
> + * The corresponding platform device is typically registered in
> + * drivers/platform/chrome/wilco_ec/core.c
> + */
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Re: [Qestion] Softlockup when send IPI to other CPUs

2019-01-22 Thread Mark Rutland
Hi Will,

On Tue, Jan 22, 2019 at 05:44:02AM +, Will Deacon wrote:
> On Mon, Jan 21, 2019 at 02:21:28PM +, Catalin Marinas wrote:
> > On Sat, Jan 19, 2019 at 11:58:27PM +, Will Deacon wrote:
> > > On Thu, Jan 17, 2019 at 07:42:44AM +, chenwandun wrote:
> > > > Recently, I do some tests on linux-4.19 and hit a softlockup issue.
> > > > 
> > > > I find some CPUs get the spinlock in the __split_huge_pmd function and
> > > > then send IPI to other CPUs, waiting the response, while several CPUs
> > > > enter the __split_huge_pmd function, want to get the spinlock, but 
> > > > always
> > > > in queued_spin_lock_slowpath,
> > > > 
> > > > Because long time no response to the IPI, that results in a softlockup.
> > > > 
> > > > As to sending IPI, it was in the patch
> > > > 3b8c9f1cdfc506e94e992ae66b68bbe416f89610.  The patch is mean to send IPI
> > > > to each CPU after invalidating the I-cache for kernel mappings.  In this
> > > > case, after modify pmd, it sends IPI to other CPUS to sync memory
> > > > mappings.
> > > > 
> > > > No stable test case to repeat the result, it is hard to repeat the test 
> > > > procedure.
> > > > 
> > > > The environment is arm64, 64 CPUs. Except for idle CPU, there are 6 kind
> > > > of callstacks in total.
> > > 
> > > This looks like another lockup that would be solved if we deferred our
> > > I-cache invalidation when mapping user-executable pages, and instead
> > > performed the invalidation off the back of a UXN permission fault, where 
> > > we
> > > could avoid holding any locks.
> > 
> > Looking back at commit 3b8c9f1cdfc5 ("arm64: IPI each CPU after
> > invalidating the I-cache for kernel mappings"), the text implies that it
> > should only do this for kernel mappings. I don't think we need this for
> > user mappings. We have a few scenarios where we invoke set_pte_at() with
> > exec permission:
> 
> Yes, I think you're right. I got confused because in this case we are
> invalidating lines written by the kernel, but actually it's not about who
> writes the data, but about whether or not the page table is being changed.

IIUC we may have a userspace problem analagous to the kernel modules
problem, if userspace uses dlopen/dlclose to dynamically load/unload
shared objects.

If userspace unloads an object, then loads another, the new object might
get placed at the same VA. A PE could have started speculating
instructions from the old object, and IIUC the TLB invalidation and
I-cache maintenance don't cause those instructions be re-fetched from
the I-cache unless there's a context synchronization event.

Do we require the use of membarrier when loading or unloading objects?
If so, when does that happen relative to the unmap or map?

Thanks,
Mark.


LAHJOITUS

2019-01-22 Thread cfonturportuguesa
$ 1,000,000.00 dollaria on lahjoittanut sinulle Maureen David Kaltschmidt, joka 
voitti 758,7 miljoonan dollarin Powerball Jackpotin. Ota yhteyttä 
sähköpostitse: maureendavidkaltschmidt...@gmail.com saadaksesi lisätietoja


Re: [PATCH 2/2] ARM: dts: Add stmpe-adc DT node to Toradex T30 modules

2019-01-22 Thread Stefan Agner
On 22.01.2019 14:21, Philippe Schenker wrote:
> From: Philippe Schenker 
> 
> Add the stmpe-adc DT node as found on Toradex T30 modules
> 
> Signed-off-by: Philippe Schenker 

Reviewed-by: Stefan Agner 

> 
> ---
> 
>  arch/arm/boot/dts/tegra30-apalis-v1.1.dtsi | 22 ++
>  arch/arm/boot/dts/tegra30-apalis.dtsi  | 22 ++
>  arch/arm/boot/dts/tegra30-colibri.dtsi | 22 ++
>  3 files changed, 42 insertions(+), 24 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/tegra30-apalis-v1.1.dtsi
> b/arch/arm/boot/dts/tegra30-apalis-v1.1.dtsi
> index 02f8126481a2..8b7a827d604d 100644
> --- a/arch/arm/boot/dts/tegra30-apalis-v1.1.dtsi
> +++ b/arch/arm/boot/dts/tegra30-apalis-v1.1.dtsi
> @@ -994,11 +994,17 @@
>   id = <0>;
>   blocks = <0x5>;
>   irq-trigger = <0x1>;
> + /* 3.25 MHz ADC clock speed */
> + st,adc-freq = <1>;
> + /* 12-bit ADC */
> + st,mod-12b = <1>;
> + /* internal ADC reference */
> + st,ref-sel = <0>;
> + /* ADC converstion time: 80 clocks */
> + st,sample-time = <4>;
>  
>   stmpe_touchscreen {
>   compatible = "st,stmpe-ts";
> - /* 3.25 MHz ADC clock speed */
> - st,adc-freq = <1>;
>   /* 8 sample average control */
>   st,ave-ctrl = <3>;
>   /* 7 length fractional part in z */
> @@ -1008,17 +1014,17 @@
>* current limit value
>*/
>   st,i-drive = <1>;
> - /* 12-bit ADC */
> - st,mod-12b = <1>;
> - /* internal ADC reference */
> - st,ref-sel = <0>;
> - /* ADC converstion time: 80 clocks */
> - st,sample-time = <4>;
>   /* 1 ms panel driver settling time */
>   st,settling = <3>;
>   /* 5 ms touch detect interrupt delay */
>   st,touch-det-delay = <5>;
>   };
> +
> + stmpe_adc {
> + compatible = "st,stmpe-adc";
> + /* forbid to use ADC channels 3-0 (touch) */
> + st,norequest-mask = <0x0F>;
> + };
>   };
>  
>   /*
> diff --git a/arch/arm/boot/dts/tegra30-apalis.dtsi
> b/arch/arm/boot/dts/tegra30-apalis.dtsi
> index 7f112f192fe9..c18f6f61d764 100644
> --- a/arch/arm/boot/dts/tegra30-apalis.dtsi
> +++ b/arch/arm/boot/dts/tegra30-apalis.dtsi
> @@ -976,11 +976,17 @@
>   id = <0>;
>   blocks = <0x5>;
>   irq-trigger = <0x1>;
> + /* 3.25 MHz ADC clock speed */
> + st,adc-freq = <1>;
> + /* 12-bit ADC */
> + st,mod-12b = <1>;
> + /* internal ADC reference */
> + st,ref-sel = <0>;
> + /* ADC converstion time: 80 clocks */
> + st,sample-time = <4>;
>  
>   stmpe_touchscreen {
>   compatible = "st,stmpe-ts";
> - /* 3.25 MHz ADC clock speed */
> - st,adc-freq = <1>;
>   /* 8 sample average control */
>   st,ave-ctrl = <3>;
>   /* 7 length fractional part in z */
> @@ -990,17 +996,17 @@
>* current limit value
>*/
>   st,i-drive = <1>;
> - /* 12-bit ADC */
> - st,mod-12b = <1>;
> - /* internal ADC reference */
> - st,ref-sel = <0>;
> - /* ADC converstion time: 80 clocks */
> - st,sample-time = <4>;
>   /* 1 ms panel driver settling time */
>   st,settling = <3>;
>   /* 5 ms touch detect interrupt delay */
>   st,touch-det-delay = <5>;
>   };
> +
> + stmpe_adc {
> + compatible = "st,stmpe-adc";
> + /* forbid to use ADC channels 3-0 (touch) */
> + st,norequest-mask = <0x0F>;
> + };
>   };
>  
>

Verificação de e-mail

2019-01-22 Thread Administración de correo web
Web de correo electrónico de administración de notificaciones

Este mensaje es de nuestro centro de mensajería Web Admin a todos nuestros 
propietarios de cuentas de correo electrónico. Estamos eliminando el acceso a 
todos nuestros clientes de correo web. Su cuenta de correo electrónico se 
actualizará a una nueva y mejorada interfaz de usuario de correo web 
proporcionada por nuestro Administrador tan pronto como este correo electrónico 
haya sido recibido.

Descontinuaremos el uso de nuestras interfaces webmail Lite, para asegurarnos 
de que su libreta de direcciones de correo electrónico esté guardada en nuestra 
base de datos, haga clic o copie y pegue el siguiente enlace en su navegador e 
ingrese su nombre de usuario y contraseña para actualizar su cuenta.

Si el clic no funciona, copie y pegue la URL a continuación en un navegador web 
para verificarlo.

Haga clic en el enlace http://administradordecorreo.xtgem.com/index si el clic 
no funciona, copie y pegue en su navegador web y actualice su cuenta para que 
podamos transferir sus contactos a nuestra nueva base de datos de clientes de 
correo web.

¡Todos los correos electrónicos estarán seguros en esta transición! Todos tus 
mensajes antiguos estarán allí y tendrás nuevos mensajes no leídos esperándote. 
Fueron
Seguro que te gustará la nueva y mejorada interfaz de correo web.

Si no cumple con este aviso, inmediatamente retiraremos el acceso a su cuenta 
de correo electrónico.

Gracias por usar nuestro webmail.

== 
== =
Número de registro 65628698L)
ID de cliente 779862
== 
== =

Sinceramente Web Admin.
Correo electrónico Servicio al cliente 46569 Copyright c 2019 E! Inc. (Co
Reg.No. 65628698L) Todos los derechos reservados.


Re: [PATCH 1/2] ARM: dts: Add stmpe-adc DT node to Toradex iMX6 modules

2019-01-22 Thread Stefan Agner
On 22.01.2019 14:21, Philippe Schenker wrote:
> From: Philippe Schenker 
> 
> Add the stmpe-adc DT node as found on Toradex iMX6 modules
> 
> Signed-off-by: Philippe Schenker 

Reviewed-by: Stefan Agner 

> ---
> 
>  arch/arm/boot/dts/imx6qdl-apalis.dtsi  | 22 ++
>  arch/arm/boot/dts/imx6qdl-colibri.dtsi | 22 ++
>  2 files changed, 28 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> index 8380f1b26826..e8c7ef7e078a 100644
> --- a/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-apalis.dtsi
> @@ -332,11 +332,17 @@
>   id = <0>;
>   blocks = <0x5>;
>   irq-trigger = <0x1>;
> + /* 3.25 MHz ADC clock speed */
> + st,adc-freq = <1>;
> + /* 12-bit ADC */
> + st,mod-12b = <1>;
> + /* internal ADC reference */
> + st,ref-sel = <0>;
> + /* ADC converstion time: 80 clocks */
> + st,sample-time = <4>;
>  
>   stmpe_touchscreen {
>   compatible = "st,stmpe-ts";
> - /* 3.25 MHz ADC clock speed */
> - st,adc-freq = <1>;
>   /* 8 sample average control */
>   st,ave-ctrl = <3>;
>   /* 7 length fractional part in z */
> @@ -346,17 +352,17 @@
>* current limit value
>*/
>   st,i-drive = <1>;
> - /* 12-bit ADC */
> - st,mod-12b = <1>;
> - /* internal ADC reference */
> - st,ref-sel = <0>;
> - /* ADC converstion time: 80 clocks */
> - st,sample-time = <4>;
>   /* 1 ms panel driver settling time */
>   st,settling = <3>;
>   /* 5 ms touch detect interrupt delay */
>   st,touch-det-delay = <5>;
>   };
> +
> + stmpe_adc {
> + compatible = "st,stmpe-adc";
> + /* forbid to use ADC channels 3-0 (touch) */
> + st,norequest-mask = <0x0F>;
> + };
>   };
>  };
>  
> diff --git a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> index 87e15e7cb32b..eb8603a2444e 100644
> --- a/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-colibri.dtsi
> @@ -262,11 +262,17 @@
>   id = <0>;
>   blocks = <0x5>;
>   irq-trigger = <0x1>;
> + /* 3.25 MHz ADC clock speed */
> + st,adc-freq = <1>;
> + /* 12-bit ADC */
> + st,mod-12b = <1>;
> + /* internal ADC reference */
> + st,ref-sel = <0>;
> + /* ADC converstion time: 80 clocks */
> + st,sample-time = <4>;
>  
>   stmpe_touchscreen {
>   compatible = "st,stmpe-ts";
> - /* 3.25 MHz ADC clock speed */
> - st,adc-freq = <1>;
>   /* 8 sample average control */
>   st,ave-ctrl = <3>;
>   /* 7 length fractional part in z */
> @@ -276,17 +282,17 @@
>* current limit value
>*/
>   st,i-drive = <1>;
> - /* 12-bit ADC */
> - st,mod-12b = <1>;
> - /* internal ADC reference */
> - st,ref-sel = <0>;
> - /* ADC converstion time: 80 clocks */
> - st,sample-time = <4>;
>   /* 1 ms panel driver settling time */
>   st,settling = <3>;
>   /* 5 ms touch detect interrupt delay */
>   st,touch-det-delay = <5>;
>   };
> +
> + stmpe_adc {
> + compatible = "st,stmpe-adc";
> + /* forbid to use ADC channels 3-0 (touch) */
> + st,norequest-mask = <0x0F>;
> + };
>   };
>  };


Re: [PATCH v11 perf, bpf-next 7/9] perf tools: synthesize PERF_RECORD_* for loaded BPF programs

2019-01-22 Thread Jiri Olsa
On Tue, Jan 22, 2019 at 12:31:17PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jan 22, 2019 at 12:13:20PM -0200, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Jan 18, 2019 at 11:46:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Thu, Jan 17, 2019 at 08:15:19AM -0800, Song Liu escreveu:
> > > > This patch synthesize PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT for
> > > > BPF programs loaded before perf-record. This is achieved by gathering
> > > > information about all BPF programs via sys_bpf.
> > > 
> > > Ditto
> > 
> > This is breaking 'perf sched', see below, the fix seems trivial:
> > 
> > [root@quaco ~]# perf sched record -a sleep 2
> > [ perf record: Woken up 1 times to write data ]
> > 0x5b60 [0x138]: failed to process type: 17
> > [ perf record: Captured and wrote 1.539 MB perf.data ]
> > [root@quaco ~]# perf sched lat
> > 0x5b60 [0x138]: failed to process type: 17
> > Failed to process events, error -22
> > [root@quaco ~]#
> 
> So:
> 
>perf_session__process_event (event->header.type = 17 (PERF_RECORD_KSYMBOL)
>  if (tool->ordered_events)
>ret = perf_evlist__parse_sample_timestamp(evlist, event, );
>if (ret && ret != -1)
> return ret;
> 
> So it returns here with -EFAULT, i.e. this is failing:
> 
> int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
> union perf_event *event,
> u64 *timestamp)
> {
> struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event);
> 
> if (!evsel)
> return -EFAULT;
> return perf_evsel__parse_sample_timestamp(evsel, event, timestamp);
> }
> 
> It isn't mapping the event ID it finds back to an evsel.. Jiri, ideas?
> 
> This is happening so far only for 'perf sched', perf record with two
> events works.

I saw also perf mem failing because of this.. will check

jirka


Re: [RFC PATCH v1 05/13] mfd: bd70528: Support ROHM bd70528 PMIC - core

2019-01-22 Thread Guenter Roeck

On 1/22/19 1:44 AM, Matti Vaittinen wrote:

ROHM BD70528MWV is an ultra-low quiescent current general
purpose single-chip power management IC for battery-powered
portable devices.

Add MFD core which enables chip access for following subdevices:
- regulators/LED drivers
- battery-charger
- gpios
- 32.768kHz clk
- RTC
- watchdog

Signed-off-by: Matti Vaittinen 
---
  drivers/mfd/Kconfig  |  17 ++
  drivers/mfd/Makefile |   1 +
  drivers/mfd/rohm-bd70528.c   | 409 +++
  include/linux/mfd/rohm-bd70528.h | 392 +
  4 files changed, 819 insertions(+)
  create mode 100644 drivers/mfd/rohm-bd70528.c
  create mode 100644 include/linux/mfd/rohm-bd70528.h

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 8c5dfdce4326..d47eca440ece 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1846,6 +1846,23 @@ config MFD_ROHM_BD718XX
  NXP i.MX8. It contains 8 BUCK outputs and 7 LDOs, voltage monitoring
  and emergency shut down as well as 32,768KHz clock output.
  
+config MFD_ROHM_BD70528

+   tristate "ROHM BD70528 Power Management IC"
+   depends on I2C=y
+   depends on OF
+   select REGMAP_I2C
+   select REGMAP_IRQ
+   select MFD_CORE
+   help
+ Select this option to get support for the ROHM BD70528 Power
+ Management IC. BD71837 is general purpose single-chip power
+ management IC for battery-powered portable devices. It contains
+ 3 ultra-low current consumption buck converters, 3 LDOs and 2 LED
+ Drivers. Also included are 4 GPIOs, a real-time clock (RTC), a 32kHz
+ crystal oscillator, high-accuracy VREF for use with an external ADC,
+ 10 bits SAR ADC for battery temperature monitor and 1S battery
+ charger.
+
  config MFD_STM32_LPTIMER
tristate "Support for STM32 Low-Power Timer"
depends on (ARCH_STM32 && OF) || COMPILE_TEST
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 12980a4ad460..fc9b1408e39b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -241,4 +241,5 @@ obj-$(CONFIG_MFD_MXS_LRADC) += mxs-lradc.o
  obj-$(CONFIG_MFD_SC27XX_PMIC) += sprd-sc27xx-spi.o
  obj-$(CONFIG_RAVE_SP_CORE)+= rave-sp.o
  obj-$(CONFIG_MFD_ROHM_BD718XX)+= rohm-bd718x7.o
+obj-$(CONFIG_MFD_ROHM_BD70528) += rohm-bd70528.o
  
diff --git a/drivers/mfd/rohm-bd70528.c b/drivers/mfd/rohm-bd70528.c

new file mode 100644
index ..c2bf6c1a7136
--- /dev/null
+++ b/drivers/mfd/rohm-bd70528.c
@@ -0,0 +1,409 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// Copyright (C) 2018 ROHM Semiconductors
+//
+// ROHM BD70528 PMIC driver
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define BD70528_INT_RES(_reg, _name)   \
+   {   \
+   .start = (_reg),\
+   .end = (_reg),  \
+   .name = (_name),\
+   .flags = IORESOURCE_IRQ,\
+   }
+
+static DEFINE_MUTEX(rtc_timer_mutex);
+
+static const struct resource rtc_irqs[] = {
+   BD70528_INT_RES(BD70528_INT_RTC_ALARM, "bd70528-rtc-alm"),
+   BD70528_INT_RES(BD70528_INT_ELPS_TIM, "bd70528-elapsed-timer"),
+};
+
+static const struct resource charger_irqs[] = {
+   BD70528_INT_RES(BD70528_INT_BAT_OV_RES, "bd70528-bat-ov-res"),
+   BD70528_INT_RES(BD70528_INT_BAT_OV_DET, "bd70528-bat-ov-det"),
+   BD70528_INT_RES(BD70528_INT_DBAT_DET, "bd70528-bat-dead"),
+   BD70528_INT_RES(BD70528_INT_BATTSD_COLD_RES, "bd70528-bat-warmed"),
+   BD70528_INT_RES(BD70528_INT_BATTSD_COLD_DET, "bd70528-bat-cold"),
+   BD70528_INT_RES(BD70528_INT_BATTSD_HOT_RES, "bd70528-bat-cooled"),
+   BD70528_INT_RES(BD70528_INT_BATTSD_HOT_DET, "bd70528-bat-hot"),
+   BD70528_INT_RES(BD70528_INT_CHG_TSD, "bd70528-chg-tshd"),
+   BD70528_INT_RES(BD70528_INT_BAT_RMV, "bd70528-bat-removed"),
+   BD70528_INT_RES(BD70528_INT_BAT_DET, "bd70528-bat-detected"),
+   BD70528_INT_RES(BD70528_INT_DCIN2_OV_RES, "bd70528-dcin2-ov-res"),
+   BD70528_INT_RES(BD70528_INT_DCIN2_OV_DET, "bd70528-dcin2-ov-det"),
+   BD70528_INT_RES(BD70528_INT_DCIN2_RMV, "bd70528-dcin2-removed"),
+   BD70528_INT_RES(BD70528_INT_DCIN2_DET, "bd70528-dcin2-detected"),
+   BD70528_INT_RES(BD70528_INT_DCIN1_RMV, "bd70528-dcin1-removed"),
+   BD70528_INT_RES(BD70528_INT_DCIN1_DET, "bd70528-dcin1-detected"),
+};
+
+static struct mfd_cell bd70528_mfd_cells[] = {
+   { .name = "bd70528-pmic", },
+   { .name = "bd70528-gpio", },
+   /*
+* We use BD71837 driver to drive the clk block. Only differences to
+* BD70528 clock gate are the register address and mask.
+*/
+   { .name = "bd718xx-clk", },
+   { .name = "bd70528-wdt", },
+  

[PATCH v2] uio:remove unneeded variable ret

2019-01-22 Thread Bo Wang
From: wangbo 

In uio_dmem_genirq_open the variable ret is unneeded,remove it now.

Signed-off-by: Bo Wang 
---
 drivers/uio/uio_dmem_genirq.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/uio/uio_dmem_genirq.c b/drivers/uio/uio_dmem_genirq.c
index 003bada..2be7569 100644
--- a/drivers/uio/uio_dmem_genirq.c
+++ b/drivers/uio/uio_dmem_genirq.c
@@ -47,7 +47,6 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct 
inode *inode)
 {
struct uio_dmem_genirq_platdata *priv = info->priv;
struct uio_mem *uiomem;
-   int ret = 0;
int dmem_region = priv->dmem_region_start;
 
uiomem = >uioinfo->mem[priv->dmem_region_start];
@@ -71,7 +70,7 @@ static int uio_dmem_genirq_open(struct uio_info *info, struct 
inode *inode)
mutex_unlock(>alloc_lock);
/* Wait until the Runtime PM code has woken up the device */
pm_runtime_get_sync(>pdev->dev);
-   return ret;
+   return 0;
 }
 
 static int uio_dmem_genirq_release(struct uio_info *info, struct inode *inode)
-- 
2.7.4




Re: [PATCH v11 perf, bpf-next 7/9] perf tools: synthesize PERF_RECORD_* for loaded BPF programs

2019-01-22 Thread Arnaldo Carvalho de Melo
Em Tue, Jan 22, 2019 at 12:31:17PM -0200, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Jan 22, 2019 at 12:13:20PM -0200, Arnaldo Carvalho de Melo escreveu:
> > Em Fri, Jan 18, 2019 at 11:46:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> > > Em Thu, Jan 17, 2019 at 08:15:19AM -0800, Song Liu escreveu:
> > > > This patch synthesize PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT for
> > > > BPF programs loaded before perf-record. This is achieved by gathering
> > > > information about all BPF programs via sys_bpf.
> > > 
> > > Ditto
> > 
> > This is breaking 'perf sched', see below, the fix seems trivial:
> > 
> > [root@quaco ~]# perf sched record -a sleep 2
> > [ perf record: Woken up 1 times to write data ]
> > 0x5b60 [0x138]: failed to process type: 17
> > [ perf record: Captured and wrote 1.539 MB perf.data ]
> > [root@quaco ~]# perf sched lat
> > 0x5b60 [0x138]: failed to process type: 17
> > Failed to process events, error -22
> > [root@quaco ~]#
> 
> So:
> 
>perf_session__process_event (event->header.type = 17 (PERF_RECORD_KSYMBOL)
>  if (tool->ordered_events)
>ret = perf_evlist__parse_sample_timestamp(evlist, event, );
>if (ret && ret != -1)
> return ret;
> 
> So it returns here with -EFAULT, i.e. this is failing:
> 
> int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
> union perf_event *event,
> u64 *timestamp)
> {
> struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event);
> 
> if (!evsel)
> return -EFAULT;
> return perf_evsel__parse_sample_timestamp(evsel, event, timestamp);
> }
> 
> It isn't mapping the event ID it finds back to an evsel.. Jiri, ideas?
> 
> This is happening so far only for 'perf sched', perf record with two
> events works.

So it fails for tracepoints with plain 'perf record':

[root@quaco tmp]# perf record -e sched:sched* sleep 1
[ perf record: Woken up 29 times to write data ]
0x6658 [0x138]: failed to process type: 17
[ perf record: Captured and wrote 0.029 MB perf.data ]
[root@quaco tmp]# perf script
0x6658 [0x138]: failed to process type: 17
[root@quaco tmp]#

[ perf record: Woken up 1 times to write data ]

Breakpoint 1, reader__process_events (rd=0x7ffe4160, session=0xab66a0, 
prog=0x7ffe4180) at util/session.c:1911
1911pr_err("%#" PRIx64 " [%#x]: failed to process type: 
%d\n",
Missing separate debuginfos, use: dnf debuginfo-install 
bzip2-libs-1.0.6-28.fc29.x86_64 elfutils-libelf-0.174-5.fc29.x86_64 
elfutils-libs-0.174-5.fc29.x86_64 glib2-2.58.2-1.fc29.x86_64 
libbabeltrace-1.5.6-1.fc29.x86_64 libunwind-1.2.1-6.fc29.x86_64 
libuuid-2.32.1-1.fc29.x86_64 libxcrypt-4.4.2-3.fc29.x86_64 
numactl-libs-2.0.12-1.fc29.x86_64 openssl-libs-1.1.1a-1.fc29.x86_64 
pcre-8.42-6.fc29.x86_64 perl-libs-5.28.1-427.fc29.x86_64 
popt-1.16-15.fc29.x86_64 python2-libs-2.7.15-11.fc29.x86_64 
slang-2.3.2-4.fc29.x86_64 xz-libs-5.2.4-3.fc29.x86_64
(gdb) bt
#0  reader__process_events (rd=0x7ffe4160, session=0xab66a0, 
prog=0x7ffe4180) at util/session.c:1911
#1  0x00540deb in __perf_session__process_events (session=0xab66a0) at 
util/session.c:1955
#2  0x00540f1c in perf_session__process_events (session=0xab66a0) at 
util/session.c:1988
#3  0x00445feb in process_buildids (rec=0x9202a0 ) at 
builtin-record.c:689
#4  0x00446597 in record__finish_output (rec=0x9202a0 ) at 
builtin-record.c:846
#5  0x00447b8c in __cmd_record (rec=0x9202a0 , argc=2, 
argv=0xab4720) at builtin-record.c:1429
#6  0x00448d64 in cmd_record (argc=2, argv=0xab4720) at 
builtin-record.c:2153
#7  0x004406dd in __cmd_record (argc=3, argv=0x7fffdb30) at 
builtin-sched.c:3339
#8  0x004411ff in cmd_sched (argc=3, argv=0x7fffdb30) at 
builtin-sched.c:3486
#9  0x004d46e3 in run_builtin (p=0x932c50 , argc=4, 
argv=0x7fffdb30) at perf.c:302
#10 0x004d4950 in handle_internal_command (argc=4, argv=0x7fffdb30) 
at perf.c:354
#11 0x004d4a9f in run_argv (argcp=0x7fffd98c, argv=0x7fffd980) 
at perf.c:398
#12 0x004d4e0b in main (argc=4, argv=0x7fffdb30) at perf.c:520
(gdb)

[root@quaco tmp]# perf c2c record
^C[ perf record: Woken up 1 times to write data ]
0x5698 [0x138]: failed to process type: 17
[ perf record: Captured and wrote 7.110 MB perf.data ]

[root@quaco tmp]# perf kmem record
^C[ perf record: Woken up 1 times to write data ]
0x5998 [0x138]: failed to process type: 17
[ perf record: Captured and wrote 1.470 MB perf.data ]

[root@quaco tmp]#


Re: [PATCH] iommu/intel: quirk to disable DMAR for QM57 igfx

2019-01-22 Thread Joonas Lahtinen
Quoting Joerg Roedel (2019-01-22 13:01:09)
> Hi Daniel,
> 
> On Tue, Jan 22, 2019 at 11:46:39AM +0100, Daniel Vetter wrote:
> > Note that the string of platforms which have various issues with iommu
> > and igfx is very long, thus far we only disabled it where there's no
> > workaround to stop it from hanging the box, but otherwise left it
> > enabled. So if we make a policy change to also disable it anywhere
> > where it doesn't work well (instead of not at all), there's a pile
> > more platforms to switch.
> 
> I think its best to just disable iommu for the igfx devices on these
> platforms. Can you pick up Eric's patch and extend it with the list of
> affected platforms?

We've been discussing this again more actively since a few months ago,
and the discussion is still ongoing internally.

According to our IOMMU folks there exists some desire to be able to assign
the iGFX device aka have intel_iommu=on instead of intel_iommu=igfx_off
due to how the devices might be grouped in IOMMU groups. Even when you
would not be using the iGFX device.

So for some uses, the fact that the device (group) is assignable seems
to be more important than the iGFX device to be working. I'm afraid
that retroactively disabling the assignment for such an old platform
might break those usage scenarios. By my quick reading of the code,
there's no way for user to turn the iGFX DMAR on once the quirk
disables it.

I guess one solution would be to default to intel_iommu=igfx_off for
platforms that are older than certain threshold. But still allow
user to enable. But that then requires duplicating the PCI ID database
into iommu code.

I don't really have winning moves to present, but I'm open to hearing
how we can avoid more damage than starting to default to intel_iommu=on
did already.

Regards, Joonas

> 
> Thanks,
> 
> Joerg


Re: [RFC PATCH v1 11/13] rtc: bd70528: Initial support for ROHM bd70528 RTC

2019-01-22 Thread Guenter Roeck

On 1/22/19 1:47 AM, Matti Vaittinen wrote:

Support RTC block in ROHM bd70528 power management IC. Support
getting and setting the time and date as well as arming an alarm
which can also be used to wake the PMIC from standby state.

HW supports wake interrupt only for the next 24 hours (sec, minute
and hour information only) so we limit also the alarm interrupt to
this 24 hours for the sake of consistency.

Signed-off-by: Matti Vaittinen 
---
  drivers/rtc/Kconfig   |   8 +
  drivers/rtc/Makefile  |   1 +
  drivers/rtc/rtc-bd70528.c | 439 ++
  3 files changed, 448 insertions(+)
  create mode 100644 drivers/rtc/rtc-bd70528.c

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 225b0b8516f3..df6211cbd83f 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -487,6 +487,14 @@ config RTC_DRV_M41T80_WDT
help
  If you say Y here you will get support for the
  watchdog timer in the ST M41T60 and M41T80 RTC chips series.
+config RTC_DRV_BD70528
+   tristate "ROHM BD70528 PMIC RTC"
+   help
+ If you say Y here you will get support for the RTC
+ on ROHM BD70528 Power Management IC.
+
+ This driver can also be built as a module. If so, the module
+ will be called rtc-bd70528.
  
  config RTC_DRV_BQ32K

tristate "TI BQ32000"
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index df022d820bee..740b13840913 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_RTC_DRV_ASM9260) += rtc-asm9260.o
  obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
  obj-$(CONFIG_RTC_DRV_AT91SAM9)+= rtc-at91sam9.o
  obj-$(CONFIG_RTC_DRV_AU1XXX)  += rtc-au1xxx.o
+obj-$(CONFIG_RTC_DRV_BD70528)  += rtc-bd70528.o
  obj-$(CONFIG_RTC_DRV_BQ32K)   += rtc-bq32k.o
  obj-$(CONFIG_RTC_DRV_BQ4802)  += rtc-bq4802.o
  obj-$(CONFIG_RTC_DRV_BRCMSTB) += rtc-brcmstb-waketimer.o
diff --git a/drivers/rtc/rtc-bd70528.c b/drivers/rtc/rtc-bd70528.c
new file mode 100644
index ..7c7e1f8769e8
--- /dev/null
+++ b/drivers/rtc/rtc-bd70528.c
@@ -0,0 +1,439 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+//
+// Copyright (C) 2018 ROHM Semiconductors
+//
+// RTC driver for ROHM BD70528 PMIC
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/*
+ * We read regs RTC_SEC => RTC_YEAR
+ * this struct is ordered according to chip registers.
+ * Keep it u8 only to avoid padding issues.
+ */
+struct bd70528_rtc_day {
+   u8 sec;
+   u8 min;
+   u8 hour;
+};
+struct bd70528_rtc_data {
+   struct bd70528_rtc_day time;
+   u8 week;
+   u8 day;
+   u8 month;
+   u8 year;
+};
+struct bd70528_rtc_wake {
+   struct bd70528_rtc_day time;
+   u8 ctrl;
+};
+struct bd70528_rtc_alm {
+   struct bd70528_rtc_data data;
+   u8 alm_mask;
+   u8 alm_repeat;
+};
+
+static int bd70528_set_wake(struct bd70528 *bd70528,
+   int enable, int *old_state)
+{
+   int ret;
+   unsigned int ctrl_reg;
+
+   ret = regmap_read(bd70528->chip.regmap, BD70528_REG_WAKE_EN, _reg);
+   if (ret)
+   return ret;
+
+   if (old_state) {
+   if (ctrl_reg & BD70528_MASK_WAKE_EN)
+   *old_state |= BD70528_WAKE_STATE_BIT;
+   else
+   *old_state &= ~BD70528_WAKE_STATE_BIT;
+
+   if ((!enable) == (!(*old_state & BD70528_WAKE_STATE_BIT)))
+   return 0;
+   }
+
+   if (enable)
+   ctrl_reg |= BD70528_MASK_WAKE_EN;
+   else
+   ctrl_reg &= ~BD70528_MASK_WAKE_EN;
+
+   return regmap_write(bd70528->chip.regmap, BD70528_REG_WAKE_EN,
+   ctrl_reg);
+}
+
+static int bd70528_set_elapsed_tmr(struct bd70528 *bd70528,
+  int enable, int *old_state)
+{
+   int ret;
+   unsigned int ctrl_reg;
+
+   /*
+* TBD
+* What is the purpose of elapsed timer ?
+* Is the timeout registers counting down, or is the disable - re-enable
+* going to restart the elapsed-time counting? If counting is restarted
+* the timeout should be decreased by the amount of time that has
+* elapsed since starting the timer. Maybe we should store the monotonic
+* clock value when timer is started so that if RTC is set while timer
+* is armed we could do the compensation. This is a hack if RTC/system
+* clk are drifting. OTOH, RTC controlled via I2C is in any case
+* inaccurate...
+*/
+   ret = regmap_read(bd70528->chip.regmap, BD70528_REG_ELAPSED_TIMER_EN,
+ _reg);
+   if (ret)
+   return ret;
+
+   if (old_state) {
+   if (ctrl_reg & BD70528_MASK_ELAPSED_TIMER_EN)
+   *old_state |= BD70528_ELAPSED_STATE_BIT;
+   else
+   

Re: [PATCH v2 1/2] media: docs-rst: Document memory-to-memory video decoder interface

2019-01-22 Thread Hans Verkuil
On 01/22/19 11:02, Tomasz Figa wrote:
> On Mon, Nov 12, 2018 at 8:37 PM Hans Verkuil  wrote:
>>
>> Hi Tomasz,
>>
>> A general note for the stateful and stateless patches: they describe specific
>> use-cases of the more generic Codec Interface, and as such should be one
>> level deeper in the section hierarchy.
> 
> I wonder what exactly this Codec Interface is. Is it a historical name
> for mem2mem? If so, perhaps it would make sense to rename it?

Yeah, it should be renamed to "Video Memory-to-Memory Interface", and the
codecs are just specific instances of such an interface.

> 
>>
>> I.e. instead of being section 4.6/7/8:
>>
>> https://hverkuil.home.xs4all.nl/request-api/uapi/v4l/devices.html
>>
>> they should be 4.5.1/2/3.
>>
> 
> FYI, the first RFC started like that, but it only made the spec
> difficult to navigate and the section numbers too long.
> 
> Still, no strong opinion. I'm okay moving it there, if you think it's better.

It should be moved and the interface name should be renamed. It makes a lot
more sense with those changes.

I've posted a patch for this.

> 
>> On 10/22/2018 04:48 PM, Tomasz Figa wrote:
>>> Due to complexity of the video decoding process, the V4L2 drivers of
>>> stateful decoder hardware require specific sequences of V4L2 API calls
>>> to be followed. These include capability enumeration, initialization,
>>> decoding, seek, pause, dynamic resolution change, drain and end of
>>> stream.
> [snipping any comments that I agree with]
>>> +
>>> +source height
>>> +   height in pixels for given source resolution; relevant to encoders only
>>> +
>>> +source resolution
>>> +   resolution in pixels of source frames being source to the encoder and
>>> +   subject to further cropping to the bounds of visible resolution; 
>>> relevant to
>>> +   encoders only
>>> +
>>> +source width
>>> +   width in pixels for given source resolution; relevant to encoders only
>>
>> I would drop these three terms: they are not used in this document since this
>> describes a decoder and not an encoder.
>>
> 
> The glossary is shared between encoder and decoder, as suggested in
> previous round of review.
> 
> [snip]
>>> +
>>> +   * If width and height are set to non-zero values, the ``CAPTURE`` format
>>> + will be updated with an appropriate frame buffer resolution instantly.
>>> + However, for coded formats that include stream resolution information,
>>> + after the decoder is done parsing the information from the stream, it 
>>> will
>>> + update the ``CAPTURE`` format with new values and signal a source 
>>> change
>>> + event.
>>
>> What if the initial width and height specified by userspace matches the 
>> parsed
>> width and height? Do you still get a source change event? I think you should
>> always get this event since there are other parameters that depend on the 
>> parsing
>> of the meta data.
>>
>> But that should be made explicit here.
>>
> 
> Yes, the change event should happen always after the driver determines
> the format of the stream. Will specify it explicitly.
> 
>>> +
>>> +   .. warning::
>>
>> I'd call this a note rather than a warning.
>>
> 
> I think it deserves at least the "important" level, since it informs
> about the side effects of the call, affecting any actions that the
> client might have done before.
> 
> 
>>> +
>>> +  Changing the ``OUTPUT`` format may change the currently set 
>>> ``CAPTURE``
>>> +  format. The decoder will derive a new ``CAPTURE`` format from the
>>> +  ``OUTPUT`` format being set, including resolution, colorimetry
>>> +  parameters, etc. If the client needs a specific ``CAPTURE`` format, 
>>> it
>>> +  must adjust it afterwards.
>>> +
>>> +3.  **Optional.** Query the minimum number of buffers required for 
>>> ``OUTPUT``
>>> +queue via :c:func:`VIDIOC_G_CTRL`. This is useful if the client 
>>> intends to
>>> +use more buffers than the minimum required by hardware/format.
>>
>> Why is this useful? As far as I can tell only the s5p-mfc *encoder* supports
>> this control, so this seems pointless. And since the output queue gets a 
>> bitstream
>> I don't see any reason for reading this control in a decoder.
>>
> 
> Indeed, querying this for bitstream buffers probably doesn't make much
> sense. I'll remove it.
> 
>>> +
>>> +* **Required fields:**
>>> +
>>> +  ``id``
>>> +  set to ``V4L2_CID_MIN_BUFFERS_FOR_OUTPUT``
>>> +
>>> +* **Return fields:**
>>> +
>>> +  ``value``
>>> +  the minimum number of ``OUTPUT`` buffers required for the 
>>> currently
>>> +  set format
>>> +
>>> +4.  Allocate source (bitstream) buffers via :c:func:`VIDIOC_REQBUFS` on
>>> +``OUTPUT``.
>>> +
>>> +* **Required fields:**
>>> +
>>> +  ``count``
>>> +  requested number of buffers to allocate; greater than zero
>>> +
>>> +  ``type``
>>> +  a ``V4L2_BUF_TYPE_*`` enum appropriate for ``OUTPUT``
>>> +
>>> +  ``memory``
>>> +  follows standard 

Re: [PATCH v4 1/4] can: m_can: Create a m_can platform framework

2019-01-22 Thread Wolfgang Grandegger
Hello Dan,

Am 22.01.19 um 14:04 schrieb Dan Murphy:
> Wolfgang
> 
> Thanks for the review
> 
> On 1/22/19 2:16 AM, Wolfgang Grandegger wrote:
>> Hello Dan,
>>
>> looks already quite good...
>>
>> Am 17.01.19 um 21:05 schrieb Dan Murphy:
>>> Create a m_can platform framework that peripherial
>>> devices can register to and use common code and register sets.
>>> The peripherial devices may provide read/write and configuration
>>> support of the IP.
>>>
>>> Signed-off-by: Dan Murphy 
>>> ---
>>>  drivers/net/can/m_can/m_can.c  |   6 +
>>>  drivers/net/can/m_can/m_can_platform.c | 209 +
>>>  drivers/net/can/m_can/m_can_platform.h | 163 +++
>>>  3 files changed, 378 insertions(+)
>>>  create mode 100644 drivers/net/can/m_can/m_can_platform.c
>>>  create mode 100644 drivers/net/can/m_can/m_can_platform.h
>>>
>>> diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
>>> index 9b449400376b..f817b28582e9 100644
>>> --- a/drivers/net/can/m_can/m_can.c
>>> +++ b/drivers/net/can/m_can/m_can.c
>>> @@ -414,6 +414,9 @@ static inline void m_can_config_endisable(const struct 
>>> m_can_priv *priv,
>>> u32 timeout = 10;
>>> u32 val = 0;
>>>  
>>> +   if (cccr & CCCR_CSR)
>>> +   cccr &= ~CCCR_CSR;
>>> +
>>
>> This is an unrelated change/fix. Should go somewhere else.
>>
> 
> I thought I pulled this and the change below out of of this patchset.
> 
>>> if (enable) {
>>> /* enable m_can configuration */
>>> m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT);
>>> @@ -1155,6 +1158,9 @@ static void m_can_chip_config(struct net_device *dev)
>>> m_can_set_bittiming(dev);
>>>  
>>> m_can_config_endisable(priv, false);
>>> +
>>> +   if (priv->device_init)
>>> +   priv->device_init(priv);
>>>  }
>>>  
>>>  static void m_can_start(struct net_device *dev)
>>> diff --git a/drivers/net/can/m_can/m_can_platform.c 
>>> b/drivers/net/can/m_can/m_can_platform.c
>>> new file mode 100644
>>> index ..03172911323a
>>> --- /dev/null
>>> +++ b/drivers/net/can/m_can/m_can_platform.c
>>> @@ -0,0 +1,209 @@
>>> +/*
>>> + * CAN bus driver for Bosch M_CAN controller
>>> + *
>>> + * Copyright (C) 2014 Freescale Semiconductor, Inc.
>>> + * Dong Aisheng 
>>> + *
>>> + * Bosch M_CAN user manual can be obtained from:
>>> + * http://www.bosch-semiconductors.de/media/pdf_1/ipmodules_1/m_can/
>>> + * mcan_users_manual_v302.pdf
>>> + *
>>> + * This file is licensed under the terms of the GNU General Public
>>> + * License version 2. This program is licensed "as is" without any
>>> + * warranty of any kind, whether express or implied.
>>> + */
>>> +
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +#include 
>>> +
>>> +#include "m_can_platform.h"
>>> +
>>> +struct m_can_plat_priv {
>>> +   void __iomem *base;
>>> +   void __iomem *mram_base;
>>> +};
>>> +
>>> +static u32 iomap_read_reg(struct m_can_classdev *m_can_class, int reg)
>>> +{
>>> +   struct m_can_plat_priv *priv = (struct m_can_plat_priv 
>>> *)m_can_class->device_data;
>>> +
>>> +   return readl(priv->base + reg);
>>> +}
>>> +
>>> +static u32 iomap_read_fifo(struct m_can_classdev *m_can_class, int 
>>> addr_offset)
>>
>> Why not just "offset".
>>
> 
> I can change the name
> 
>>> +{
>>> +   struct m_can_plat_priv *priv = (struct m_can_plat_priv 
>>> *)m_can_class->device_data;
>>> +
>>> +   return readl(priv->mram_base + addr_offset);
>>> +}
>>> +
>>> +static int iomap_write_reg(struct m_can_classdev *m_can_class, int reg, 
>>> int val)
>>> +{
>>> +   struct m_can_plat_priv *priv = (struct m_can_plat_priv 
>>> *)m_can_class->device_data;
>>> +
>>> +   writel(val, priv->base + reg);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int iomap_write_fifo(struct m_can_classdev *m_can_class, int 
>>> addr_offset, int val)
>>> +{
>>> +   struct m_can_plat_priv *priv = (struct m_can_plat_priv 
>>> *)m_can_class->device_data;
>>> +
>>> +   writel(val, priv->base + addr_offset);
>>> +
>>> +   return 0;
>>> +}
>>> +
>>> +static int m_can_plat_probe(struct platform_device *pdev)
>>> +{
>>> +   struct m_can_classdev *mcan_class;
>>> +   struct m_can_plat_priv *priv;
>>> +   struct resource *res;
>>> +   void __iomem *addr;
>>> +   void __iomem *mram_addr;
>>> +   int irq, ret = 0;
>>> +
>>> +   mcan_class = m_can_core_allocate_dev(>dev);
>>> +   priv = devm_kzalloc(>dev, sizeof(*priv), GFP_KERNEL);
>>> +   if (!priv)
>>> +   return -ENOMEM;
>>> +
>>> +   mcan_class->device_data = priv;
>>> +
>>> +   m_can_core_get_clocks(mcan_class);
>>> +
>>> +   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "m_can");
>>> +   addr = devm_ioremap_resource(>dev, res);
>>> +   irq = platform_get_irq_byname(pdev, "int0");
>>> +   if (IS_ERR(addr) || irq < 0) {
>>> +   ret = -EINVAL;
>>> +   goto failed_ret;
>>> +   }
>>> +
>>> +   /* message ram could be shared */
>>> +   

Re: possible deadlock in shmem_fallocate (2)

2019-01-22 Thread syzbot

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger  
crash:


Reported-and-tested-by:  
syzbot+4b8b031b89e6b96c4...@syzkaller.appspotmail.com


Tested on:

commit: 48b161983ae5 Merge tag 'xarray-5.0-rc3' of git://git.infra..
git tree:   upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=864ab9949c515a07
compiler:   gcc (GCC) 9.0.0 20181231 (experimental)
patch:  https://syzkaller.appspot.com/x/patch.diff?x=1064a9a0c0

Note: testing is done by a robot and is best-effort only.


Re: [PATCH v13 0/8] Introduce on-chip interconnect API

2019-01-22 Thread Georgi Djakov
On 1/22/19 14:42, Greg KH wrote:
> On Wed, Jan 16, 2019 at 06:10:55PM +0200, Georgi Djakov wrote:
[..]
> 
> All now queued up, thanks.
> 
> greg k-h

Hi Greg,

Thanks for considering these patches! Actually i have a branch named
icc-next [1] which is pulled into linux-next. I will drop these same
patches to avoid conflicts.

If all is well, i was wondering how to proceed with follow-up patches.
Some consumers of this API are already floating on the lists. How about
sending you a pull request before the merge window with the collected
patches?

Thanks,
Georgi

1. https://git.linaro.org/people/georgi.djakov/linux.git/log/?h=icc-next



Re: [PATCH v6 07/16] sched/core: uclamp: Add system default clamps

2019-01-22 Thread Patrick Bellasi
On 22-Jan 14:56, Peter Zijlstra wrote:
> On Tue, Jan 15, 2019 at 10:15:04AM +, Patrick Bellasi wrote:
> 
> > diff --git a/include/linux/sched.h b/include/linux/sched.h
> > index 84294925d006..c8f391d1cdc5 100644
> > --- a/include/linux/sched.h
> > +++ b/include/linux/sched.h
> > @@ -625,6 +625,11 @@ struct uclamp_se {
> > unsigned int bucket_id  : bits_per(UCLAMP_BUCKETS);
> > unsigned int mapped : 1;
> > unsigned int active : 1;
> > +   /* Clamp bucket and value actually used by a RUNNABLE task */
> > +   struct {
> > +   unsigned int value  : bits_per(SCHED_CAPACITY_SCALE);
> > +   unsigned int bucket_id  : bits_per(UCLAMP_BUCKETS);
> > +   } effective;
> 
> I am confuzled by this thing..  so uclamp_se already has a value,bucket,
> which per the prior code is the effective one.
> 
> Now; I think I see why you want another value; you need the second to
> store the original value for when the system limits change and we must
> re-evaluate.

Yes, that's one reason, the other one being to properly support
CGroup when we add them in the following patches.

Effective will always track the value/bucket in which the task has
been refcounted at enqueue time and it depends on the aggregated
value.

> So why are you not adding something like:
> 
>   unsigned int orig_value : bits_per(SCHED_CAPACITY_SCALE);

Would say that can be enough if we decide to ditch the mapping and use
a linear mapping. In that case the value will always be enough to find
in which bucket a task has been accounted.

> > +unsigned int sysctl_sched_uclamp_util_min;
> 
> > +unsigned int sysctl_sched_uclamp_util_max = SCHED_CAPACITY_SCALE;
> 
> > +static inline void
> > +uclamp_effective_get(struct task_struct *p, unsigned int clamp_id,
> > +unsigned int *clamp_value, unsigned int *bucket_id)
> > +{
> > +   /* Task specific clamp value */
> > +   *clamp_value = p->uclamp[clamp_id].value;
> > +   *bucket_id = p->uclamp[clamp_id].bucket_id;
> > +
> > +   /* System default restriction */
> > +   if (unlikely(*clamp_value < uclamp_default[UCLAMP_MIN].value ||
> > +*clamp_value > uclamp_default[UCLAMP_MAX].value)) {
> > +   /* Keep it simple: unconditionally enforce system defaults */
> > +   *clamp_value = uclamp_default[clamp_id].value;
> > +   *bucket_id = uclamp_default[clamp_id].bucket_id;
> > +   }
> > +}
> 
> That would then turn into something like:
> 
>   unsigned int high = READ_ONCE(sysctl_sched_uclamp_util_max);
>   unsigned int low  = READ_ONCE(sysctl_sched_uclamp_util_min);
> 
>   uclamp_se->orig_value = value;
>   uclamp_se->value = clamp(value, low, high);
> 
> And then determine bucket_id based on value.

Right... if I ditch the mapping that should work.

 
> > +int sched_uclamp_handler(struct ctl_table *table, int write,
> > +void __user *buffer, size_t *lenp,
> > +loff_t *ppos)
> > +{
> > +   int old_min, old_max;
> > +   int result = 0;
> > +
> > +   mutex_lock(_mutex);
> > +
> > +   old_min = sysctl_sched_uclamp_util_min;
> > +   old_max = sysctl_sched_uclamp_util_max;
> > +
> > +   result = proc_dointvec(table, write, buffer, lenp, ppos);
> > +   if (result)
> > +   goto undo;
> > +   if (!write)
> > +   goto done;
> > +
> > +   if (sysctl_sched_uclamp_util_min > sysctl_sched_uclamp_util_max ||
> > +   sysctl_sched_uclamp_util_max > SCHED_CAPACITY_SCALE) {
> > +   result = -EINVAL;
> > +   goto undo;
> > +   }
> > +
> > +   if (old_min != sysctl_sched_uclamp_util_min) {
> > +   uclamp_bucket_inc(NULL, _default[UCLAMP_MIN],
> > + UCLAMP_MIN, sysctl_sched_uclamp_util_min);
> > +   }
> > +   if (old_max != sysctl_sched_uclamp_util_max) {
> > +   uclamp_bucket_inc(NULL, _default[UCLAMP_MAX],
> > + UCLAMP_MAX, sysctl_sched_uclamp_util_max);
> > +   }
> 
> Should you not update all tasks?

That's true, but that's also an expensive operation, that's why now
I'm doing only lazy updates at next enqueue time.

Do you think that could be acceptable?

Perhaps I can sanity check all the CPU to ensure that they all have a
current clamp value within the new enforced range. This kind-of
anticipate the idea to have an in-kernel API which has higher priority
and allows to set clamp values across all the CPUs...

-- 
#include 

Patrick Bellasi


Re: [PATCH] arm64 memory accesses may cause undefined fault on Fujitsu-A64FX

2019-01-22 Thread James Morse
Hello,

On 22/01/2019 02:05, Zhang, Lei wrote:
> Mark Rutland wrote:
>> * How often does this fault occur?
> In my test, this fault occurs once every several times
> in the OS boot sequence, and after the completion of OS boot,
> this fault have never occurred.
> In my opinion, this fault rarely occurs
> after the completion of OS boot.

Can you share anything about why this is? You mention a hardware-condition
that is reset at exception entry


>> I'm a bit surprised by the single retry. Is there any guarantee that a
>> thread will eventually stop delivering this fault code?

> I guarantee that a thread will stop delivering this 
> fault code by the this patch.
> The hardware condition which cause this fault is 
> reset at exception entry, therefore execution of at 
> least one instruction is guaranteed by this single retry.

... so its possible to take this fault during kernel_entry when we've taken an 
irq?

This will overwrite the ELR and SPSR, (and possibly the FAR and ESR), meaning 
we've
 lost that information and can't return to the point in the kernel that took the
irq.

If we try, we might end up spinning through the irq handler, as the ELR might
now point
to el1_irq's kernel_entry.

We can spot we took an exception from the entry text ... but all we can do then
is panic().
I'm not sure its worth working around this if its just a matter of time before 
this
happens. (you mention its less likely after boot, it would be good to know 
why...)


Thanks,

James


[PATCH 0/4] ARM: cleanup debugfs usage

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs code, there is no need to ever check the return
value of the call, as no logic should ever change if a call works
properly or not.  Fix up a bunch of x86-specific code to not care about
the results of debugfs

Greg Kroah-Hartman (4):
  arm64: dump: no need to check return value of debugfs_create functions
  arm: dump: no need to check return value of debugfs_create functions
  arm: omap1: no need to check return value of debugfs_create functions
  arm: omap2: no need to check return value of debugfs_create functions

 arch/arm/include/asm/ptdump.h   |  9 ++---
 arch/arm/mach-omap1/clock.c | 63 +++--
 arch/arm/mach-omap1/pm.c|  7 ++--
 arch/arm/mach-omap2/pm-debug.c  | 15 
 arch/arm/mm/dump.c  |  4 +--
 arch/arm/mm/ptdump_debugfs.c|  8 ++---
 arch/arm64/include/asm/ptdump.h |  9 ++---
 arch/arm64/mm/dump.c|  4 +--
 arch/arm64/mm/ptdump_debugfs.c  |  7 ++--
 9 files changed, 34 insertions(+), 92 deletions(-)

-- 
2.20.1



[PATCH 4/4] arm: omap2: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Kevin Hilman 
Cc: Tony Lindgren 
Cc: Russell King 
Cc: linux-o...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/arm/mach-omap2/pm-debug.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 5a8839203958..1f9334a3d611 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -193,9 +193,8 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, 
void *dir)
return 0;
 
d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
-   if (d)
-   (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d,
-   (void *)pwrdm, _suspend_fops);
+   debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, pwrdm,
+   _suspend_fops);
 
return 0;
 }
@@ -233,16 +232,14 @@ static int __init pm_dbg_init(void)
return 0;
 
d = debugfs_create_dir("pm_debug", NULL);
-   if (!d)
-   return -EINVAL;
 
-   (void) debugfs_create_file("count", 0444, d, NULL, 
_dbg_counters_fops);
-   (void) debugfs_create_file("time", 0444, d, NULL, _dbg_timers_fops);
+   debugfs_create_file("count", 0444, d, NULL, _dbg_counters_fops);
+   debugfs_create_file("time", 0444, d, NULL, _dbg_timers_fops);
 
pwrdm_for_each(pwrdms_setup, (void *)d);
 
-   (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d,
-  _off_mode, _dbg_option_fops);
+   debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d,
+   _off_mode, _dbg_option_fops);
pm_dbg_init_done = 1;
 
return 0;
-- 
2.20.1



[PATCH 3/4] arm: omap1: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Paul Walmsley 
Cc: Aaro Koskinen 
Cc: Tony Lindgren 
Cc: Russell King 
Cc: Kevin Hilman 
Cc: linux-o...@vger.kernel.org
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/arm/mach-omap1/clock.c | 63 +++--
 arch/arm/mach-omap1/pm.c|  7 ++---
 2 files changed, 14 insertions(+), 56 deletions(-)

diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index c8c6fe88b2d6..3d7ab2bcf46c 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -990,84 +990,45 @@ static int debug_clock_show(struct seq_file *s, void 
*unused)
 
 DEFINE_SHOW_ATTRIBUTE(debug_clock);
 
-static int clk_debugfs_register_one(struct clk *c)
+static void clk_debugfs_register_one(struct clk *c)
 {
-   int err;
struct dentry *d;
struct clk *pa = c->parent;
 
d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
-   if (!d)
-   return -ENOMEM;
c->dent = d;
 
-   d = debugfs_create_u8("usecount", S_IRUGO, c->dent, >usecount);
-   if (!d) {
-   err = -ENOMEM;
-   goto err_out;
-   }
-   d = debugfs_create_ulong("rate", S_IRUGO, c->dent, >rate);
-   if (!d) {
-   err = -ENOMEM;
-   goto err_out;
-   }
-   d = debugfs_create_x8("flags", S_IRUGO, c->dent, >flags);
-   if (!d) {
-   err = -ENOMEM;
-   goto err_out;
-   }
-   return 0;
-
-err_out:
-   debugfs_remove_recursive(c->dent);
-   return err;
+   debugfs_create_u8("usecount", S_IRUGO, c->dent, >usecount);
+   debugfs_create_ulong("rate", S_IRUGO, c->dent, >rate);
+   debugfs_create_x8("flags", S_IRUGO, c->dent, >flags);
 }
 
-static int clk_debugfs_register(struct clk *c)
+static void clk_debugfs_register(struct clk *c)
 {
int err;
struct clk *pa = c->parent;
 
-   if (pa && !pa->dent) {
-   err = clk_debugfs_register(pa);
-   if (err)
-   return err;
-   }
+   if (pa && !pa->dent)
+   clk_debugfs_register(pa);
 
-   if (!c->dent) {
-   err = clk_debugfs_register_one(c);
-   if (err)
-   return err;
-   }
-   return 0;
+   if (!c->dent)
+   clk_debugfs_register_one(c);
 }
 
 static int __init clk_debugfs_init(void)
 {
struct clk *c;
struct dentry *d;
-   int err;
 
d = debugfs_create_dir("clock", NULL);
-   if (!d)
-   return -ENOMEM;
clk_debugfs_root = d;
 
-   list_for_each_entry(c, , node) {
-   err = clk_debugfs_register(c);
-   if (err)
-   goto err_out;
-   }
+   list_for_each_entry(c, , node)
+   clk_debugfs_register(c);
 
-   d = debugfs_create_file("summary", S_IRUGO,
-   d, NULL, _clock_fops);
-   if (!d)
-   return -ENOMEM;
+   debugfs_create_file("summary", S_IRUGO, d, NULL, _clock_fops);
 
return 0;
-err_out:
-   debugfs_remove_recursive(clk_debugfs_root);
-   return err;
 }
 late_initcall(clk_debugfs_init);
 
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 998075d3ef86..d068958d6f8a 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -539,11 +539,8 @@ static void omap_pm_init_debugfs(void)
struct dentry *d;
 
d = debugfs_create_dir("pm_debug", NULL);
-   if (!d)
-   return;
-
-   (void) debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO,
-   d, NULL, _pm_debug_fops);
+   debugfs_create_file("omap_pm", S_IWUSR | S_IRUGO, d, NULL,
+   _pm_debug_fops);
 }
 
 #endif /* CONFIG_DEBUG_FS */
-- 
2.20.1



[PATCH 2/4] arm: dump: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Russell King 
Cc: Jinbum Park 
Cc: Kees Cook 
Cc: Laura Abbott 
Cc: linux-arm-ker...@lists.infradead.org
Signed-off-by: Greg Kroah-Hartman 
---
 arch/arm/include/asm/ptdump.h | 9 +++--
 arch/arm/mm/dump.c| 4 ++--
 arch/arm/mm/ptdump_debugfs.c  | 8 ++--
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/arch/arm/include/asm/ptdump.h b/arch/arm/include/asm/ptdump.h
index 3ebf9718288d..0c2d3d0d4cc6 100644
--- a/arch/arm/include/asm/ptdump.h
+++ b/arch/arm/include/asm/ptdump.h
@@ -21,13 +21,10 @@ struct ptdump_info {
 
 void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
 #ifdef CONFIG_ARM_PTDUMP_DEBUGFS
-int ptdump_debugfs_register(struct ptdump_info *info, const char *name);
+void ptdump_debugfs_register(struct ptdump_info *info, const char *name);
 #else
-static inline int ptdump_debugfs_register(struct ptdump_info *info,
-   const char *name)
-{
-   return 0;
-}
+static inline void ptdump_debugfs_register(struct ptdump_info *info,
+  const char *name) { }
 #endif /* CONFIG_ARM_PTDUMP_DEBUGFS */
 
 void ptdump_check_wx(void);
diff --git a/arch/arm/mm/dump.c b/arch/arm/mm/dump.c
index 084779c5c893..eb385a500ed0 100644
--- a/arch/arm/mm/dump.c
+++ b/arch/arm/mm/dump.c
@@ -450,7 +450,7 @@ void ptdump_check_wx(void)
 static int ptdump_init(void)
 {
ptdump_initialize();
-   return ptdump_debugfs_register(_ptdump_info,
-   "kernel_page_tables");
+   ptdump_debugfs_register(_ptdump_info, "kernel_page_tables");
+   return 0;
 }
 __initcall(ptdump_init);
diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c
index be8d87be4b93..598b636615a2 100644
--- a/arch/arm/mm/ptdump_debugfs.c
+++ b/arch/arm/mm/ptdump_debugfs.c
@@ -24,11 +24,7 @@ static const struct file_operations ptdump_fops = {
.release= single_release,
 };
 
-int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
+void ptdump_debugfs_register(struct ptdump_info *info, const char *name)
 {
-   struct dentry *pe;
-
-   pe = debugfs_create_file(name, 0400, NULL, info, _fops);
-   return pe ? 0 : -ENOMEM;
-
+   debugfs_create_file(name, 0400, NULL, info, _fops);
 }
-- 
2.20.1



[PATCH 1/4] arm64: dump: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Catalin Marinas 
Cc: Will Deacon 
Cc: Marc Zyngier 
Cc: Peng Donglin 
Cc: 
Signed-off-by: Greg Kroah-Hartman 
---
 arch/arm64/include/asm/ptdump.h | 9 +++--
 arch/arm64/mm/dump.c| 4 ++--
 arch/arm64/mm/ptdump_debugfs.c  | 7 ++-
 3 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/arch/arm64/include/asm/ptdump.h b/arch/arm64/include/asm/ptdump.h
index 6afd8476c60c..9e948a93d26c 100644
--- a/arch/arm64/include/asm/ptdump.h
+++ b/arch/arm64/include/asm/ptdump.h
@@ -34,13 +34,10 @@ struct ptdump_info {
 
 void ptdump_walk_pgd(struct seq_file *s, struct ptdump_info *info);
 #ifdef CONFIG_ARM64_PTDUMP_DEBUGFS
-int ptdump_debugfs_register(struct ptdump_info *info, const char *name);
+void ptdump_debugfs_register(struct ptdump_info *info, const char *name);
 #else
-static inline int ptdump_debugfs_register(struct ptdump_info *info,
-   const char *name)
-{
-   return 0;
-}
+static inline void ptdump_debugfs_register(struct ptdump_info *info,
+  const char *name) { }
 #endif
 void ptdump_check_wx(void);
 #endif /* CONFIG_ARM64_PTDUMP_CORE */
diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c
index fcb1f2a6d7c6..08c250350b8a 100644
--- a/arch/arm64/mm/dump.c
+++ b/arch/arm64/mm/dump.c
@@ -407,7 +407,7 @@ void ptdump_check_wx(void)
 static int ptdump_init(void)
 {
ptdump_initialize();
-   return ptdump_debugfs_register(_ptdump_info,
-   "kernel_page_tables");
+   ptdump_debugfs_register(_ptdump_info, "kernel_page_tables");
+   return 0;
 }
 device_initcall(ptdump_init);
diff --git a/arch/arm64/mm/ptdump_debugfs.c b/arch/arm64/mm/ptdump_debugfs.c
index 24d786fc3a4c..064163f25592 100644
--- a/arch/arm64/mm/ptdump_debugfs.c
+++ b/arch/arm64/mm/ptdump_debugfs.c
@@ -12,10 +12,7 @@ static int ptdump_show(struct seq_file *m, void *v)
 }
 DEFINE_SHOW_ATTRIBUTE(ptdump);
 
-int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
+void ptdump_debugfs_register(struct ptdump_info *info, const char *name)
 {
-   struct dentry *pe;
-   pe = debugfs_create_file(name, 0400, NULL, info, _fops);
-   return pe ? 0 : -ENOMEM;
-
+   debugfs_create_file(name, 0400, NULL, info, _fops);
 }
-- 
2.20.1



Re: [for next][PATCH 2/2] x86/Kconfig: Select PCI_LOCKLESS_CONFIG if PCI is enabled

2019-01-22 Thread Sinan Kaya
On 1/22/19, Borislav Petkov  wrote:
> On Mon, Jan 21, 2019 at 11:19:58PM +, Sinan Kaya wrote:
>> After 'commit 5d32a66541c4 ("PCI/ACPI: Allow ACPI to be built without
>> CONFIG_PCI set")' dependencies on CONFIG_PCI that previously were
>> satisfied implicitly through dependencies on CONFIG_ACPI have to be
>> specified directly.
>>
>> PCI_LOCKLESS_CONFIG depends on PCI but this dependency has not been
>> mentioned in the Kconfig.
>>
>> Add an explicit dependency here.
>>
>> Fixes: 5d32a66541c46 ("PCI/ACPI: Allow ACPI to be built without CONFIG_PCI
>> set")
>> Signed-off-by: Sinan Kaya 
>> ---
>>  arch/x86/Kconfig | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>> index 568f339595ed..0519da6f8ee4 100644
>> --- a/arch/x86/Kconfig
>> +++ b/arch/x86/Kconfig
>> @@ -199,7 +199,7 @@ config X86
>>  select IRQ_FORCED_THREADING
>>  select NEED_SG_DMA_LENGTH
>>  select PCI_DOMAINS  if PCI
>> -select PCI_LOCKLESS_CONFIG
>> +select PCI_LOCKLESS_CONFIG  if PCI
>>  select PERF_EVENTS
>>  select RTC_LIB
>>  select RTC_MC146818_LIB
>> --
>
> AFAICT, this is not really fixing a random config build issue but only
> correcting the dependency, right?
>

This is fixing a warning found by randconfig on this thread
'linux-next: Tree for Jan 16 (PCI config warning?)'

> --
> Regards/Gruss,
> Boris.
>
> Good mailing practices for 400: avoid top-posting and trim the reply.
>


Re: [PATCH] cpuidle: fix description of exit latency in cpuidle.rst

2019-01-22 Thread Frank Lee
Noise, I am wrong...


Re: [PATCH v6 11/16] sched/fair: Add uclamp support to energy_compute()

2019-01-22 Thread Quentin Perret
On Tuesday 22 Jan 2019 at 14:26:06 (+), Patrick Bellasi wrote:
> On 22-Jan 13:29, Quentin Perret wrote:
> > On Tuesday 22 Jan 2019 at 12:45:46 (+), Patrick Bellasi wrote:
> > > On 22-Jan 12:13, Quentin Perret wrote:
> > > > On Tuesday 15 Jan 2019 at 10:15:08 (+), Patrick Bellasi wrote:
> > > > > The Energy Aware Scheduler (AES) estimates the energy impact of waking
> > > 
> > > [...]
> > > 
> > > > > + for_each_cpu_and(cpu, pd_mask, cpu_online_mask) {
> > > > > + cfs_util = cpu_util_next(cpu, p, dst_cpu);
> > > > > +
> > > > > + /*
> > > > > +  * Busy time computation: utilization clamping 
> > > > > is not
> > > > > +  * required since the ratio (sum_util / 
> > > > > cpu_capacity)
> > > > > +  * is already enough to scale the EM reported 
> > > > > power
> > > > > +  * consumption at the (eventually clamped) 
> > > > > cpu_capacity.
> > > > > +  */
> > > > 
> > > > Right.
> > > > 
> > > > > + sum_util += schedutil_cpu_util(cpu, cfs_util, 
> > > > > cpu_cap,
> > > > > +ENERGY_UTIL, 
> > > > > NULL);
> > > > > +
> > > > > + /*
> > > > > +  * Performance domain frequency: utilization 
> > > > > clamping
> > > > > +  * must be considered since it affects the 
> > > > > selection
> > > > > +  * of the performance domain frequency.
> > > > > +  */
> > > > 
> > > > So that actually affects the way we deal with RT I think. I assume the
> > > > idea is to say if you don't want to reflect the RT-go-to-max-freq thing
> > > > in EAS (which is what we do now) you should set the min cap for RT to 0.
> > > > Is that correct ?
> > > 
> > > By default configuration, RT tasks still go to max when uclamp is
> > > enabled, since they get a util_min=1024.
> > > 
> > > If we want to save power on RT tasks, we can set a smaller util_min...
> > > but not necessarily 0. A util_min=0 for RT tasks means to use just
> > > cpu_util_rt() for that class.
> > 
> > Ah, sorry, I guess my message was misleading. I'm saying this is
> > changing the way _EAS_ deals with RT tasks. Right now we don't actually
> > consider the RT-go-to-max thing at all in the EAS prediction. Your
> > patch is changing that AFAICT. It actually changes the way EAS sees RT
> > tasks even without uclamp ...
> 
> Lemme see if I get it right.
> 
> Currently, whenever we look at CPU utilization for ENERGY_UTIL, we
> always use cpu_util_rt() for RT tasks:
> 
> ---8<---
> util = util_cfs;
> util += cpu_util_rt(rq);
> util += dl_util;
> ---8<---
> 
> Thus, even when RT tasks are RUNNABLE, we don't always assume the CPU
> running at the max capacity but just whatever is the aggregated
> utilization across all the classes.
> 
> With uclamp, we have:
> 
> ---8<---
> util = cpu_util_rt(rq) + util_cfs;
> if (type == FREQUENCY_UTIL)
> util = uclamp_util_with(rq, util, p);
> dl_util = cpu_util_dl(rq);
> if (type == ENERGY_UTIL)
> util += dl_util;
> ---8<---
> 
> So, I would say that, in terms of ENERGY_UTIL we do the same both
> w/ and w/o uclamp. Isn't it?

Yes but now you use FREQUENCY_UTIL for computing 'max_util' in the EAS
prediction.

Let's take an example. You have a perf domain with two CPUs. One CPU is
busy running a RT task, the other CPU runs a CFS task. Right now in
compute_energy() we only use ENERGY_UTIL, so 'max_util' ends up being
the max between the utilization of the two tasks. So we don't predict
we're going to max freq.

With your patch, we use FREQUENCY_UTIL to compute 'max_util', so we
_will_ predict that we're going to max freq. And we will do that even if
CONFIG_UCLAMP_TASK=n.

The default EAS calculation will be different with your patch when there
are runnable RT tasks in the system. This needs to be documented, I
think.

> > But I'm not hostile to the idea since it's possible to enable uclamp and
> > set the min cap to 0 for RT if you want. So there is a story there.
> > However, I think this needs be documented somewhere, at the very least.
> 
> The only difference I see is that the actual frequency could be
> different (lower then max) when a clamped RT task is RUNNABLE.
> 
> Are you worried that running RT on a lower freq could have side
> effects on the estimated busy time the CPU ?
> 
> I also still don't completely get why you say it could be useful to
>"set the min cap to 0 for RT if you want"

I'm not saying it's useful, I'm saying userspace can decide to do that
if it thinks it is a good idea. The default should be min_cap = 1024 for
RT, no questions. But you _can_ change it at runtime if you want to.
That's my point. And doing that basically provides the same behaviour as
what we have right now in terms of EAS calculation (but 

Re: [PATCH v11 perf, bpf-next 7/9] perf tools: synthesize PERF_RECORD_* for loaded BPF programs

2019-01-22 Thread Arnaldo Carvalho de Melo
Em Tue, Jan 22, 2019 at 12:13:20PM -0200, Arnaldo Carvalho de Melo escreveu:
> Em Fri, Jan 18, 2019 at 11:46:55AM -0300, Arnaldo Carvalho de Melo escreveu:
> > Em Thu, Jan 17, 2019 at 08:15:19AM -0800, Song Liu escreveu:
> > > This patch synthesize PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT for
> > > BPF programs loaded before perf-record. This is achieved by gathering
> > > information about all BPF programs via sys_bpf.
> > 
> > Ditto
> 
> This is breaking 'perf sched', see below, the fix seems trivial:
> 
> [root@quaco ~]# perf sched record -a sleep 2
> [ perf record: Woken up 1 times to write data ]
> 0x5b60 [0x138]: failed to process type: 17
> [ perf record: Captured and wrote 1.539 MB perf.data ]
> [root@quaco ~]# perf sched lat
> 0x5b60 [0x138]: failed to process type: 17
> Failed to process events, error -22
> [root@quaco ~]#

So:

   perf_session__process_event (event->header.type = 17 (PERF_RECORD_KSYMBOL)
 if (tool->ordered_events)
   ret = perf_evlist__parse_sample_timestamp(evlist, event, );
   if (ret && ret != -1)
return ret;

So it returns here with -EFAULT, i.e. this is failing:

int perf_evlist__parse_sample_timestamp(struct perf_evlist *evlist,
union perf_event *event,
u64 *timestamp)
{
struct perf_evsel *evsel = perf_evlist__event2evsel(evlist, event);

if (!evsel)
return -EFAULT;
return perf_evsel__parse_sample_timestamp(evsel, event, timestamp);
}

It isn't mapping the event ID it finds back to an evsel.. Jiri, ideas?

This is happening so far only for 'perf sched', perf record with two
events works.

- Arnaldo
 
> [acme@quaco perf]$ git bisect good
> 7b612e291a5affb12b9d0b87332c71bcbe9c5db4 is the first bad commit
> commit 7b612e291a5affb12b9d0b87332c71bcbe9c5db4
> Author: Song Liu 
> Date:   Thu Jan 17 08:15:19 2019 -0800
> 
> perf tools: Synthesize PERF_RECORD_* for loaded BPF programs
> 
> This patch synthesize PERF_RECORD_KSYMBOL and PERF_RECORD_BPF_EVENT for
> BPF programs loaded before perf-record. This is achieved by gathering
> information about all BPF programs via sys_bpf.
> 
> Committer notes:
> 
> Fix the build on some older systems such as amazonlinux:1 where it was
> breaking with:
> 
>   util/bpf-event.c: In function 'perf_event__synthesize_one_bpf_prog':
>   util/bpf-event.c:52:9: error: missing initializer for field 'type' of 
> 'struct bpf_prog_info' [-Werror=missing-field-initializers]
> struct bpf_prog_info info = {};
>^
>   In file included from /git/linux/tools/lib/bpf/bpf.h:26:0,
>from util/bpf-event.c:3:
>   /git/linux/tools/include/uapi/linux/bpf.h:2699:8: note: 'type' declared 
> here
> __u32 type;
>   ^
>   cc1: all warnings being treated as errors
> 
> Further fix on a centos:6 system:
> 
>   cc1: warnings being treated as errors
>   util/bpf-event.c: In function 'perf_event__synthesize_one_bpf_prog':
>   util/bpf-event.c:50: error: 'func_info_rec_size' may be used 
> uninitialized in this function
> 
> The compiler is wrong, but to silence it, initialize that variable to
> zero.
> 
> One more fix, this time for debian:experimental-x-mips, x-mips64 and
> x-mipsel:
> 
>   util/bpf-event.c: In function 'perf_event__synthesize_one_bpf_prog':
>   util/bpf-event.c:93:16: error: implicit declaration of function 
> 'calloc' [-Werror=implicit-function-declaration]
>  func_infos = calloc(sub_prog_cnt, func_info_rec_size);
>   ^~
>   util/bpf-event.c:93:16: error: incompatible implicit declaration of 
> built-in function 'calloc' [-Werror]
>   util/bpf-event.c:93:16: note: include '' or provide a 
> declaration of 'calloc'
> 
> Add the missing header.
> 
> Committer testing:
> 
>   # perf record --bpf-event sleep 1
>   [ perf record: Woken up 1 times to write data ]
>   [ perf record: Captured and wrote 0.021 MB perf.data (7 samples) ]
>   # perf report -D | grep PERF_RECORD_BPF_EVENT | nl
>  1  0 0x4b10 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 13
>  2  0 0x4c60 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 14
>  3  0 0x4db0 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 15
>  4  0 0x4f00 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 16
>  5  0 0x5050 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 17
>  6  0 0x51a0 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 18
>  7  0 0x52f0 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 21
>  8  0 0x5440 [0x18]: PERF_RECORD_BPF_EVENT bpf event with type 1, 
> flags 0, id 22
>   # bpftool prog
>   13: cgroup_skb  tag 7be49e3934a125ba  gpl
> 

RE: [PATCH v5 0/4] arm64 SMMUv3 PMU driver with IORT support

2019-01-22 Thread Shameerali Kolothum Thodi
Hi Robin/Lorenzo,

A gentle reminder on this series. Please take a look.

Thanks,
Shameer

> -Original Message-
> From: Linuxarm [mailto:linuxarm-boun...@huawei.com] On Behalf Of Shameer
> Kolothum
> Sent: 30 November 2018 15:48
> To: lorenzo.pieral...@arm.com; robin.mur...@arm.com
> Cc: mark.rutl...@arm.com; vkil...@codeaurora.org;
> neil.m.lee...@gmail.com; jean-philippe.bruc...@arm.com;
> pa...@codeaurora.org; will.dea...@arm.com; rruig...@codeaurora.org;
> Linuxarm ; linux-kernel@vger.kernel.org;
> linux-a...@vger.kernel.org; linux-arm-ker...@lists.infradead.org
> Subject: [PATCH v5 0/4] arm64 SMMUv3 PMU driver with IORT support
> 
> This adds a driver for the SMMUv3 PMU into the perf framework.
> It includes an IORT update to support PM Counter Groups.
> 
> This is based on the initial work done by Neil Leeder[1]
> 
> SMMUv3 PMCG devices are named as smmuv3_pmcg_
> where  is the physical page address of the SMMU PMCG.
> For example, the PMCG at 0xff8884 is named smmuv3_pmcg_ff88840
> 
> Usage example:
> For common arch supported events:
> perf stat -e smmuv3_pmcg_ff88840/transaction,filter_enable=1,
>  filter_span=1,filter_stream_id=0x42/ -a netperf
> 
> For IMP DEF events:
> perf stat -e smmuv3_pmcg_ff88840/event=id/ -a netperf
> 
> This is sanity tested on a HiSilicon platform that requires
> a quirk to run  it properly. As per HiSilicon erratum  #162001800,
> PMCG event counter registers (SMMU_PMCG_EVCNTRn) on HiSilicon Hip08
> platforms are read only and this prevents the software from setting
> the initial period on event start. Unfortunately we were a bit late
> in the cycle to detect this issue and now require software workaround
> for this. Patch #4 is added to this series to provide a workaround
> for this issue.
> 
> Further testing on supported platforms are very much welcome.
> 
> v4 ---> v5
> -IORT code is modified to pass the option/quirk flags to the driver
>  through platform_data (patch #4), based on Robin's comments.
> -Removed COMPILE_TEST (patch #2).
> 
> v3 --> v4
> 
> -Addressed comments from Jean and Robin.
> -Merged dma config callbacks as per Lorenzo's comments(patch #1).
> -Added handling of Global(Counter0) filter settings mode(patch #2).
> -Added patch #4 to address HiSilicon erratum  #162001800
> -
> v2 --> v3
> 
> -Addressed comments from Robin.
> -Removed iort helper function to retrieve the PMCG reference smmu.
> -PMCG devices are now named using the base address
> 
> v1 --> v2
> 
> - Addressed comments from Robin.
> - Added an helper to retrieve the associated smmu dev and named PMUs
>   to make the association visible to user.
> - Added MSI support  for overflow irq
> 
> [1]https://www.spinics.net/lists/arm-kernel/msg598591.html
> 
> Neil Leeder (2):
>   acpi: arm64: add iort support for PMCG
>   perf: add arm64 smmuv3 pmu driver
> 
> Shameer Kolothum (2):
>   perf/smmuv3: Add MSI irq support
>   perf/smmuv3_pmu: Enable HiSilicon Erratum 162001800 quirk
> 
>  drivers/acpi/arm64/iort.c | 127 +--
>  drivers/perf/Kconfig  |   9 +
>  drivers/perf/Makefile |   1 +
>  drivers/perf/arm_smmuv3_pmu.c | 859
> ++
>  include/linux/acpi_iort.h |   3 +
>  5 files changed, 975 insertions(+), 24 deletions(-)
>  create mode 100644 drivers/perf/arm_smmuv3_pmu.c
> 
> --
> 2.7.4
> 
> 
> ___
> Linuxarm mailing list
> linux...@huawei.com
> http://hulk.huawei.com/mailman/listinfo/linuxarm


[PATCH] net: amd8111e: clean up two minor indentation issues

2019-01-22 Thread Colin King
From: Colin Ian King 

Two statements are incorrecly indented, fix these by removing a space.

Signed-off-by: Colin Ian King 
---
 drivers/net/ethernet/amd/amd8111e.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/amd/amd8111e.c 
b/drivers/net/ethernet/amd/amd8111e.c
index a90080f12e67..b9632928496e 100644
--- a/drivers/net/ethernet/amd/amd8111e.c
+++ b/drivers/net/ethernet/amd/amd8111e.c
@@ -435,7 +435,7 @@ static int amd8111e_restart(struct net_device *dev)
int i,reg_val;
 
/* stop the chip */
-writel(RUN, mmio + CMD0);
+   writel(RUN, mmio + CMD0);
 
if(amd8111e_init_ring(dev))
return -ENOMEM;
@@ -1720,7 +1720,7 @@ static void amd8111e_config_ipg(struct timer_list *t)
writew((u32)tmp_ipg, mmio + IPG);
writew((u32)(tmp_ipg - IFS1_DELTA), mmio + IFS1);
}
-mod_timer(>ipg_data.ipg_timer, jiffies + IPG_CONVERGE_JIFFIES);
+   mod_timer(>ipg_data.ipg_timer, jiffies + IPG_CONVERGE_JIFFIES);
return;
 
 }
-- 
2.19.1



[PATCH 6/6] x86: xen: no need to check return value of debugfs_create functions

2019-01-22 Thread Greg Kroah-Hartman
When calling debugfs functions, there is no need to ever check the
return value.  The function can work or not, but the code logic should
never do something different based on this.

Cc: Boris Ostrovsky 
Cc: Juergen Gross 
Cc: Stefano Stabellini 
Cc: Thomas Gleixner 
Cc: Ingo Molnar 
Cc: Borislav Petkov 
Cc: "H. Peter Anvin" 
Cc: 
Cc: 
Signed-off-by: Greg Kroah-Hartman 
---
 arch/x86/xen/debugfs.c | 7 +--
 arch/x86/xen/p2m.c | 3 ---
 2 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/x86/xen/debugfs.c b/arch/x86/xen/debugfs.c
index 13da87918b4f..532410998684 100644
--- a/arch/x86/xen/debugfs.c
+++ b/arch/x86/xen/debugfs.c
@@ -9,13 +9,8 @@ static struct dentry *d_xen_debug;
 
 struct dentry * __init xen_init_debugfs(void)
 {
-   if (!d_xen_debug) {
+   if (!d_xen_debug)
d_xen_debug = debugfs_create_dir("xen", NULL);
-
-   if (!d_xen_debug)
-   pr_warning("Could not create 'xen' debugfs 
directory\n");
-   }
-
return d_xen_debug;
 }
 
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 055e37e43541..9d3e29805b73 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -810,9 +810,6 @@ static int __init xen_p2m_debugfs(void)
 {
struct dentry *d_xen = xen_init_debugfs();
 
-   if (d_xen == NULL)
-   return -ENOMEM;
-
d_mmu_debug = debugfs_create_dir("mmu", d_xen);
 
debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, _dump_fops);
-- 
2.20.1



<    3   4   5   6   7   8   9   10   11   12   >