Urgent,

2018-10-02 Thread Juliet Muhammad
Hello 

   Please i still await your response regarding my previous email.


Urgent,

2018-10-02 Thread Juliet Muhammad
Hello 

   Please i still await your response regarding my previous email.


Reminder,

2018-10-02 Thread Juliet Muhammad
Hello 

   Please i still await your response regarding my previous email.


Reminder,

2018-10-02 Thread Juliet Muhammad
Hello 

   Please i still await your response regarding my previous email.


linux-next: build failure after merge of the vfs tree

2018-10-02 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

/home/sfr/next/next/fs/f2fs/super.c: In function 'f2fs_remount':
/home/sfr/next/next/fs/f2fs/super.c:1589:16: error: 'MS_RDONLY' undeclared 
(first use in this function); did you mean 'IS_RDONLY'?
  if ((*flags & MS_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
^
IS_RDONLY

Caused by commit

  dcf8001d292b ("vfs: Suppress MS_* flag defs within the kernel unless 
explicitly enabled")

interacting with commit

  f80f781514ef ("f2fs: checkpoint disabling")

from the f2fs tree.

I have added the following merge fix patch for today.  If it is correct,
I assume that it could be applied to f2fs tree as the the other uses of
MS_RDONLY have already been changed to SB_RDONLY.  (There is another
use of MS_READONLY in this function that is already cleaned up in the
vfs tree commit.)

From: Stephen Rothwell 
Date: Wed, 3 Oct 2018 10:27:04 +1000
Subject: [PATCH] f2fs: update for MS_* flags mostly going away

Signed-off-by: Stephen Rothwell 
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 6ed77589ff2b..b612a9e4a35e 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1586,7 +1586,7 @@ static int f2fs_remount(struct super_block *sb, int 
*flags,
goto restore_opts;
}
 
-   if ((*flags & MS_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
+   if ((*flags & SB_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
err = -EINVAL;
f2fs_msg(sbi->sb, KERN_WARNING,
"disabling checkpoint not compatible with read-only");
-- 
2.18.0

-- 
Cheers,
Stephen Rothwell


pgpfDneKUFy5e.pgp
Description: OpenPGP digital signature


linux-next: build failure after merge of the vfs tree

2018-10-02 Thread Stephen Rothwell
Hi Al,

After merging the vfs tree, today's linux-next build (x86_64 allmodconfig)
failed like this:

/home/sfr/next/next/fs/f2fs/super.c: In function 'f2fs_remount':
/home/sfr/next/next/fs/f2fs/super.c:1589:16: error: 'MS_RDONLY' undeclared 
(first use in this function); did you mean 'IS_RDONLY'?
  if ((*flags & MS_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
^
IS_RDONLY

Caused by commit

  dcf8001d292b ("vfs: Suppress MS_* flag defs within the kernel unless 
explicitly enabled")

interacting with commit

  f80f781514ef ("f2fs: checkpoint disabling")

from the f2fs tree.

I have added the following merge fix patch for today.  If it is correct,
I assume that it could be applied to f2fs tree as the the other uses of
MS_RDONLY have already been changed to SB_RDONLY.  (There is another
use of MS_READONLY in this function that is already cleaned up in the
vfs tree commit.)

From: Stephen Rothwell 
Date: Wed, 3 Oct 2018 10:27:04 +1000
Subject: [PATCH] f2fs: update for MS_* flags mostly going away

Signed-off-by: Stephen Rothwell 
---
 fs/f2fs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 6ed77589ff2b..b612a9e4a35e 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1586,7 +1586,7 @@ static int f2fs_remount(struct super_block *sb, int 
*flags,
goto restore_opts;
}
 
-   if ((*flags & MS_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
+   if ((*flags & SB_RDONLY) && test_opt(sbi, DISABLE_CHECKPOINT)) {
err = -EINVAL;
f2fs_msg(sbi->sb, KERN_WARNING,
"disabling checkpoint not compatible with read-only");
-- 
2.18.0

-- 
Cheers,
Stephen Rothwell


pgpfDneKUFy5e.pgp
Description: OpenPGP digital signature


tracing child threads with address filtering using intel_pt

2018-10-02 Thread Mansour Alharthi
Hello all,

I am having trouble tracing child threads when using address filtering
with intel_pt ..

Assume this test code:

thread_start(){
...
test();
...
}

test(){
printf("test");
}

main(){
...
pthread_create(.., thread_start,);
}


Tracing the above program with the following command:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events --filter
'filter * @ ./test' -- ./test

Returns zero trace for code executed by child thread, i.e.
thread_start() and test() functions..
While tracing without the filter does include the threads trace:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events -- ./test

Is this intended? or is it a bug?

Thanks!
Mansour.



tracing child threads with address filtering using intel_pt

2018-10-02 Thread Mansour Alharthi
Hello all,

I am having trouble tracing child threads when using address filtering
with intel_pt ..

Assume this test code:

thread_start(){
...
test();
...
}

test(){
printf("test");
}

main(){
...
pthread_create(.., thread_start,);
}


Tracing the above program with the following command:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events --filter
'filter * @ ./test' -- ./test

Returns zero trace for code executed by child thread, i.e.
thread_start() and test() functions..
While tracing without the filter does include the threads trace:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events -- ./test

Is this intended? or is it a bug?

Thanks!
Mansour.



[PATCH 1/2] ARM: multi_v7_defconfig: enable CONFIG_MMC_UNIPHIER

2018-10-02 Thread Masahiro Yamada
Enable the UniPhier SD controller driver.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index fc33444..0d56568 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -771,6 +771,7 @@ CONFIG_MMC_ATMELMCI=y
 CONFIG_MMC_SDHCI_MSM=y
 CONFIG_MMC_MVSDIO=y
 CONFIG_MMC_SDHI=y
+CONFIG_MMC_UNIPHIER=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_EXYNOS=y
 CONFIG_MMC_DW_ROCKCHIP=y
-- 
2.7.4



[PATCH 1/2] ARM: multi_v7_defconfig: enable CONFIG_MMC_UNIPHIER

2018-10-02 Thread Masahiro Yamada
Enable the UniPhier SD controller driver.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/configs/multi_v7_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/multi_v7_defconfig 
b/arch/arm/configs/multi_v7_defconfig
index fc33444..0d56568 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -771,6 +771,7 @@ CONFIG_MMC_ATMELMCI=y
 CONFIG_MMC_SDHCI_MSM=y
 CONFIG_MMC_MVSDIO=y
 CONFIG_MMC_SDHI=y
+CONFIG_MMC_UNIPHIER=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_EXYNOS=y
 CONFIG_MMC_DW_ROCKCHIP=y
-- 
2.7.4



[PATCH 2/2] arm64: defconfig: enable CONFIG_MMC_UNIPHIER

2018-10-02 Thread Masahiro Yamada
Enable the UniPhier SD controller driver.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index db8d364..a15016e 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -520,6 +520,7 @@ CONFIG_MMC_MESON_GX=y
 CONFIG_MMC_SDHCI_MSM=y
 CONFIG_MMC_SPI=y
 CONFIG_MMC_SDHI=y
+CONFIG_MMC_UNIPHIER=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_EXYNOS=y
 CONFIG_MMC_DW_HI3798CV200=y
-- 
2.7.4



[PATCH 2/2] arm64: defconfig: enable CONFIG_MMC_UNIPHIER

2018-10-02 Thread Masahiro Yamada
Enable the UniPhier SD controller driver.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index db8d364..a15016e 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -520,6 +520,7 @@ CONFIG_MMC_MESON_GX=y
 CONFIG_MMC_SDHCI_MSM=y
 CONFIG_MMC_SPI=y
 CONFIG_MMC_SDHI=y
+CONFIG_MMC_UNIPHIER=y
 CONFIG_MMC_DW=y
 CONFIG_MMC_DW_EXYNOS=y
 CONFIG_MMC_DW_HI3798CV200=y
-- 
2.7.4



tracing child threads with address filtering using intel_pt pmu

2018-10-02 Thread Mansour Alharthi
Hello all,

I am having trouble tracing child threads when using address filtering 
with intel_pt ..

Assume this test code:

thread_start(){
...
test();
...
}

test(){
printf("test");
}

main(){
...
pthread_create(.., thread_start,);
}


Tracing the above program with the following command:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events --filter 
'filter * @ ./test' -- ./test

Returns zero trace for code executed by child thread, i.e. 
thread_start() and test() functions..
While tracing without the filter does include the threads trace:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events -- ./test

Is this intended? or is it a bug?

Thanks!
Mansour.



tracing child threads with address filtering using intel_pt pmu

2018-10-02 Thread Mansour Alharthi
Hello all,

I am having trouble tracing child threads when using address filtering 
with intel_pt ..

Assume this test code:

thread_start(){
...
test();
...
}

test(){
printf("test");
}

main(){
...
pthread_create(.., thread_start,);
}


Tracing the above program with the following command:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events --filter 
'filter * @ ./test' -- ./test

Returns zero trace for code executed by child thread, i.e. 
thread_start() and test() functions..
While tracing without the filter does include the threads trace:
perf record -v -m 512,1 -e intel_pt//u -T --switch-events -- ./test

Is this intended? or is it a bug?

Thanks!
Mansour.



Re: 4.14 backport request for dbdda842fe96f: "printk: Add console owner and waiter logic to load balance console writes"

2018-10-02 Thread Daniel Wang
On Tue, Oct 2, 2018 at 1:42 AM Petr Mladek  wrote:
>
> Well, I still wonder why it helped and why you do not see it with 4.4.
> I have a feeling that the console owner switch helped only by chance.
> In fact, you might be affected by a race in
> printk_safe_flush_on_panic() that was fixed by the commit:
>
> 554755be08fba31c7 printk: drop in_nmi check from printk_safe_flush_on_panic()
>
> The above one commit might be enough. Well, there was one more
> NMI-related race that was fixed by:
>
> ba552399954dde1b printk: Split the code for storing a message into the log 
> buffer
> a338f84dc196f44b printk: Create helper function to queue deferred console 
> handling
> 03fc7f9c99c1e7ae printk/nmi: Prevent deadlock when accessing the main log 
> buffer in NMI

All of these commits already exist in 4.14 stable, since 4.14.68. The deadlock
still exists even when built from 4.14.73 (latest tag) though. And cherrypicking
dbdda842fe96 fixes it.

>
> Best Regards,
> Petr



-- 
Best,
Daniel


smime.p7s
Description: S/MIME Cryptographic Signature


Re: 4.14 backport request for dbdda842fe96f: "printk: Add console owner and waiter logic to load balance console writes"

2018-10-02 Thread Daniel Wang
On Tue, Oct 2, 2018 at 1:42 AM Petr Mladek  wrote:
>
> Well, I still wonder why it helped and why you do not see it with 4.4.
> I have a feeling that the console owner switch helped only by chance.
> In fact, you might be affected by a race in
> printk_safe_flush_on_panic() that was fixed by the commit:
>
> 554755be08fba31c7 printk: drop in_nmi check from printk_safe_flush_on_panic()
>
> The above one commit might be enough. Well, there was one more
> NMI-related race that was fixed by:
>
> ba552399954dde1b printk: Split the code for storing a message into the log 
> buffer
> a338f84dc196f44b printk: Create helper function to queue deferred console 
> handling
> 03fc7f9c99c1e7ae printk/nmi: Prevent deadlock when accessing the main log 
> buffer in NMI

All of these commits already exist in 4.14 stable, since 4.14.68. The deadlock
still exists even when built from 4.14.73 (latest tag) though. And cherrypicking
dbdda842fe96 fixes it.

>
> Best Regards,
> Petr



-- 
Best,
Daniel


smime.p7s
Description: S/MIME Cryptographic Signature


linux-next: manual merge of the vfs tree with the f2fs tree

2018-10-02 Thread Stephen Rothwell
Hi Al,

Today's linux-next merge of the vfs tree got a conflict in:

  fs/f2fs/super.c

between commit:

  f80f781514ef ("f2fs: checkpoint disabling")

from the f2fs tree and commit:

  307c6e5241b4 ("vfs: Require specification of size of mount data for internal 
mounts")

from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/super.c
index 952a67b3184a,89970dd81b0e..
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@@ -1449,53 -1419,8 +1449,54 @@@ static void default_options(struct f2fs
  #ifdef CONFIG_QUOTA
  static int f2fs_enable_quotas(struct super_block *sb);
  #endif
 +
 +static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
 +{
 +  struct cp_control cpc;
 +  int err;
 +
 +  sbi->sb->s_flags |= SB_ACTIVE;
 +
 +  mutex_lock(>gc_mutex);
 +  for (; dirty_segments(sbi) > 2 * NR_CURSEG_TYPE;) {
 +  err = f2fs_gc(sbi, true, false, NULL_SEGNO);
 +  if (err == -ENODATA)
 +  break;
 +  if (err && err != -EAGAIN) {
 +  mutex_unlock(>gc_mutex);
 +  return err;
 +  }
 +  }
 +  mutex_unlock(>gc_mutex);
 +
 +  err = sync_filesystem(sbi->sb);
 +  if (err)
 +  return err;
 +
 +  mutex_lock(>gc_mutex);
 +  cpc.reason = CP_PAUSE;
 +  set_sbi_flag(sbi, SBI_CP_DISABLED);
 +  f2fs_write_checkpoint(sbi, );
 +
 +  sbi->unusable_block_count = 0;
 +  mutex_unlock(>gc_mutex);
 +  return 0;
 +}
 +
 +static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
 +{
 +  mutex_lock(>gc_mutex);
 +  f2fs_dirty_to_prefree(sbi);
 +
 +  clear_sbi_flag(sbi, SBI_CP_DISABLED);
 +  set_sbi_flag(sbi, SBI_IS_DIRTY);
 +  mutex_unlock(>gc_mutex);
 +
 +  f2fs_sync_fs(sbi->sb, 1);
 +}
 +
- static int f2fs_remount(struct super_block *sb, int *flags, char *data)
+ static int f2fs_remount(struct super_block *sb, int *flags,
+   char *data, size_t data_size)
  {
struct f2fs_sb_info *sbi = F2FS_SB(sb);
struct f2fs_mount_info org_mount_opt;


pgpcyPrVQL3on.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the vfs tree with the f2fs tree

2018-10-02 Thread Stephen Rothwell
Hi Al,

Today's linux-next merge of the vfs tree got a conflict in:

  fs/f2fs/super.c

between commit:

  f80f781514ef ("f2fs: checkpoint disabling")

from the f2fs tree and commit:

  307c6e5241b4 ("vfs: Require specification of size of mount data for internal 
mounts")

from the vfs tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc fs/f2fs/super.c
index 952a67b3184a,89970dd81b0e..
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@@ -1449,53 -1419,8 +1449,54 @@@ static void default_options(struct f2fs
  #ifdef CONFIG_QUOTA
  static int f2fs_enable_quotas(struct super_block *sb);
  #endif
 +
 +static int f2fs_disable_checkpoint(struct f2fs_sb_info *sbi)
 +{
 +  struct cp_control cpc;
 +  int err;
 +
 +  sbi->sb->s_flags |= SB_ACTIVE;
 +
 +  mutex_lock(>gc_mutex);
 +  for (; dirty_segments(sbi) > 2 * NR_CURSEG_TYPE;) {
 +  err = f2fs_gc(sbi, true, false, NULL_SEGNO);
 +  if (err == -ENODATA)
 +  break;
 +  if (err && err != -EAGAIN) {
 +  mutex_unlock(>gc_mutex);
 +  return err;
 +  }
 +  }
 +  mutex_unlock(>gc_mutex);
 +
 +  err = sync_filesystem(sbi->sb);
 +  if (err)
 +  return err;
 +
 +  mutex_lock(>gc_mutex);
 +  cpc.reason = CP_PAUSE;
 +  set_sbi_flag(sbi, SBI_CP_DISABLED);
 +  f2fs_write_checkpoint(sbi, );
 +
 +  sbi->unusable_block_count = 0;
 +  mutex_unlock(>gc_mutex);
 +  return 0;
 +}
 +
 +static void f2fs_enable_checkpoint(struct f2fs_sb_info *sbi)
 +{
 +  mutex_lock(>gc_mutex);
 +  f2fs_dirty_to_prefree(sbi);
 +
 +  clear_sbi_flag(sbi, SBI_CP_DISABLED);
 +  set_sbi_flag(sbi, SBI_IS_DIRTY);
 +  mutex_unlock(>gc_mutex);
 +
 +  f2fs_sync_fs(sbi->sb, 1);
 +}
 +
- static int f2fs_remount(struct super_block *sb, int *flags, char *data)
+ static int f2fs_remount(struct super_block *sb, int *flags,
+   char *data, size_t data_size)
  {
struct f2fs_sb_info *sbi = F2FS_SB(sb);
struct f2fs_mount_info org_mount_opt;


pgpcyPrVQL3on.pgp
Description: OpenPGP digital signature


Re: [PATCH] [v3] HID: add support for Apple Magic Trackpad 2

2018-10-02 Thread Peter Hutterer
On Tue, Oct 02, 2018 at 03:39:31PM -0700, Sean O'Brien wrote:
> On Mon, Oct 1, 2018 at 1:43 AM Benjamin Tissoires
>  wrote:
> >
> > [adding Peter, for the libinput question]
> >
> > On Fri, Sep 21, 2018 at 1:13 AM Sean O'Brien  wrote:
> > >
> > > USB device
> > > Vendor 05ac (Apple)
> > > Device 0265 (Magic Trackpad 2)
> > > Bluetooth device
> > > Vendor 004c (Apple)
> > > Device 0265 (Magic Trackpad 2)
> > >
> > > Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
> > > the device in multi-touch mode.
> > >
> > > Signed-off-by: Claudio Mettler 
> > > Signed-off-by: Marek Wyborski 
> > > Signed-off-by: Sean O'Brien 
> > > ---
> > >
> >
> > a few nitpcks:
> >
> > >  drivers/hid/hid-ids.h|   1 +
> > >  drivers/hid/hid-magicmouse.c | 149 +++
> > >  2 files changed, 134 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> > > index 5146ee029db4..bb0cd212c7cc 100644
> > > --- a/drivers/hid/hid-ids.h
> > > +++ b/drivers/hid/hid-ids.h
> > > @@ -92,6 +92,7 @@
> > >  #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
> > >  #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
> > >  #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD  0x030e
> > > +#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
> > >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
> > >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
> > >  #define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
> > > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> > > index b454c4386157..6a3a6c83e509 100644
> > > --- a/drivers/hid/hid-magicmouse.c
> > > +++ b/drivers/hid/hid-magicmouse.c
> > > @@ -54,6 +54,8 @@ module_param(report_undeciphered, bool, 0644);
> > >  MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch 
> > > state field using a MSC_RAW event");
> > >
> > >  #define TRACKPAD_REPORT_ID 0x28
> > > +#define TRACKPAD2_USB_REPORT_ID 0x02
> > > +#define TRACKPAD2_BT_REPORT_ID 0x31
> > >  #define MOUSE_REPORT_ID0x29
> > >  #define DOUBLE_REPORT_ID   0xf7
> > >  /* These definitions are not precise, but they're close enough.  (Bits
> > > @@ -91,6 +93,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report 
> > > undeciphered multi-touch state fie
> > >  #define TRACKPAD_RES_Y \
> > > ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
> > >
> > > +#define TRACKPAD2_DIMENSION_X (float)16000
> > > +#define TRACKPAD2_MIN_X -3678
> > > +#define TRACKPAD2_MAX_X 3934
> > > +#define TRACKPAD2_RES_X \
> > > +   ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 
> > > 100))
> > > +#define TRACKPAD2_DIMENSION_Y (float)11490
> > > +#define TRACKPAD2_MIN_Y -2478
> > > +#define TRACKPAD2_MAX_Y 2587
> > > +#define TRACKPAD2_RES_Y \
> > > +   ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 
> > > 100))
> > > +
> > >  /**
> > >   * struct magicmouse_sc - Tracks Magic Mouse-specific data.
> > >   * @input: Input device through which we report events.
> > > @@ -183,6 +196,7 @@ static void magicmouse_emit_touch(struct 
> > > magicmouse_sc *msc, int raw_id, u8 *tda
> > >  {
> > > struct input_dev *input = msc->input;
> > > int id, x, y, size, orientation, touch_major, touch_minor, state, 
> > > down;
> > > +   int pressure = 0;
> > >
> > > if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
> > > id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
> > > @@ -194,6 +208,20 @@ static void magicmouse_emit_touch(struct 
> > > magicmouse_sc *msc, int raw_id, u8 *tda
> > > touch_minor = tdata[4];
> > > state = tdata[7] & TOUCH_STATE_MASK;
> > > down = state != TOUCH_STATE_NONE;
> > > +   } else if (input->id.product == 
> > > USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
> > > +   id = tdata[8] & 0xf;
> > > +   x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
> > > +   y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) 
> > > >> 19);
> > > +   size = tdata[6];
> > > +   orientation = (tdata[8] >> 5) - 4;
> > > +   touch_major = tdata[4];
> > > +   touch_minor = tdata[5];
> > > +   /* Add to pressure to prevent libraries such as libinput
> > > +* from ignoring low pressure touches
> > > +*/
> > > +   pressure = tdata[7] + 30;
> >
> > Peter, can you have a look?
> >
> > To me, while adding this threshold, you are basically fooling
> > userspace, and we might want to come back to the raw values at some
> > point.
> > If there is a userspace problem, it has to be solved in userspace.
> >
> 
> I'm fine with removing the offset.  I haven't personally tested using
> libinput, but the chromium OS gesture detector I've been using can
> handle pressure values of 0.

libinput uses touch major/minor but only if a 

Re: [PATCH] [v3] HID: add support for Apple Magic Trackpad 2

2018-10-02 Thread Peter Hutterer
On Tue, Oct 02, 2018 at 03:39:31PM -0700, Sean O'Brien wrote:
> On Mon, Oct 1, 2018 at 1:43 AM Benjamin Tissoires
>  wrote:
> >
> > [adding Peter, for the libinput question]
> >
> > On Fri, Sep 21, 2018 at 1:13 AM Sean O'Brien  wrote:
> > >
> > > USB device
> > > Vendor 05ac (Apple)
> > > Device 0265 (Magic Trackpad 2)
> > > Bluetooth device
> > > Vendor 004c (Apple)
> > > Device 0265 (Magic Trackpad 2)
> > >
> > > Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
> > > the device in multi-touch mode.
> > >
> > > Signed-off-by: Claudio Mettler 
> > > Signed-off-by: Marek Wyborski 
> > > Signed-off-by: Sean O'Brien 
> > > ---
> > >
> >
> > a few nitpcks:
> >
> > >  drivers/hid/hid-ids.h|   1 +
> > >  drivers/hid/hid-magicmouse.c | 149 +++
> > >  2 files changed, 134 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> > > index 5146ee029db4..bb0cd212c7cc 100644
> > > --- a/drivers/hid/hid-ids.h
> > > +++ b/drivers/hid/hid-ids.h
> > > @@ -92,6 +92,7 @@
> > >  #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
> > >  #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
> > >  #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD  0x030e
> > > +#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
> > >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
> > >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
> > >  #define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
> > > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> > > index b454c4386157..6a3a6c83e509 100644
> > > --- a/drivers/hid/hid-magicmouse.c
> > > +++ b/drivers/hid/hid-magicmouse.c
> > > @@ -54,6 +54,8 @@ module_param(report_undeciphered, bool, 0644);
> > >  MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch 
> > > state field using a MSC_RAW event");
> > >
> > >  #define TRACKPAD_REPORT_ID 0x28
> > > +#define TRACKPAD2_USB_REPORT_ID 0x02
> > > +#define TRACKPAD2_BT_REPORT_ID 0x31
> > >  #define MOUSE_REPORT_ID0x29
> > >  #define DOUBLE_REPORT_ID   0xf7
> > >  /* These definitions are not precise, but they're close enough.  (Bits
> > > @@ -91,6 +93,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report 
> > > undeciphered multi-touch state fie
> > >  #define TRACKPAD_RES_Y \
> > > ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
> > >
> > > +#define TRACKPAD2_DIMENSION_X (float)16000
> > > +#define TRACKPAD2_MIN_X -3678
> > > +#define TRACKPAD2_MAX_X 3934
> > > +#define TRACKPAD2_RES_X \
> > > +   ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 
> > > 100))
> > > +#define TRACKPAD2_DIMENSION_Y (float)11490
> > > +#define TRACKPAD2_MIN_Y -2478
> > > +#define TRACKPAD2_MAX_Y 2587
> > > +#define TRACKPAD2_RES_Y \
> > > +   ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 
> > > 100))
> > > +
> > >  /**
> > >   * struct magicmouse_sc - Tracks Magic Mouse-specific data.
> > >   * @input: Input device through which we report events.
> > > @@ -183,6 +196,7 @@ static void magicmouse_emit_touch(struct 
> > > magicmouse_sc *msc, int raw_id, u8 *tda
> > >  {
> > > struct input_dev *input = msc->input;
> > > int id, x, y, size, orientation, touch_major, touch_minor, state, 
> > > down;
> > > +   int pressure = 0;
> > >
> > > if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
> > > id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
> > > @@ -194,6 +208,20 @@ static void magicmouse_emit_touch(struct 
> > > magicmouse_sc *msc, int raw_id, u8 *tda
> > > touch_minor = tdata[4];
> > > state = tdata[7] & TOUCH_STATE_MASK;
> > > down = state != TOUCH_STATE_NONE;
> > > +   } else if (input->id.product == 
> > > USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
> > > +   id = tdata[8] & 0xf;
> > > +   x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
> > > +   y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) 
> > > >> 19);
> > > +   size = tdata[6];
> > > +   orientation = (tdata[8] >> 5) - 4;
> > > +   touch_major = tdata[4];
> > > +   touch_minor = tdata[5];
> > > +   /* Add to pressure to prevent libraries such as libinput
> > > +* from ignoring low pressure touches
> > > +*/
> > > +   pressure = tdata[7] + 30;
> >
> > Peter, can you have a look?
> >
> > To me, while adding this threshold, you are basically fooling
> > userspace, and we might want to come back to the raw values at some
> > point.
> > If there is a userspace problem, it has to be solved in userspace.
> >
> 
> I'm fine with removing the offset.  I haven't personally tested using
> libinput, but the chromium OS gesture detector I've been using can
> handle pressure values of 0.

libinput uses touch major/minor but only if a 

[PATCH] fat: Expand a slightly out-of-date comment

2018-10-02 Thread Mihir Mehta
The file namei.c seems to have been renamed to namei_msdos.c, so I
decided to update the comment with the correct name, and expand it a bit
to tell the reader what to look for.

Signed-off-by: Mihir Mehta 
---
 fs/fat/dir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 7f5f369..ce5f958 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -369,7 +369,9 @@ static int fat_parse_short(struct super_block *sb,
}
 
memcpy(work, de->name, sizeof(work));
-   /* see namei.c, msdos_format_name */
+   /* For an explanation of the special treatment of 0x05 in
+* filenames, see msdos_format_name in namei_msdos.c
+*/
if (work[0] == 0x05)
work[0] = 0xE5;
 
-- 
2.7.4



[PATCH] fat: Expand a slightly out-of-date comment

2018-10-02 Thread Mihir Mehta
The file namei.c seems to have been renamed to namei_msdos.c, so I
decided to update the comment with the correct name, and expand it a bit
to tell the reader what to look for.

Signed-off-by: Mihir Mehta 
---
 fs/fat/dir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 7f5f369..ce5f958 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -369,7 +369,9 @@ static int fat_parse_short(struct super_block *sb,
}
 
memcpy(work, de->name, sizeof(work));
-   /* see namei.c, msdos_format_name */
+   /* For an explanation of the special treatment of 0x05 in
+* filenames, see msdos_format_name in namei_msdos.c
+*/
if (work[0] == 0x05)
work[0] = 0xE5;
 
-- 
2.7.4



[GIT PULL] ARM: dts: uniphier: UniPhier DT updates for v4.20

2018-10-02 Thread Masahiro Yamada
Hi Arnd, Olof,

Please pull UniPhier DT updates for the v4.20 MW.

In this cycle, I queued up all arm/arm64 changes
into a single branch to avoid build errors.

Thanks!





The following changes since commit 5b394b2ddf0347bef56e50c69a58773c94343ff3:

  Linux 4.19-rc1 (2018-08-26 14:11:59 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-uniphier.git
tags/uniphier-dt-v4.20

for you to fetch changes up to 84a9c4d55907feece68c6012d3c030cf5c841ceb:

  arm64: dts: uniphier: add SD controller nodes (2018-10-03 08:21:27 +0900)


UniPhier ARM SoC DT updates for v4.20

- Add more clocks to NAND controller nodes

- Add SPI controller nodes

- Add SD controller nodes


Kunihiko Hayashi (3):
  ARM: dts: uniphier: add SPI pin-mux node
  ARM: dts: uniphier: add SPI node for UniPhier 32bit SoCs
  arm64: dts: uniphier: add SPI node for LD20, LD11 and PXs3

Masahiro Yamada (4):
  ARM: uniphier: dts: add more clocks to Denali NAND controller node
  arm64: uniphier: dts: add more clocks to Denali NAND controller node
  ARM: dts: uniphier: add SD/eMMC controller nodes
  arm64: dts: uniphier: add SD controller nodes

 arch/arm/boot/dts/uniphier-ld4-ref.dts|  4 ++
 arch/arm/boot/dts/uniphier-ld4.dtsi   | 48 ++-
 arch/arm/boot/dts/uniphier-ld6b-ref.dts   |  4 ++
 arch/arm/boot/dts/uniphier-pinctrl.dtsi   | 25 
 arch/arm/boot/dts/uniphier-pro4-ace.dts   |  4 ++
 arch/arm/boot/dts/uniphier-pro4-ref.dts   |  4 ++
 arch/arm/boot/dts/uniphier-pro4-sanji.dts |  4 ++
 arch/arm/boot/dts/uniphier-pro4.dtsi  | 62 +++-
 arch/arm/boot/dts/uniphier-pro5.dtsi  | 59 ++-
 arch/arm/boot/dts/uniphier-pxs2-gentil.dts|  4 ++
 arch/arm/boot/dts/uniphier-pxs2-vodka.dts |  4 ++
 arch/arm/boot/dts/uniphier-pxs2.dtsi  | 59 ++-
 arch/arm/boot/dts/uniphier-sld8-ref.dts   |  4 ++
 arch/arm/boot/dts/uniphier-sld8.dtsi  | 48 ++-
 arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi  | 25 +++-
 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi  | 61 ++-
 .../boot/dts/socionext/uniphier-pxs3-ref.dts  |  4 ++
 arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi  | 43 +-
 18 files changed, 458 insertions(+), 8 deletions(-)


-- 
Best Regards
Masahiro Yamada


[GIT PULL] ARM: dts: uniphier: UniPhier DT updates for v4.20

2018-10-02 Thread Masahiro Yamada
Hi Arnd, Olof,

Please pull UniPhier DT updates for the v4.20 MW.

In this cycle, I queued up all arm/arm64 changes
into a single branch to avoid build errors.

Thanks!





The following changes since commit 5b394b2ddf0347bef56e50c69a58773c94343ff3:

  Linux 4.19-rc1 (2018-08-26 14:11:59 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-uniphier.git
tags/uniphier-dt-v4.20

for you to fetch changes up to 84a9c4d55907feece68c6012d3c030cf5c841ceb:

  arm64: dts: uniphier: add SD controller nodes (2018-10-03 08:21:27 +0900)


UniPhier ARM SoC DT updates for v4.20

- Add more clocks to NAND controller nodes

- Add SPI controller nodes

- Add SD controller nodes


Kunihiko Hayashi (3):
  ARM: dts: uniphier: add SPI pin-mux node
  ARM: dts: uniphier: add SPI node for UniPhier 32bit SoCs
  arm64: dts: uniphier: add SPI node for LD20, LD11 and PXs3

Masahiro Yamada (4):
  ARM: uniphier: dts: add more clocks to Denali NAND controller node
  arm64: uniphier: dts: add more clocks to Denali NAND controller node
  ARM: dts: uniphier: add SD/eMMC controller nodes
  arm64: dts: uniphier: add SD controller nodes

 arch/arm/boot/dts/uniphier-ld4-ref.dts|  4 ++
 arch/arm/boot/dts/uniphier-ld4.dtsi   | 48 ++-
 arch/arm/boot/dts/uniphier-ld6b-ref.dts   |  4 ++
 arch/arm/boot/dts/uniphier-pinctrl.dtsi   | 25 
 arch/arm/boot/dts/uniphier-pro4-ace.dts   |  4 ++
 arch/arm/boot/dts/uniphier-pro4-ref.dts   |  4 ++
 arch/arm/boot/dts/uniphier-pro4-sanji.dts |  4 ++
 arch/arm/boot/dts/uniphier-pro4.dtsi  | 62 +++-
 arch/arm/boot/dts/uniphier-pro5.dtsi  | 59 ++-
 arch/arm/boot/dts/uniphier-pxs2-gentil.dts|  4 ++
 arch/arm/boot/dts/uniphier-pxs2-vodka.dts |  4 ++
 arch/arm/boot/dts/uniphier-pxs2.dtsi  | 59 ++-
 arch/arm/boot/dts/uniphier-sld8-ref.dts   |  4 ++
 arch/arm/boot/dts/uniphier-sld8.dtsi  | 48 ++-
 arch/arm64/boot/dts/socionext/uniphier-ld11.dtsi  | 25 +++-
 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi  | 61 ++-
 .../boot/dts/socionext/uniphier-pxs3-ref.dts  |  4 ++
 arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi  | 43 +-
 18 files changed, 458 insertions(+), 8 deletions(-)


-- 
Best Regards
Masahiro Yamada


Re: [PATCH v2] perf: xgene: Add CPU hotplug support

2018-10-02 Thread Hoan Tran
Hi Mark,

> On Oct 2, 2018, at 4:46 AM, Mark Rutland  wrote:
> 
> [NOTICE: This email originated from an external sender. Please be mindful of 
> safe email handling and proprietary information protection practices.] 
> 
> 
> Hi Hoan,
> 
> On Wed, Sep 19, 2018 at 06:44:30PM +, Hoan Tran wrote:
>> This patch adds CPU hotplug support where the PMU migrates the context to
>> another online CPU when its CPU is offline.
>> 
>> It fixes the below issue where the user does offline the CPU which is 
>> assigned
>> to this PMU.
>> 
>> Assuming, CPU0 is assigned for this PMU. When the user does offline CPU0
>> [root@(none) ~]# echo 0 > /sys/devices/system/cpu/cpu0/online
>> This PMU does not work anymore and shows the below error.
>> [root@(none) ~]# perf stat -a -e l3c0/cycle-count/,l3c0/write/ sleep 1
>> Error:
>> The sys_perf_event_open() syscall returned with 19 (No such device) for 
>> event (l3c0/cycle-count/).
>> /bin/dmesg may provide additional information.
>> No CONFIG_PERF_EVENTS=y kernel support configured?
>> 
>> With this patch, when CPU0 is offline, PMU migrates to another online CPU and
>> works on that CPU.
>> 
>> Signed-off-by: Hoan Tran 
>> ---
>> v2:
>> * Remove the cpuhp instance when unregistering the PMU
> 
> Unfortunately, this has come through whitespae-damaged, with a
> disclaimer in the footer.
> 
> Could you please resend with those two details fixed?

I’ll fix it and send you another version later.

Thanks and Regards
Hoan

> 
> Thanks,
> Mark.



Re: [PATCH v2] perf: xgene: Add CPU hotplug support

2018-10-02 Thread Hoan Tran
Hi Mark,

> On Oct 2, 2018, at 4:46 AM, Mark Rutland  wrote:
> 
> [NOTICE: This email originated from an external sender. Please be mindful of 
> safe email handling and proprietary information protection practices.] 
> 
> 
> Hi Hoan,
> 
> On Wed, Sep 19, 2018 at 06:44:30PM +, Hoan Tran wrote:
>> This patch adds CPU hotplug support where the PMU migrates the context to
>> another online CPU when its CPU is offline.
>> 
>> It fixes the below issue where the user does offline the CPU which is 
>> assigned
>> to this PMU.
>> 
>> Assuming, CPU0 is assigned for this PMU. When the user does offline CPU0
>> [root@(none) ~]# echo 0 > /sys/devices/system/cpu/cpu0/online
>> This PMU does not work anymore and shows the below error.
>> [root@(none) ~]# perf stat -a -e l3c0/cycle-count/,l3c0/write/ sleep 1
>> Error:
>> The sys_perf_event_open() syscall returned with 19 (No such device) for 
>> event (l3c0/cycle-count/).
>> /bin/dmesg may provide additional information.
>> No CONFIG_PERF_EVENTS=y kernel support configured?
>> 
>> With this patch, when CPU0 is offline, PMU migrates to another online CPU and
>> works on that CPU.
>> 
>> Signed-off-by: Hoan Tran 
>> ---
>> v2:
>> * Remove the cpuhp instance when unregistering the PMU
> 
> Unfortunately, this has come through whitespae-damaged, with a
> disclaimer in the footer.
> 
> Could you please resend with those two details fixed?

I’ll fix it and send you another version later.

Thanks and Regards
Hoan

> 
> Thanks,
> Mark.



Sparse warnings from calls to max3() and max

2018-10-02 Thread Larry Finger

Hi,

Sparse has suddenly started issuing as many as 11 warnings of "expression using 
sizeof(void)" for each call to max3(). There are similar warnings for calls to 
max(), thus I think this is the origin of the problem. My sparse version is 
20180324-1.3-x86_64 installed in openSUSE Tumbleweed. My kernel is 4.19.0-rc6.


Thanks,

Larry


Sparse warnings from calls to max3() and max

2018-10-02 Thread Larry Finger

Hi,

Sparse has suddenly started issuing as many as 11 warnings of "expression using 
sizeof(void)" for each call to max3(). There are similar warnings for calls to 
max(), thus I think this is the origin of the problem. My sparse version is 
20180324-1.3-x86_64 installed in openSUSE Tumbleweed. My kernel is 4.19.0-rc6.


Thanks,

Larry


Re: [RFC PATCH 03/10] arch/x86: Re-arrange RDT init code

2018-10-02 Thread Moger, Babu
Hi Reinette,
Thanks for the review. My response below.

On 10/02/2018 02:21 PM, Reinette Chatre wrote:
> Hi Babu,
> 
> On 9/24/2018 12:19 PM, Moger, Babu wrote:
>> Re-organize the RDT init code. Separate the call sequence for each
>> feature. That way, it is easy to call quirks or features separately
>> for each vendor if there are differences.
>>
>> Signed-off-by: Babu Moger 
>> ---
>>  arch/x86/kernel/cpu/rdt.c | 44 ---
>>  1 file changed, 32 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/rdt.c b/arch/x86/kernel/cpu/rdt.c
>> index b361c63170d7..736715b81fd8 100644
>> --- a/arch/x86/kernel/cpu/rdt.c
>> +++ b/arch/x86/kernel/cpu/rdt.c
>> @@ -813,10 +813,6 @@ static __init bool get_rdt_alloc_resources(void)
>>  ret = true;
>>  }
>>  
>> -if (rdt_cpu_has(X86_FEATURE_MBA)) {
>> -if (rdt_get_mem_config(_resources_all[RDT_RESOURCE_MBA]))
>> -ret = true;
>> -}
> 
> The commit message mentions that the call sequence for each feature is
> separated, but here only the MBA feature is separated.

Yes. MBA and quirks are separated. I will fix the commit message. I
overlooked some of the errors returned by these functions. Let me go back
and update this patch. Will keep mostly as is. Only separate MBA and
quirks which are important. Will make sure errors are propagated properly.

> 
> The MBA feature detection is removed above  (more later)
> 
>>  return ret;
>>  }
>>  
>> @@ -831,11 +827,12 @@ static __init bool get_rdt_mon_resources(void)
>>  
>>  if (!rdt_mon_features)
>>  return false;
>> +else
>> +return true;
>>  
>> -return !rdt_get_mon_l3_config(_resources_all[RDT_RESOURCE_L3]);
>>  }
>>  
>> -static __init void rdt_quirks(void)
>> +static __init void rdt_quirks_intel(void)
>>  {
>>  switch (boot_cpu_data.x86_model) {
>>  case INTEL_FAM6_HASWELL_X:
>> @@ -850,13 +847,22 @@ static __init void rdt_quirks(void)
>>  }
>>  }
>>  
>> -static __init bool get_rdt_resources(void)
>> +static __init void rdt_quirks(void)
>>  {
>> -rdt_quirks();
>> -rdt_alloc_capable = get_rdt_alloc_resources();
>> -rdt_mon_capable = get_rdt_mon_resources();
>> +if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
>> +rdt_quirks_intel();
>> +}
>> +
>> +static __init void rdt_detect_l3_mon(void)
>> +{
>> +if (rdt_mon_capable)
>> +rdt_get_mon_l3_config(_resources_all[RDT_RESOURCE_L3]);
> 
> The possible errors from this configuration is now lost.

Yes. I overlooked it. Same comment as above. Let me go back and update
this patch.
> 
>> +}
>>  
>> -return (rdt_mon_capable || rdt_alloc_capable);
>> +static __init void rdt_check_mba(void)
>> +{
>> +if (rdt_cpu_has(X86_FEATURE_MBA))
>> +rdt_get_mem_config(_resources_all[RDT_RESOURCE_MBA]);
> 
> Here too the possible failure of this configuration is now lost.

Ditto.. Let me go back and update this patch.

> 
>>  }
>>  
>>  static enum cpuhp_state rdt_online;
>> @@ -866,8 +872,22 @@ static int __init rdt_late_init(void)
>>  struct rdt_resource *r;
>>  int state, ret;
>>  
>> -if (!get_rdt_resources())
>> +/* Run quirks first */
>> +rdt_quirks();
>> +
>> +rdt_alloc_capable = get_rdt_alloc_resources();
>> +rdt_mon_capable = get_rdt_mon_resources();
>> +
>> +if (!(rdt_alloc_capable || rdt_mon_capable)) {
>> +pr_info("RDT allocation or monitoring not detected\n");
> 
> This function ends with a log entry for every resource discovered. Is
> this new log entry needed to indicate that such resources have not been
> found? Could it not just be the absence of the other message?

As this is relatively new feature, so I added this info message. It helped
me debug what went wrong. Otherwise, I don't see anything. I can remove it
if the message is too annoying to the user.

> 
>>  return -ENODEV;
>> +}
> 
> ... (continued from above) ... since the MBA feature detection was
> removed from get_rdt_alloc_resources() would the above not cause failure
> on systems that only support MBA?

yes. Let me go back and update this patch.
> 
>> +
>> +/* Detect l3 monitoring resources */
> 
> I do not think this comment is accurate ... has the monitoring resources
> not been detected earlier in get_rdt_mon_resources() and now they will
> be configured?
> 
>> +rdt_detect_l3_mon();
>> +
>> +/* Check for Memory Bandwidth Allocation */
>> +rdt_check_mba();
> 
> To follow up on above .. the potential failure of these configurations
> are now lost here. Initialization should not continue if these
> configurations failed.

Yes. Let me go back and update this patch.

> 
>>  
>>  rdt_init_padding();
>>  
>>
> 
> Reinette
> 


Re: [RFC PATCH 03/10] arch/x86: Re-arrange RDT init code

2018-10-02 Thread Moger, Babu
Hi Reinette,
Thanks for the review. My response below.

On 10/02/2018 02:21 PM, Reinette Chatre wrote:
> Hi Babu,
> 
> On 9/24/2018 12:19 PM, Moger, Babu wrote:
>> Re-organize the RDT init code. Separate the call sequence for each
>> feature. That way, it is easy to call quirks or features separately
>> for each vendor if there are differences.
>>
>> Signed-off-by: Babu Moger 
>> ---
>>  arch/x86/kernel/cpu/rdt.c | 44 ---
>>  1 file changed, 32 insertions(+), 12 deletions(-)
>>
>> diff --git a/arch/x86/kernel/cpu/rdt.c b/arch/x86/kernel/cpu/rdt.c
>> index b361c63170d7..736715b81fd8 100644
>> --- a/arch/x86/kernel/cpu/rdt.c
>> +++ b/arch/x86/kernel/cpu/rdt.c
>> @@ -813,10 +813,6 @@ static __init bool get_rdt_alloc_resources(void)
>>  ret = true;
>>  }
>>  
>> -if (rdt_cpu_has(X86_FEATURE_MBA)) {
>> -if (rdt_get_mem_config(_resources_all[RDT_RESOURCE_MBA]))
>> -ret = true;
>> -}
> 
> The commit message mentions that the call sequence for each feature is
> separated, but here only the MBA feature is separated.

Yes. MBA and quirks are separated. I will fix the commit message. I
overlooked some of the errors returned by these functions. Let me go back
and update this patch. Will keep mostly as is. Only separate MBA and
quirks which are important. Will make sure errors are propagated properly.

> 
> The MBA feature detection is removed above  (more later)
> 
>>  return ret;
>>  }
>>  
>> @@ -831,11 +827,12 @@ static __init bool get_rdt_mon_resources(void)
>>  
>>  if (!rdt_mon_features)
>>  return false;
>> +else
>> +return true;
>>  
>> -return !rdt_get_mon_l3_config(_resources_all[RDT_RESOURCE_L3]);
>>  }
>>  
>> -static __init void rdt_quirks(void)
>> +static __init void rdt_quirks_intel(void)
>>  {
>>  switch (boot_cpu_data.x86_model) {
>>  case INTEL_FAM6_HASWELL_X:
>> @@ -850,13 +847,22 @@ static __init void rdt_quirks(void)
>>  }
>>  }
>>  
>> -static __init bool get_rdt_resources(void)
>> +static __init void rdt_quirks(void)
>>  {
>> -rdt_quirks();
>> -rdt_alloc_capable = get_rdt_alloc_resources();
>> -rdt_mon_capable = get_rdt_mon_resources();
>> +if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
>> +rdt_quirks_intel();
>> +}
>> +
>> +static __init void rdt_detect_l3_mon(void)
>> +{
>> +if (rdt_mon_capable)
>> +rdt_get_mon_l3_config(_resources_all[RDT_RESOURCE_L3]);
> 
> The possible errors from this configuration is now lost.

Yes. I overlooked it. Same comment as above. Let me go back and update
this patch.
> 
>> +}
>>  
>> -return (rdt_mon_capable || rdt_alloc_capable);
>> +static __init void rdt_check_mba(void)
>> +{
>> +if (rdt_cpu_has(X86_FEATURE_MBA))
>> +rdt_get_mem_config(_resources_all[RDT_RESOURCE_MBA]);
> 
> Here too the possible failure of this configuration is now lost.

Ditto.. Let me go back and update this patch.

> 
>>  }
>>  
>>  static enum cpuhp_state rdt_online;
>> @@ -866,8 +872,22 @@ static int __init rdt_late_init(void)
>>  struct rdt_resource *r;
>>  int state, ret;
>>  
>> -if (!get_rdt_resources())
>> +/* Run quirks first */
>> +rdt_quirks();
>> +
>> +rdt_alloc_capable = get_rdt_alloc_resources();
>> +rdt_mon_capable = get_rdt_mon_resources();
>> +
>> +if (!(rdt_alloc_capable || rdt_mon_capable)) {
>> +pr_info("RDT allocation or monitoring not detected\n");
> 
> This function ends with a log entry for every resource discovered. Is
> this new log entry needed to indicate that such resources have not been
> found? Could it not just be the absence of the other message?

As this is relatively new feature, so I added this info message. It helped
me debug what went wrong. Otherwise, I don't see anything. I can remove it
if the message is too annoying to the user.

> 
>>  return -ENODEV;
>> +}
> 
> ... (continued from above) ... since the MBA feature detection was
> removed from get_rdt_alloc_resources() would the above not cause failure
> on systems that only support MBA?

yes. Let me go back and update this patch.
> 
>> +
>> +/* Detect l3 monitoring resources */
> 
> I do not think this comment is accurate ... has the monitoring resources
> not been detected earlier in get_rdt_mon_resources() and now they will
> be configured?
> 
>> +rdt_detect_l3_mon();
>> +
>> +/* Check for Memory Bandwidth Allocation */
>> +rdt_check_mba();
> 
> To follow up on above .. the potential failure of these configurations
> are now lost here. Initialization should not continue if these
> configurations failed.

Yes. Let me go back and update this patch.

> 
>>  
>>  rdt_init_padding();
>>  
>>
> 
> Reinette
> 


Re: general protection fault in rb_erase

2018-10-02 Thread Theodore Y. Ts'o
On Tue, Sep 25, 2018 at 04:44:03PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:846e8dd47c26 Merge tag 'scsi-fixes' of git://git.kernel.or..
> git tree:   upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=15c874a140
> kernel config:  https://syzkaller.appspot.com/x/.config?x=dfb440e26f0a6f6f
> dashboard link: https://syzkaller.appspot.com/bug?extid=e81ccd4744c6c4f71354
> compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
> syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=15bddd2a40
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1293d3fa40

Fixed with this patch:

http://patchwork.ozlabs.org/patch/978083/


Re: general protection fault in rb_erase

2018-10-02 Thread Theodore Y. Ts'o
On Tue, Sep 25, 2018 at 04:44:03PM -0700, syzbot wrote:
> Hello,
> 
> syzbot found the following crash on:
> 
> HEAD commit:846e8dd47c26 Merge tag 'scsi-fixes' of git://git.kernel.or..
> git tree:   upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=15c874a140
> kernel config:  https://syzkaller.appspot.com/x/.config?x=dfb440e26f0a6f6f
> dashboard link: https://syzkaller.appspot.com/bug?extid=e81ccd4744c6c4f71354
> compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
> syz repro:  https://syzkaller.appspot.com/x/repro.syz?x=15bddd2a40
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1293d3fa40

Fixed with this patch:

http://patchwork.ozlabs.org/patch/978083/


[PATCH 6/6] Staging: rts5208: xd.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the xd.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/xd.c | 232 ++-
 1 file changed, 92 insertions(+), 140 deletions(-)

diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index 261d868a3072..415fea2f9ff1 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -60,9 +60,8 @@ static int xd_set_init_para(struct rtsx_chip *chip)
xd_card->xd_clock = CLK_50;
 
retval = switch_clock(chip, xd_card->xd_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -73,14 +72,12 @@ static int xd_switch_clock(struct rtsx_chip *chip)
int retval;
 
retval = select_card(chip, XD_CARD);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = switch_clock(chip, xd_card->xd_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -102,9 +99,8 @@ static int xd_read_id(struct rtsx_chip *chip, u8 id_cmd, u8 
*id_buf, u8 buf_len)
rtsx_add_cmd(chip, READ_REG_CMD, (u16)(XD_ADDRESS1 + i), 0, 0);
 
retval = rtsx_send_cmd(chip, XD_CARD, 20);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_FAIL;
-   }
 
ptr = rtsx_get_cmd_data(chip) + 1;
if (id_buf && buf_len) {
@@ -173,9 +169,8 @@ static int xd_read_redundant(struct rtsx_chip *chip, u32 
page_addr,
rtsx_add_cmd(chip, READ_REG_CMD, XD_PARITY, 0, 0);
 
retval = rtsx_send_cmd(chip, XD_CARD, 500);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_FAIL;
-   }
 
if (buf && buf_len) {
u8 *ptr = rtsx_get_cmd_data(chip) + 1;
@@ -193,9 +188,8 @@ static int xd_read_data_from_ppb(struct rtsx_chip *chip, 
int offset,
 {
int retval, i;
 
-   if (!buf || (buf_len < 0)) {
+   if (!buf || (buf_len < 0))
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -220,9 +214,8 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 
page_addr, u8 *buf,
int retval;
u8 reg;
 
-   if (!buf || (buf_len < 10)) {
+   if (!buf || (buf_len < 10))
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -246,36 +239,35 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 
page_addr, u8 *buf,
}
 
retval = rtsx_read_register(chip, XD_PAGE_STATUS, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (reg != XD_GPG) {
rtsx_clear_xd_error(chip);
return STATUS_FAIL;
}
 
retval = rtsx_read_register(chip, XD_CTL, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (!(reg & XD_ECC1_ERROR) || !(reg & XD_ECC1_UNCORRECTABLE)) {
retval = xd_read_data_from_ppb(chip, 0, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
if (reg & XD_ECC1_ERROR) {
u8 ecc_bit, ecc_byte;
 
retval = rtsx_read_register(chip, XD_ECC_BIT1,
_bit);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_read_register(chip, XD_ECC_BYTE1,
_byte);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
dev_dbg(rtsx_dev(chip), "ECC_BIT1 = 0x%x, ECC_BYTE1 = 
0x%x\n",
ecc_bit, ecc_byte);
@@ -291,22 +283,21 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 
page_addr, u8 *buf,
rtsx_clear_xd_error(chip);
 
retval = xd_read_data_from_ppb(chip, 256, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
if (reg & XD_ECC2_ERROR) {
u8 ecc_bit, ecc_byte;
 
retval = rtsx_read_register(chip, XD_ECC_BIT2,
_bit);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_read_register(chip, XD_ECC_BYTE2,
 

[PATCH 6/6] Staging: rts5208: xd.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the xd.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/xd.c | 232 ++-
 1 file changed, 92 insertions(+), 140 deletions(-)

diff --git a/drivers/staging/rts5208/xd.c b/drivers/staging/rts5208/xd.c
index 261d868a3072..415fea2f9ff1 100644
--- a/drivers/staging/rts5208/xd.c
+++ b/drivers/staging/rts5208/xd.c
@@ -60,9 +60,8 @@ static int xd_set_init_para(struct rtsx_chip *chip)
xd_card->xd_clock = CLK_50;
 
retval = switch_clock(chip, xd_card->xd_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -73,14 +72,12 @@ static int xd_switch_clock(struct rtsx_chip *chip)
int retval;
 
retval = select_card(chip, XD_CARD);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = switch_clock(chip, xd_card->xd_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -102,9 +99,8 @@ static int xd_read_id(struct rtsx_chip *chip, u8 id_cmd, u8 
*id_buf, u8 buf_len)
rtsx_add_cmd(chip, READ_REG_CMD, (u16)(XD_ADDRESS1 + i), 0, 0);
 
retval = rtsx_send_cmd(chip, XD_CARD, 20);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_FAIL;
-   }
 
ptr = rtsx_get_cmd_data(chip) + 1;
if (id_buf && buf_len) {
@@ -173,9 +169,8 @@ static int xd_read_redundant(struct rtsx_chip *chip, u32 
page_addr,
rtsx_add_cmd(chip, READ_REG_CMD, XD_PARITY, 0, 0);
 
retval = rtsx_send_cmd(chip, XD_CARD, 500);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_FAIL;
-   }
 
if (buf && buf_len) {
u8 *ptr = rtsx_get_cmd_data(chip) + 1;
@@ -193,9 +188,8 @@ static int xd_read_data_from_ppb(struct rtsx_chip *chip, 
int offset,
 {
int retval, i;
 
-   if (!buf || (buf_len < 0)) {
+   if (!buf || (buf_len < 0))
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -220,9 +214,8 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 
page_addr, u8 *buf,
int retval;
u8 reg;
 
-   if (!buf || (buf_len < 10)) {
+   if (!buf || (buf_len < 10))
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -246,36 +239,35 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 
page_addr, u8 *buf,
}
 
retval = rtsx_read_register(chip, XD_PAGE_STATUS, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (reg != XD_GPG) {
rtsx_clear_xd_error(chip);
return STATUS_FAIL;
}
 
retval = rtsx_read_register(chip, XD_CTL, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (!(reg & XD_ECC1_ERROR) || !(reg & XD_ECC1_UNCORRECTABLE)) {
retval = xd_read_data_from_ppb(chip, 0, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
if (reg & XD_ECC1_ERROR) {
u8 ecc_bit, ecc_byte;
 
retval = rtsx_read_register(chip, XD_ECC_BIT1,
_bit);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_read_register(chip, XD_ECC_BYTE1,
_byte);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
dev_dbg(rtsx_dev(chip), "ECC_BIT1 = 0x%x, ECC_BYTE1 = 
0x%x\n",
ecc_bit, ecc_byte);
@@ -291,22 +283,21 @@ static int xd_read_cis(struct rtsx_chip *chip, u32 
page_addr, u8 *buf,
rtsx_clear_xd_error(chip);
 
retval = xd_read_data_from_ppb(chip, 256, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
if (reg & XD_ECC2_ERROR) {
u8 ecc_bit, ecc_byte;
 
retval = rtsx_read_register(chip, XD_ECC_BIT2,
_bit);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_read_register(chip, XD_ECC_BYTE2,
 

[PATCH 5/6] Staging: rts5208: spi.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the spi.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/spi.c | 153 +-
 1 file changed, 59 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c
index 4675668ad977..420264bc03e5 100644
--- a/drivers/staging/rts5208/spi.c
+++ b/drivers/staging/rts5208/spi.c
@@ -41,14 +41,13 @@ static int spi_init(struct rtsx_chip *chip)
retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF,
 CS_POLARITY_LOW | DTO_MSB_FIRST
 | SPI_MASTER | SPI_MODE0 | SPI_AUTO);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_TCTL, EDO_TIMING_MASK,
 SAMPLE_DELAY_HALF);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -60,42 +59,37 @@ static int spi_set_init_para(struct rtsx_chip *chip)
 
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER1, 0xFF,
 (u8)(spi->clk_div >> 8));
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER0, 0xFF,
 (u8)(spi->clk_div));
-   if (retval) {
+   if (retval)
return retval;
-   }
 
retval = switch_clock(chip, spi->spi_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = select_card(chip, SPI_CARD);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = rtsx_write_register(chip, CARD_CLK_EN, SPI_CLK_EN,
 SPI_CLK_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, CARD_OE, SPI_OUTPUT_EN,
 SPI_OUTPUT_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
wait_timeout(10);
 
retval = spi_init(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -247,47 +241,45 @@ static int spi_init_eeprom(struct rtsx_chip *chip)
clk = CLK_30;
 
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER1, 0xFF, 0x00);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER0, 0xFF, 0x27);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
retval = switch_clock(chip, clk);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
 
retval = select_card(chip, SPI_CARD);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
 
retval = rtsx_write_register(chip, CARD_CLK_EN, SPI_CLK_EN,
 SPI_CLK_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, CARD_OE, SPI_OUTPUT_EN,
 SPI_OUTPUT_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
 
wait_timeout(10);
 
retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF,
 CS_POLARITY_HIGH | SPI_EEPROM_AUTO);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_TCTL, EDO_TIMING_MASK,
 SAMPLE_DELAY_HALF);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -306,9 +298,8 @@ static int spi_eeprom_program_enable(struct rtsx_chip *chip)
 SPI_TRANSFER0_END);
 
retval = rtsx_send_cmd(chip, 0, 100);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -318,14 +309,12 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip)
int retval;
 
retval = spi_init_eeprom(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = spi_eeprom_program_enable(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -339,14 +328,12 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip)
  

[PATCH 5/6] Staging: rts5208: spi.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the spi.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/spi.c | 153 +-
 1 file changed, 59 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/rts5208/spi.c b/drivers/staging/rts5208/spi.c
index 4675668ad977..420264bc03e5 100644
--- a/drivers/staging/rts5208/spi.c
+++ b/drivers/staging/rts5208/spi.c
@@ -41,14 +41,13 @@ static int spi_init(struct rtsx_chip *chip)
retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF,
 CS_POLARITY_LOW | DTO_MSB_FIRST
 | SPI_MASTER | SPI_MODE0 | SPI_AUTO);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_TCTL, EDO_TIMING_MASK,
 SAMPLE_DELAY_HALF);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -60,42 +59,37 @@ static int spi_set_init_para(struct rtsx_chip *chip)
 
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER1, 0xFF,
 (u8)(spi->clk_div >> 8));
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER0, 0xFF,
 (u8)(spi->clk_div));
-   if (retval) {
+   if (retval)
return retval;
-   }
 
retval = switch_clock(chip, spi->spi_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = select_card(chip, SPI_CARD);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = rtsx_write_register(chip, CARD_CLK_EN, SPI_CLK_EN,
 SPI_CLK_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, CARD_OE, SPI_OUTPUT_EN,
 SPI_OUTPUT_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
wait_timeout(10);
 
retval = spi_init(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -247,47 +241,45 @@ static int spi_init_eeprom(struct rtsx_chip *chip)
clk = CLK_30;
 
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER1, 0xFF, 0x00);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_CLK_DIVIDER0, 0xFF, 0x27);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
retval = switch_clock(chip, clk);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
 
retval = select_card(chip, SPI_CARD);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
+
 
retval = rtsx_write_register(chip, CARD_CLK_EN, SPI_CLK_EN,
 SPI_CLK_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, CARD_OE, SPI_OUTPUT_EN,
 SPI_OUTPUT_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
 
wait_timeout(10);
 
retval = rtsx_write_register(chip, SPI_CONTROL, 0xFF,
 CS_POLARITY_HIGH | SPI_EEPROM_AUTO);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SPI_TCTL, EDO_TIMING_MASK,
 SAMPLE_DELAY_HALF);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -306,9 +298,8 @@ static int spi_eeprom_program_enable(struct rtsx_chip *chip)
 SPI_TRANSFER0_END);
 
retval = rtsx_send_cmd(chip, 0, 100);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -318,14 +309,12 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip)
int retval;
 
retval = spi_init_eeprom(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
retval = spi_eeprom_program_enable(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -339,14 +328,12 @@ int spi_erase_eeprom_chip(struct rtsx_chip *chip)
  

[PATCH 3/6] Staging: rts5208: rtsx_scsi.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the rtsx_scsi.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/rtsx_scsi.c | 108 ++--
 1 file changed, 36 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_scsi.c 
b/drivers/staging/rts5208/rtsx_scsi.c
index c9a6d97938f6..9c594a778425 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -507,9 +507,8 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip 
*chip)
}
 
buf = vmalloc(scsi_bufflen(srb));
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
 #ifdef SUPPORT_MAGIC_GATE
if ((chip->mspro_formatter_enable) &&
@@ -637,9 +636,8 @@ static int request_sense(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
}
 
buf = vmalloc(scsi_bufflen(srb));
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
tmp = (unsigned char *)sense;
memcpy(buf, tmp, scsi_bufflen(srb));
@@ -783,9 +781,8 @@ static int mode_sense(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
 #endif
 
buf = kmalloc(data_size, GFP_KERNEL);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
page_code = srb->cmnd[2] & 0x3f;
 
@@ -999,9 +996,8 @@ static int read_format_capacity(struct scsi_cmnd *srb, 
struct rtsx_chip *chip)
buf_len = (scsi_bufflen(srb) > 12) ? 0x14 : 12;
 
buf = kmalloc(buf_len, GFP_KERNEL);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
buf[i++] = 0;
buf[i++] = 0;
@@ -1076,9 +1072,8 @@ static int read_capacity(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
}
 
buf = kmalloc(8, GFP_KERNEL);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
card_size = get_card_size(chip, lun);
buf[0] = (unsigned char)((card_size - 1) >> 24);
@@ -1116,9 +,8 @@ static int read_eeprom(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
len = ((u16)srb->cmnd[4] << 8) | srb->cmnd[5];
 
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
retval = rtsx_force_power_on(chip, SSC_PDCTL);
if (retval != STATUS_SUCCESS) {
@@ -1180,9 +1174,8 @@ static int write_eeprom(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb),
len);
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
rtsx_stor_get_xfer_buf(buf, len, srb);
scsi_set_resid(srb, scsi_bufflen(srb) - len);
@@ -1227,9 +1220,8 @@ static int read_mem(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
}
 
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
retval = rtsx_force_power_on(chip, SSC_PDCTL);
if (retval != STATUS_SUCCESS) {
@@ -1282,9 +1274,8 @@ static int write_mem(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
 
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len);
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
rtsx_stor_get_xfer_buf(buf, len, srb);
scsi_set_resid(srb, scsi_bufflen(srb) - len);
@@ -1702,41 +1693,35 @@ static int set_chip_mode(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
if (phy_debug_mode) {
chip->phy_debug_mode = 1;
retval = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
 
rtsx_disable_bus_int(chip);
 
retval = rtsx_read_phy_register(chip, 0x1C, );
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
 
reg |= 0x0001;
retval = rtsx_write_phy_register(chip, 0x1C, reg);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
} else {
chip->phy_debug_mode = 0;
retval = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0x77);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
 
rtsx_enable_bus_int(chip);
 
retval = rtsx_read_phy_register(chip, 0x1C, );
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
 

[PATCH 3/6] Staging: rts5208: rtsx_scsi.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the rtsx_scsi.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/rtsx_scsi.c | 108 ++--
 1 file changed, 36 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_scsi.c 
b/drivers/staging/rts5208/rtsx_scsi.c
index c9a6d97938f6..9c594a778425 100644
--- a/drivers/staging/rts5208/rtsx_scsi.c
+++ b/drivers/staging/rts5208/rtsx_scsi.c
@@ -507,9 +507,8 @@ static int inquiry(struct scsi_cmnd *srb, struct rtsx_chip 
*chip)
}
 
buf = vmalloc(scsi_bufflen(srb));
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
 #ifdef SUPPORT_MAGIC_GATE
if ((chip->mspro_formatter_enable) &&
@@ -637,9 +636,8 @@ static int request_sense(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
}
 
buf = vmalloc(scsi_bufflen(srb));
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
tmp = (unsigned char *)sense;
memcpy(buf, tmp, scsi_bufflen(srb));
@@ -783,9 +781,8 @@ static int mode_sense(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
 #endif
 
buf = kmalloc(data_size, GFP_KERNEL);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
page_code = srb->cmnd[2] & 0x3f;
 
@@ -999,9 +996,8 @@ static int read_format_capacity(struct scsi_cmnd *srb, 
struct rtsx_chip *chip)
buf_len = (scsi_bufflen(srb) > 12) ? 0x14 : 12;
 
buf = kmalloc(buf_len, GFP_KERNEL);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
buf[i++] = 0;
buf[i++] = 0;
@@ -1076,9 +1072,8 @@ static int read_capacity(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
}
 
buf = kmalloc(8, GFP_KERNEL);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
card_size = get_card_size(chip, lun);
buf[0] = (unsigned char)((card_size - 1) >> 24);
@@ -1116,9 +,8 @@ static int read_eeprom(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
len = ((u16)srb->cmnd[4] << 8) | srb->cmnd[5];
 
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
retval = rtsx_force_power_on(chip, SSC_PDCTL);
if (retval != STATUS_SUCCESS) {
@@ -1180,9 +1174,8 @@ static int write_eeprom(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb),
len);
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
rtsx_stor_get_xfer_buf(buf, len, srb);
scsi_set_resid(srb, scsi_bufflen(srb) - len);
@@ -1227,9 +1220,8 @@ static int read_mem(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
}
 
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
retval = rtsx_force_power_on(chip, SSC_PDCTL);
if (retval != STATUS_SUCCESS) {
@@ -1282,9 +1274,8 @@ static int write_mem(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
 
len = (unsigned short)min_t(unsigned int, scsi_bufflen(srb), len);
buf = vmalloc(len);
-   if (!buf) {
+   if (!buf)
return TRANSPORT_ERROR;
-   }
 
rtsx_stor_get_xfer_buf(buf, len, srb);
scsi_set_resid(srb, scsi_bufflen(srb) - len);
@@ -1702,41 +1693,35 @@ static int set_chip_mode(struct scsi_cmnd *srb, struct 
rtsx_chip *chip)
if (phy_debug_mode) {
chip->phy_debug_mode = 1;
retval = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
 
rtsx_disable_bus_int(chip);
 
retval = rtsx_read_phy_register(chip, 0x1C, );
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
 
reg |= 0x0001;
retval = rtsx_write_phy_register(chip, 0x1C, reg);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
} else {
chip->phy_debug_mode = 0;
retval = rtsx_write_register(chip, CDRESUMECTL, 0x77, 0x77);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return TRANSPORT_FAILED;
-   }
 
rtsx_enable_bus_int(chip);
 
retval = rtsx_read_phy_register(chip, 0x1C, );
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
 

[PATCH 4/6] Staging: rts5208: sd.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the sd.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/sd.c | 704 +--
 1 file changed, 268 insertions(+), 436 deletions(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index e7efa34195c7..930c61ccb047 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -109,9 +109,8 @@ static int sd_check_data0_status(struct rtsx_chip *chip)
u8 stat;
 
retval = rtsx_read_register(chip, REG_SD_STAT1, );
-   if (retval) {
+   if (retval)
return retval;
-   }
 
if (!(stat & SD_DAT0_STATUS)) {
sd_set_err_code(chip, SD_BUSY);
@@ -234,9 +233,8 @@ static int sd_send_cmd_get_rsp(struct rtsx_chip *chip, u8 
cmd_idx,
if ((cmd_idx != SEND_RELATIVE_ADDR) &&
(cmd_idx != SEND_IF_COND)) {
if (cmd_idx != STOP_TRANSMISSION) {
-   if (ptr[1] & 0x80) {
+   if (ptr[1] & 0x80)
return STATUS_FAIL;
-   }
}
 #ifdef SUPPORT_SD_LOCK
if (ptr[1] & 0x7D) {
@@ -284,9 +282,8 @@ static int sd_read_data(struct rtsx_chip *chip,
if (!buf)
buf_len = 0;
 
-   if (buf_len > 512) {
+   if (buf_len > 512)
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -331,9 +328,8 @@ static int sd_read_data(struct rtsx_chip *chip,
 
if (buf && buf_len) {
retval = rtsx_read_ppbuf(chip, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
}
 
return STATUS_SUCCESS;
@@ -359,9 +355,8 @@ static int sd_write_data(struct rtsx_chip *chip, u8 
trans_mode,
 
if (buf && buf_len) {
retval = rtsx_write_ppbuf(chip, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
}
 
rtsx_init_cmd(chip);
@@ -426,9 +421,8 @@ static int sd_check_csd(struct rtsx_chip *chip, char 
check_wp)
break;
}
 
-   if (i == 6) {
+   if (i == 6)
return STATUS_FAIL;
-   }
 
memcpy(sd_card->raw_csd, rsp + 1, 15);
 
@@ -543,9 +537,8 @@ static int sd_set_sample_push_timing(struct rtsx_chip *chip)
}
 
retval = rtsx_write_register(chip, REG_SD_CFG1, 0x1C, val);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -606,9 +599,8 @@ static int sd_set_clock_divider(struct rtsx_chip *chip, u8 
clk_div)
val = 0x20;
 
retval = rtsx_write_register(chip, REG_SD_CFG1, mask, val);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -619,16 +611,14 @@ static int sd_set_init_para(struct rtsx_chip *chip)
int retval;
 
retval = sd_set_sample_push_timing(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
sd_choose_proper_clock(chip);
 
retval = switch_clock(chip, sd_card->sd_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -651,9 +641,8 @@ int sd_select_card(struct rtsx_chip *chip, int select)
}
 
retval = sd_send_cmd_get_rsp(chip, cmd_idx, addr, cmd_type, NULL, 0);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -667,9 +656,8 @@ static int sd_update_lock_status(struct rtsx_chip *chip)
 
retval = sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr,
 SD_RSP_TYPE_R1, rsp, 5);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
if (rsp[1] & 0x02)
sd_card->sd_lock_status |= SD_LOCKED;
@@ -679,9 +667,8 @@ static int sd_update_lock_status(struct rtsx_chip *chip)
dev_dbg(rtsx_dev(chip), "sd_card->sd_lock_status = 0x%x\n",
sd_card->sd_lock_status);
 
-   if (rsp[1] & 0x01) {
+   if (rsp[1] & 0x01)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -698,9 +685,8 @@ static int sd_wait_state_data_ready(struct rtsx_chip *chip, 
u8 state,
retval = sd_send_cmd_get_rsp(chip, SEND_STATUS,
 sd_card->sd_addr, SD_RSP_TYPE_R1,
 rsp, 5);
- 

[PATCH 2/6] Staging: rts5208: rtsx_chip.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the rtsx_chip.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/rtsx_chip.c | 463 
 1 file changed, 199 insertions(+), 264 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c 
b/drivers/staging/rts5208/rtsx_chip.c
index 6b1234bff09c..6bec2ddc75f2 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -116,34 +116,31 @@ static int rtsx_pre_handle_sdio_old(struct rtsx_chip 
*chip)
 0xFF,
 MS_INS_PU | SD_WP_PU |
 SD_CD_PU | SD_CMD_PU);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
} else {
retval = rtsx_write_register(chip, FPGA_PULL_CTL,
 0xFF,
 FPGA_SD_PULL_CTL_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
}
retval = rtsx_write_register(chip, CARD_SHARE_MODE, 0xFF,
 CARD_SHARE_48_SD);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
/* Enable SDIO internal clock */
retval = rtsx_write_register(chip, 0xFF2C, 0x01, 0x01);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
retval = rtsx_write_register(chip, SDIO_CTRL, 0xFF,
 SDIO_BUS_CTRL | SDIO_CD_CTRL);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->sd_int = 1;
chip->sd_io = 1;
@@ -164,16 +161,16 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip 
*chip)
if (chip->driver_first_load) {
if (CHECK_PID(chip, 0x5288)) {
retval = rtsx_read_register(chip, 0xFE5A, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (tmp & 0x08)
sw_bypass_sd = true;
} else if (CHECK_PID(chip, 0x5208)) {
retval = rtsx_read_register(chip, 0xFE70, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (tmp & 0x80)
sw_bypass_sd = true;
}
@@ -192,9 +189,9 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip)
u8 cd_toggle_mask = 0;
 
retval = rtsx_read_register(chip, TLPTISTAT, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
cd_toggle_mask = 0x08;
 
if (tmp & cd_toggle_mask) {
@@ -202,22 +199,20 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip 
*chip)
if (CHECK_PID(chip, 0x5288)) {
retval = rtsx_write_register(chip, 0xFE5A,
 0x08, 0x00);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
} else if (CHECK_PID(chip, 0x5208)) {
retval = rtsx_write_register(chip, 0xFE70,
 0x80, 0x00);
-   if (retval) {
+   if (retval)
return retval;
-   }
}
 
retval = rtsx_write_register(chip, TLPTISTAT, 0xFF,
 tmp);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->need_reset |= SD_CARD;
} else {
@@ -225,36 +220,35 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip 
*chip)
 
if (chip->asic_code) {
retval = sd_pull_ctl_enable(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   

[PATCH 4/6] Staging: rts5208: sd.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the sd.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/sd.c | 704 +--
 1 file changed, 268 insertions(+), 436 deletions(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index e7efa34195c7..930c61ccb047 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -109,9 +109,8 @@ static int sd_check_data0_status(struct rtsx_chip *chip)
u8 stat;
 
retval = rtsx_read_register(chip, REG_SD_STAT1, );
-   if (retval) {
+   if (retval)
return retval;
-   }
 
if (!(stat & SD_DAT0_STATUS)) {
sd_set_err_code(chip, SD_BUSY);
@@ -234,9 +233,8 @@ static int sd_send_cmd_get_rsp(struct rtsx_chip *chip, u8 
cmd_idx,
if ((cmd_idx != SEND_RELATIVE_ADDR) &&
(cmd_idx != SEND_IF_COND)) {
if (cmd_idx != STOP_TRANSMISSION) {
-   if (ptr[1] & 0x80) {
+   if (ptr[1] & 0x80)
return STATUS_FAIL;
-   }
}
 #ifdef SUPPORT_SD_LOCK
if (ptr[1] & 0x7D) {
@@ -284,9 +282,8 @@ static int sd_read_data(struct rtsx_chip *chip,
if (!buf)
buf_len = 0;
 
-   if (buf_len > 512) {
+   if (buf_len > 512)
return STATUS_FAIL;
-   }
 
rtsx_init_cmd(chip);
 
@@ -331,9 +328,8 @@ static int sd_read_data(struct rtsx_chip *chip,
 
if (buf && buf_len) {
retval = rtsx_read_ppbuf(chip, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
}
 
return STATUS_SUCCESS;
@@ -359,9 +355,8 @@ static int sd_write_data(struct rtsx_chip *chip, u8 
trans_mode,
 
if (buf && buf_len) {
retval = rtsx_write_ppbuf(chip, buf, buf_len);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
}
 
rtsx_init_cmd(chip);
@@ -426,9 +421,8 @@ static int sd_check_csd(struct rtsx_chip *chip, char 
check_wp)
break;
}
 
-   if (i == 6) {
+   if (i == 6)
return STATUS_FAIL;
-   }
 
memcpy(sd_card->raw_csd, rsp + 1, 15);
 
@@ -543,9 +537,8 @@ static int sd_set_sample_push_timing(struct rtsx_chip *chip)
}
 
retval = rtsx_write_register(chip, REG_SD_CFG1, 0x1C, val);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -606,9 +599,8 @@ static int sd_set_clock_divider(struct rtsx_chip *chip, u8 
clk_div)
val = 0x20;
 
retval = rtsx_write_register(chip, REG_SD_CFG1, mask, val);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -619,16 +611,14 @@ static int sd_set_init_para(struct rtsx_chip *chip)
int retval;
 
retval = sd_set_sample_push_timing(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
sd_choose_proper_clock(chip);
 
retval = switch_clock(chip, sd_card->sd_clock);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -651,9 +641,8 @@ int sd_select_card(struct rtsx_chip *chip, int select)
}
 
retval = sd_send_cmd_get_rsp(chip, cmd_idx, addr, cmd_type, NULL, 0);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -667,9 +656,8 @@ static int sd_update_lock_status(struct rtsx_chip *chip)
 
retval = sd_send_cmd_get_rsp(chip, SEND_STATUS, sd_card->sd_addr,
 SD_RSP_TYPE_R1, rsp, 5);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
if (rsp[1] & 0x02)
sd_card->sd_lock_status |= SD_LOCKED;
@@ -679,9 +667,8 @@ static int sd_update_lock_status(struct rtsx_chip *chip)
dev_dbg(rtsx_dev(chip), "sd_card->sd_lock_status = 0x%x\n",
sd_card->sd_lock_status);
 
-   if (rsp[1] & 0x01) {
+   if (rsp[1] & 0x01)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -698,9 +685,8 @@ static int sd_wait_state_data_ready(struct rtsx_chip *chip, 
u8 state,
retval = sd_send_cmd_get_rsp(chip, SEND_STATUS,
 sd_card->sd_addr, SD_RSP_TYPE_R1,
 rsp, 5);
- 

[PATCH 2/6] Staging: rts5208: rtsx_chip.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the rtsx_chip.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/rtsx_chip.c | 463 
 1 file changed, 199 insertions(+), 264 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_chip.c 
b/drivers/staging/rts5208/rtsx_chip.c
index 6b1234bff09c..6bec2ddc75f2 100644
--- a/drivers/staging/rts5208/rtsx_chip.c
+++ b/drivers/staging/rts5208/rtsx_chip.c
@@ -116,34 +116,31 @@ static int rtsx_pre_handle_sdio_old(struct rtsx_chip 
*chip)
 0xFF,
 MS_INS_PU | SD_WP_PU |
 SD_CD_PU | SD_CMD_PU);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
} else {
retval = rtsx_write_register(chip, FPGA_PULL_CTL,
 0xFF,
 FPGA_SD_PULL_CTL_EN);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
}
retval = rtsx_write_register(chip, CARD_SHARE_MODE, 0xFF,
 CARD_SHARE_48_SD);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
/* Enable SDIO internal clock */
retval = rtsx_write_register(chip, 0xFF2C, 0x01, 0x01);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
retval = rtsx_write_register(chip, SDIO_CTRL, 0xFF,
 SDIO_BUS_CTRL | SDIO_CD_CTRL);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->sd_int = 1;
chip->sd_io = 1;
@@ -164,16 +161,16 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip 
*chip)
if (chip->driver_first_load) {
if (CHECK_PID(chip, 0x5288)) {
retval = rtsx_read_register(chip, 0xFE5A, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (tmp & 0x08)
sw_bypass_sd = true;
} else if (CHECK_PID(chip, 0x5208)) {
retval = rtsx_read_register(chip, 0xFE70, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
if (tmp & 0x80)
sw_bypass_sd = true;
}
@@ -192,9 +189,9 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip *chip)
u8 cd_toggle_mask = 0;
 
retval = rtsx_read_register(chip, TLPTISTAT, );
-   if (retval) {
+   if (retval)
return retval;
-   }
+
cd_toggle_mask = 0x08;
 
if (tmp & cd_toggle_mask) {
@@ -202,22 +199,20 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip 
*chip)
if (CHECK_PID(chip, 0x5288)) {
retval = rtsx_write_register(chip, 0xFE5A,
 0x08, 0x00);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
} else if (CHECK_PID(chip, 0x5208)) {
retval = rtsx_write_register(chip, 0xFE70,
 0x80, 0x00);
-   if (retval) {
+   if (retval)
return retval;
-   }
}
 
retval = rtsx_write_register(chip, TLPTISTAT, 0xFF,
 tmp);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->need_reset |= SD_CARD;
} else {
@@ -225,36 +220,35 @@ static int rtsx_pre_handle_sdio_new(struct rtsx_chip 
*chip)
 
if (chip->asic_code) {
retval = sd_pull_ctl_enable(chip);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   

[PATCH 1/6] Staging: rts5208: rtsx_card.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the rtsx_card.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/rtsx_card.c | 96 +++--
 1 file changed, 37 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_card.c 
b/drivers/staging/rts5208/rtsx_card.c
index d26a8e372fce..b45abbe29bc2 100644
--- a/drivers/staging/rts5208/rtsx_card.c
+++ b/drivers/staging/rts5208/rtsx_card.c
@@ -647,9 +647,8 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
dev_dbg(rtsx_dev(chip), "Switch SSC clock to %dMHz (cur_clk = %d)\n",
clk, chip->cur_clk);
 
-   if ((clk <= 2) || (n > max_n)) {
+   if ((clk <= 2) || (n > max_n))
return STATUS_FAIL;
-   }
 
mcu_cnt = (u8)(125 / clk + 3);
if (mcu_cnt > 7)
@@ -688,15 +687,13 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
}
 
retval = rtsx_send_cmd(chip, 0, WAIT_TIME);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_ERROR;
-   }
 
udelay(10);
retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->cur_clk = clk;
 
@@ -790,49 +787,44 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
}
 
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ);
-   if (retval) {
+   if (retval)
return retval;
-   }
if (sd_vpclk_phase_reset) {
retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
 PHASE_NOT_RESET, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
 PHASE_NOT_RESET, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
}
retval = rtsx_write_register(chip, CLK_DIV, 0xFF,
 (div << 4) | mcu_cnt);
-   if (retval) {
+   if (retval)
return retval;
-   }
retval = rtsx_write_register(chip, CLK_SEL, 0xFF, sel);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
if (sd_vpclk_phase_reset) {
udelay(200);
retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
 PHASE_NOT_RESET, PHASE_NOT_RESET);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
 PHASE_NOT_RESET, PHASE_NOT_RESET);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
udelay(200);
}
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->cur_clk = clk;
 
@@ -878,9 +870,8 @@ int enable_card_clock(struct rtsx_chip *chip, u8 card)
clk_en |= MS_CLK_EN;
 
retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, clk_en);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -898,9 +889,8 @@ int disable_card_clock(struct rtsx_chip *chip, u8 card)
clk_en |= MS_CLK_EN;
 
retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -924,9 +914,8 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val1);
 
retval = rtsx_send_cmd(chip, 0, 100);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
udelay(chip->pmos_pwr_on_interval);
 
@@ -934,9 +923,8 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val2);
 
retval = rtsx_send_cmd(chip, 0, 100);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -955,9 +943,8 @@ int card_power_off(struct rtsx_chip *chip, u8 card)
}
 
retval = rtsx_write_register(chip, CARD_PWR_CTL, mask, val);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -969,9 +956,8 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
unsigned int lun = SCSI_LUN(srb);
int i;
 
-   if (!chip->rw_card[lun]) {
+   if (!chip->rw_card[lun])

[PATCH 1/6] Staging: rts5208: rtsx_card.c: Fixed all braces issues of the file

2018-10-02 Thread Maxime Desroches
Fixed all the braces issues of the rtsx_card.c file

Signed-off-by: Maxime Desroches 
---
 drivers/staging/rts5208/rtsx_card.c | 96 +++--
 1 file changed, 37 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx_card.c 
b/drivers/staging/rts5208/rtsx_card.c
index d26a8e372fce..b45abbe29bc2 100644
--- a/drivers/staging/rts5208/rtsx_card.c
+++ b/drivers/staging/rts5208/rtsx_card.c
@@ -647,9 +647,8 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
dev_dbg(rtsx_dev(chip), "Switch SSC clock to %dMHz (cur_clk = %d)\n",
clk, chip->cur_clk);
 
-   if ((clk <= 2) || (n > max_n)) {
+   if ((clk <= 2) || (n > max_n))
return STATUS_FAIL;
-   }
 
mcu_cnt = (u8)(125 / clk + 3);
if (mcu_cnt > 7)
@@ -688,15 +687,13 @@ int switch_ssc_clock(struct rtsx_chip *chip, int clk)
}
 
retval = rtsx_send_cmd(chip, 0, WAIT_TIME);
-   if (retval < 0) {
+   if (retval < 0)
return STATUS_ERROR;
-   }
 
udelay(10);
retval = rtsx_write_register(chip, CLK_CTL, CLK_LOW_FREQ, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->cur_clk = clk;
 
@@ -790,49 +787,44 @@ int switch_normal_clock(struct rtsx_chip *chip, int clk)
}
 
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, CLK_LOW_FREQ);
-   if (retval) {
+   if (retval)
return retval;
-   }
if (sd_vpclk_phase_reset) {
retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
 PHASE_NOT_RESET, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
 PHASE_NOT_RESET, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
}
retval = rtsx_write_register(chip, CLK_DIV, 0xFF,
 (div << 4) | mcu_cnt);
-   if (retval) {
+   if (retval)
return retval;
-   }
retval = rtsx_write_register(chip, CLK_SEL, 0xFF, sel);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
if (sd_vpclk_phase_reset) {
udelay(200);
retval = rtsx_write_register(chip, SD_VPCLK0_CTL,
 PHASE_NOT_RESET, PHASE_NOT_RESET);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
retval = rtsx_write_register(chip, SD_VPCLK1_CTL,
 PHASE_NOT_RESET, PHASE_NOT_RESET);
-   if (retval) {
+   if (retval)
return retval;
-   }
+
udelay(200);
}
retval = rtsx_write_register(chip, CLK_CTL, 0xFF, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
chip->cur_clk = clk;
 
@@ -878,9 +870,8 @@ int enable_card_clock(struct rtsx_chip *chip, u8 card)
clk_en |= MS_CLK_EN;
 
retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, clk_en);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -898,9 +889,8 @@ int disable_card_clock(struct rtsx_chip *chip, u8 card)
clk_en |= MS_CLK_EN;
 
retval = rtsx_write_register(chip, CARD_CLK_EN, clk_en, 0);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -924,9 +914,8 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val1);
 
retval = rtsx_send_cmd(chip, 0, 100);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
udelay(chip->pmos_pwr_on_interval);
 
@@ -934,9 +923,8 @@ int card_power_on(struct rtsx_chip *chip, u8 card)
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_PWR_CTL, mask, val2);
 
retval = rtsx_send_cmd(chip, 0, 100);
-   if (retval != STATUS_SUCCESS) {
+   if (retval != STATUS_SUCCESS)
return STATUS_FAIL;
-   }
 
return STATUS_SUCCESS;
 }
@@ -955,9 +943,8 @@ int card_power_off(struct rtsx_chip *chip, u8 card)
}
 
retval = rtsx_write_register(chip, CARD_PWR_CTL, mask, val);
-   if (retval) {
+   if (retval)
return retval;
-   }
 
return STATUS_SUCCESS;
 }
@@ -969,9 +956,8 @@ int card_rw(struct scsi_cmnd *srb, struct rtsx_chip *chip,
unsigned int lun = SCSI_LUN(srb);
int i;
 
-   if (!chip->rw_card[lun]) {
+   if (!chip->rw_card[lun])

[PATCH v2 03/15] platform: goldfish: pipe: Move the file-scope goldfish_pipe_dev variable into the driver state

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is the last patch in the series of patches to move file-scope
variables into the driver state. This change will help to introduce
another version of the pipe driver (with different state) for the
older host interface or having several instances of this device.

Signed-off-by: Roman Kiryanov 
---
Changes in v2:
 - Updated the commit message.

 drivers/platform/goldfish/goldfish_pipe.c | 66 +--
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 8ca709b45e1f..4013832f38fb 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -169,6 +169,9 @@ struct goldfish_pipe {
  * waiting to be awoken.
  */
 struct goldfish_pipe_dev {
+   /* A magic number to check if this is an instance of this struct */
+   void *magic;
+
/*
 * Global device spinlock. Protects the following members:
 *  - pipes, pipes_capacity
@@ -215,8 +218,6 @@ struct goldfish_pipe_dev {
struct miscdevice miscdev;
 };
 
-static struct goldfish_pipe_dev goldfish_pipe_dev;
-
 static int goldfish_pipe_cmd_locked(struct goldfish_pipe *pipe,
enum PipeCmdCode cmd)
 {
@@ -611,6 +612,9 @@ static void goldfish_interrupt_task(unsigned long dev_addr)
}
 }
 
+static void goldfish_pipe_device_deinit(struct platform_device *pdev,
+   struct goldfish_pipe_dev *dev);
+
 /*
  * The general idea of the interrupt handling:
  *
@@ -631,7 +635,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void 
*dev_id)
unsigned long flags;
struct goldfish_pipe_dev *dev = dev_id;
 
-   if (dev != _pipe_dev)
+   if (dev->magic != _pipe_device_deinit)
return IRQ_NONE;
 
/* Request the signalled pipes from the device */
@@ -683,6 +687,14 @@ static int get_free_pipe_id_locked(struct 
goldfish_pipe_dev *dev)
return id;
 }
 
+/* A helper function to get the instance of goldfish_pipe_dev from file */
+static struct goldfish_pipe_dev *to_goldfish_pipe_dev(struct file *file)
+{
+   struct miscdevice *miscdev = file->private_data;
+
+   return container_of(miscdev, struct goldfish_pipe_dev, miscdev);
+}
+
 /**
  * goldfish_pipe_open - open a channel to the AVD
  * @inode: inode of device
@@ -696,7 +708,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev 
*dev)
  */
 static int goldfish_pipe_open(struct inode *inode, struct file *file)
 {
-   struct goldfish_pipe_dev *dev = _pipe_dev;
+   struct goldfish_pipe_dev *dev = to_goldfish_pipe_dev(file);
unsigned long flags;
int id;
int status;
@@ -804,9 +816,9 @@ static void write_pa_addr(void *addr, void __iomem *portl, 
void __iomem *porth)
writel(lower_32_bits(paddr), portl);
 }
 
-static int goldfish_pipe_device_init(struct platform_device *pdev)
+static int goldfish_pipe_device_init(struct platform_device *pdev,
+struct goldfish_pipe_dev *dev)
 {
-   struct goldfish_pipe_dev *dev = _pipe_dev;
int err;
 
tasklet_init(>irq_tasklet, _interrupt_task,
@@ -861,26 +873,29 @@ static int goldfish_pipe_device_init(struct 
platform_device *pdev)
  dev->base + PIPE_REG_OPEN_BUFFER,
  dev->base + PIPE_REG_OPEN_BUFFER_HIGH);
 
+   platform_set_drvdata(pdev, dev);
return 0;
 }
 
-static void goldfish_pipe_device_deinit(struct platform_device *pdev)
+static void goldfish_pipe_device_deinit(struct platform_device *pdev,
+   struct goldfish_pipe_dev *dev)
 {
-   misc_deregister(_pipe_dev.miscdev);
-   tasklet_kill(_pipe_dev.irq_tasklet);
-   kfree(goldfish_pipe_dev.pipes);
-   free_page((unsigned long)goldfish_pipe_dev.buffers);
+   misc_deregister(>miscdev);
+   tasklet_kill(>irq_tasklet);
+   kfree(dev->pipes);
+   free_page((unsigned long)dev->buffers);
 }
 
 static int goldfish_pipe_probe(struct platform_device *pdev)
 {
-   int err;
struct resource *r;
-   struct goldfish_pipe_dev *dev = _pipe_dev;
+   struct goldfish_pipe_dev *dev;
 
-   /* not thread safe, but this should not happen */
-   WARN_ON(dev->base);
+   dev = devm_kzalloc(>dev, sizeof(*dev), GFP_KERNEL);
+   if (!dev)
+   return -ENOMEM;
 
+   dev->magic = _pipe_device_deinit;
spin_lock_init(>lock);
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -895,10 +910,9 @@ static int goldfish_pipe_probe(struct platform_device 
*pdev)
}
 
r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!r) {
-   err = -EINVAL;
-   goto error;
-   }
+   if (!r)
+   return -EINVAL;
+
dev->irq = r->start;
 
/*
@@ -913,20 +927,14 @@ 

[PATCH v2 03/15] platform: goldfish: pipe: Move the file-scope goldfish_pipe_dev variable into the driver state

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is the last patch in the series of patches to move file-scope
variables into the driver state. This change will help to introduce
another version of the pipe driver (with different state) for the
older host interface or having several instances of this device.

Signed-off-by: Roman Kiryanov 
---
Changes in v2:
 - Updated the commit message.

 drivers/platform/goldfish/goldfish_pipe.c | 66 +--
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 8ca709b45e1f..4013832f38fb 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -169,6 +169,9 @@ struct goldfish_pipe {
  * waiting to be awoken.
  */
 struct goldfish_pipe_dev {
+   /* A magic number to check if this is an instance of this struct */
+   void *magic;
+
/*
 * Global device spinlock. Protects the following members:
 *  - pipes, pipes_capacity
@@ -215,8 +218,6 @@ struct goldfish_pipe_dev {
struct miscdevice miscdev;
 };
 
-static struct goldfish_pipe_dev goldfish_pipe_dev;
-
 static int goldfish_pipe_cmd_locked(struct goldfish_pipe *pipe,
enum PipeCmdCode cmd)
 {
@@ -611,6 +612,9 @@ static void goldfish_interrupt_task(unsigned long dev_addr)
}
 }
 
+static void goldfish_pipe_device_deinit(struct platform_device *pdev,
+   struct goldfish_pipe_dev *dev);
+
 /*
  * The general idea of the interrupt handling:
  *
@@ -631,7 +635,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void 
*dev_id)
unsigned long flags;
struct goldfish_pipe_dev *dev = dev_id;
 
-   if (dev != _pipe_dev)
+   if (dev->magic != _pipe_device_deinit)
return IRQ_NONE;
 
/* Request the signalled pipes from the device */
@@ -683,6 +687,14 @@ static int get_free_pipe_id_locked(struct 
goldfish_pipe_dev *dev)
return id;
 }
 
+/* A helper function to get the instance of goldfish_pipe_dev from file */
+static struct goldfish_pipe_dev *to_goldfish_pipe_dev(struct file *file)
+{
+   struct miscdevice *miscdev = file->private_data;
+
+   return container_of(miscdev, struct goldfish_pipe_dev, miscdev);
+}
+
 /**
  * goldfish_pipe_open - open a channel to the AVD
  * @inode: inode of device
@@ -696,7 +708,7 @@ static int get_free_pipe_id_locked(struct goldfish_pipe_dev 
*dev)
  */
 static int goldfish_pipe_open(struct inode *inode, struct file *file)
 {
-   struct goldfish_pipe_dev *dev = _pipe_dev;
+   struct goldfish_pipe_dev *dev = to_goldfish_pipe_dev(file);
unsigned long flags;
int id;
int status;
@@ -804,9 +816,9 @@ static void write_pa_addr(void *addr, void __iomem *portl, 
void __iomem *porth)
writel(lower_32_bits(paddr), portl);
 }
 
-static int goldfish_pipe_device_init(struct platform_device *pdev)
+static int goldfish_pipe_device_init(struct platform_device *pdev,
+struct goldfish_pipe_dev *dev)
 {
-   struct goldfish_pipe_dev *dev = _pipe_dev;
int err;
 
tasklet_init(>irq_tasklet, _interrupt_task,
@@ -861,26 +873,29 @@ static int goldfish_pipe_device_init(struct 
platform_device *pdev)
  dev->base + PIPE_REG_OPEN_BUFFER,
  dev->base + PIPE_REG_OPEN_BUFFER_HIGH);
 
+   platform_set_drvdata(pdev, dev);
return 0;
 }
 
-static void goldfish_pipe_device_deinit(struct platform_device *pdev)
+static void goldfish_pipe_device_deinit(struct platform_device *pdev,
+   struct goldfish_pipe_dev *dev)
 {
-   misc_deregister(_pipe_dev.miscdev);
-   tasklet_kill(_pipe_dev.irq_tasklet);
-   kfree(goldfish_pipe_dev.pipes);
-   free_page((unsigned long)goldfish_pipe_dev.buffers);
+   misc_deregister(>miscdev);
+   tasklet_kill(>irq_tasklet);
+   kfree(dev->pipes);
+   free_page((unsigned long)dev->buffers);
 }
 
 static int goldfish_pipe_probe(struct platform_device *pdev)
 {
-   int err;
struct resource *r;
-   struct goldfish_pipe_dev *dev = _pipe_dev;
+   struct goldfish_pipe_dev *dev;
 
-   /* not thread safe, but this should not happen */
-   WARN_ON(dev->base);
+   dev = devm_kzalloc(>dev, sizeof(*dev), GFP_KERNEL);
+   if (!dev)
+   return -ENOMEM;
 
+   dev->magic = _pipe_device_deinit;
spin_lock_init(>lock);
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -895,10 +910,9 @@ static int goldfish_pipe_probe(struct platform_device 
*pdev)
}
 
r = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!r) {
-   err = -EINVAL;
-   goto error;
-   }
+   if (!r)
+   return -EINVAL;
+
dev->irq = r->start;
 
/*
@@ -913,20 +927,14 @@ 

[PATCH v2 01/15] platform: goldfish: pipe: Move the file-scope goldfish_interrupt_tasklet variable into the driver state

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is a series of patches to move mutable file-scope variables
into the driver state. This change will help to introduce another
version of the pipe driver (with different state) for the older
host interface or having several instances of this device.

Signed-off-by: Roman Kiryanov 
---
Changes in v2:
 - Updated the commit message.

 drivers/platform/goldfish/goldfish_pipe.c | 24 +++
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 56665e879e5a..ba9aede17d57 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -208,6 +208,9 @@ struct goldfish_pipe_dev {
int irq;
int version;
unsigned char __iomem *base;
+
+   /* an irq tasklet to run goldfish_interrupt_task */
+   struct tasklet_struct irq_tasklet;
 };
 
 static struct goldfish_pipe_dev goldfish_pipe_dev;
@@ -582,14 +585,14 @@ static struct goldfish_pipe *signalled_pipes_pop_front(
return pipe;
 }
 
-static void goldfish_interrupt_task(unsigned long unused)
+static void goldfish_interrupt_task(unsigned long dev_addr)
 {
/* Iterate over the signalled pipes and wake them one by one */
+   struct goldfish_pipe_dev *dev = (struct goldfish_pipe_dev *)dev_addr;
struct goldfish_pipe *pipe;
int wakes;
 
-   while ((pipe = signalled_pipes_pop_front(_pipe_dev, )) !=
-   NULL) {
+   while ((pipe = signalled_pipes_pop_front(dev, )) != NULL) {
if (wakes & PIPE_WAKE_CLOSED) {
pipe->flags = 1 << BIT_CLOSED_ON_HOST;
} else {
@@ -605,7 +608,6 @@ static void goldfish_interrupt_task(unsigned long unused)
wake_up_interruptible(>wake_queue);
}
 }
-static DECLARE_TASKLET(goldfish_interrupt_tasklet, goldfish_interrupt_task, 0);
 
 /*
  * The general idea of the interrupt handling:
@@ -648,7 +650,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void 
*dev_id)
 
spin_unlock_irqrestore(>lock, flags);
 
-   tasklet_schedule(_interrupt_tasklet);
+   tasklet_schedule(>irq_tasklet);
return IRQ_HANDLED;
 }
 
@@ -800,9 +802,14 @@ static void write_pa_addr(void *addr, void __iomem *portl, 
void __iomem *porth)
 static int goldfish_pipe_device_init(struct platform_device *pdev)
 {
struct goldfish_pipe_dev *dev = _pipe_dev;
-   int err = devm_request_irq(>dev, dev->irq,
-   goldfish_pipe_interrupt,
-   IRQF_SHARED, "goldfish_pipe", dev);
+   int err;
+
+   tasklet_init(>irq_tasklet, _interrupt_task,
+(unsigned long)dev);
+
+   err = devm_request_irq(>dev, dev->irq,
+  goldfish_pipe_interrupt,
+  IRQF_SHARED, "goldfish_pipe", dev);
if (err) {
dev_err(>dev, "unable to allocate IRQ for v2\n");
return err;
@@ -854,6 +861,7 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev)
 static void goldfish_pipe_device_deinit(struct platform_device *pdev)
 {
misc_deregister(_pipe_miscdev);
+   tasklet_kill(_pipe_dev.irq_tasklet);
kfree(goldfish_pipe_dev.pipes);
free_page((unsigned long)goldfish_pipe_dev.buffers);
 }
-- 
2.19.0.605.g01d371f741-goog



[PATCH v2 02/15] platform: goldfish: pipe: Move the file-scope goldfish_pipe_miscdev variable into the driver state

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is a series of patches to move mutable file-scope variables
into the driver state. This change will help to introduce another
version of the pipe driver (with different state) for the older
host interface or having several instances of this device.

Signed-off-by: Roman Kiryanov 
---
Changes in v2:
 - Updated the commit message.

 drivers/platform/goldfish/goldfish_pipe.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index ba9aede17d57..8ca709b45e1f 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -211,6 +211,8 @@ struct goldfish_pipe_dev {
 
/* an irq tasklet to run goldfish_interrupt_task */
struct tasklet_struct irq_tasklet;
+
+   struct miscdevice miscdev;
 };
 
 static struct goldfish_pipe_dev goldfish_pipe_dev;
@@ -785,11 +787,14 @@ static const struct file_operations goldfish_pipe_fops = {
.release = goldfish_pipe_release,
 };
 
-static struct miscdevice goldfish_pipe_miscdev = {
-   .minor = MISC_DYNAMIC_MINOR,
-   .name = "goldfish_pipe",
-   .fops = _pipe_fops,
-};
+static void init_miscdevice(struct miscdevice *miscdev)
+{
+   memset(miscdev, 0, sizeof(*miscdev));
+
+   miscdev->minor = MISC_DYNAMIC_MINOR;
+   miscdev->name = "goldfish_pipe";
+   miscdev->fops = _pipe_fops;
+}
 
 static void write_pa_addr(void *addr, void __iomem *portl, void __iomem *porth)
 {
@@ -815,7 +820,8 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev)
return err;
}
 
-   err = misc_register(_pipe_miscdev);
+   init_miscdevice(>miscdev);
+   err = misc_register(>miscdev);
if (err) {
dev_err(>dev, "unable to register v2 device\n");
return err;
@@ -860,7 +866,7 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev)
 
 static void goldfish_pipe_device_deinit(struct platform_device *pdev)
 {
-   misc_deregister(_pipe_miscdev);
+   misc_deregister(_pipe_dev.miscdev);
tasklet_kill(_pipe_dev.irq_tasklet);
kfree(goldfish_pipe_dev.pipes);
free_page((unsigned long)goldfish_pipe_dev.buffers);
-- 
2.19.0.605.g01d371f741-goog



[PATCH v2 01/15] platform: goldfish: pipe: Move the file-scope goldfish_interrupt_tasklet variable into the driver state

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is a series of patches to move mutable file-scope variables
into the driver state. This change will help to introduce another
version of the pipe driver (with different state) for the older
host interface or having several instances of this device.

Signed-off-by: Roman Kiryanov 
---
Changes in v2:
 - Updated the commit message.

 drivers/platform/goldfish/goldfish_pipe.c | 24 +++
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 56665e879e5a..ba9aede17d57 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -208,6 +208,9 @@ struct goldfish_pipe_dev {
int irq;
int version;
unsigned char __iomem *base;
+
+   /* an irq tasklet to run goldfish_interrupt_task */
+   struct tasklet_struct irq_tasklet;
 };
 
 static struct goldfish_pipe_dev goldfish_pipe_dev;
@@ -582,14 +585,14 @@ static struct goldfish_pipe *signalled_pipes_pop_front(
return pipe;
 }
 
-static void goldfish_interrupt_task(unsigned long unused)
+static void goldfish_interrupt_task(unsigned long dev_addr)
 {
/* Iterate over the signalled pipes and wake them one by one */
+   struct goldfish_pipe_dev *dev = (struct goldfish_pipe_dev *)dev_addr;
struct goldfish_pipe *pipe;
int wakes;
 
-   while ((pipe = signalled_pipes_pop_front(_pipe_dev, )) !=
-   NULL) {
+   while ((pipe = signalled_pipes_pop_front(dev, )) != NULL) {
if (wakes & PIPE_WAKE_CLOSED) {
pipe->flags = 1 << BIT_CLOSED_ON_HOST;
} else {
@@ -605,7 +608,6 @@ static void goldfish_interrupt_task(unsigned long unused)
wake_up_interruptible(>wake_queue);
}
 }
-static DECLARE_TASKLET(goldfish_interrupt_tasklet, goldfish_interrupt_task, 0);
 
 /*
  * The general idea of the interrupt handling:
@@ -648,7 +650,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void 
*dev_id)
 
spin_unlock_irqrestore(>lock, flags);
 
-   tasklet_schedule(_interrupt_tasklet);
+   tasklet_schedule(>irq_tasklet);
return IRQ_HANDLED;
 }
 
@@ -800,9 +802,14 @@ static void write_pa_addr(void *addr, void __iomem *portl, 
void __iomem *porth)
 static int goldfish_pipe_device_init(struct platform_device *pdev)
 {
struct goldfish_pipe_dev *dev = _pipe_dev;
-   int err = devm_request_irq(>dev, dev->irq,
-   goldfish_pipe_interrupt,
-   IRQF_SHARED, "goldfish_pipe", dev);
+   int err;
+
+   tasklet_init(>irq_tasklet, _interrupt_task,
+(unsigned long)dev);
+
+   err = devm_request_irq(>dev, dev->irq,
+  goldfish_pipe_interrupt,
+  IRQF_SHARED, "goldfish_pipe", dev);
if (err) {
dev_err(>dev, "unable to allocate IRQ for v2\n");
return err;
@@ -854,6 +861,7 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev)
 static void goldfish_pipe_device_deinit(struct platform_device *pdev)
 {
misc_deregister(_pipe_miscdev);
+   tasklet_kill(_pipe_dev.irq_tasklet);
kfree(goldfish_pipe_dev.pipes);
free_page((unsigned long)goldfish_pipe_dev.buffers);
 }
-- 
2.19.0.605.g01d371f741-goog



[PATCH v2 02/15] platform: goldfish: pipe: Move the file-scope goldfish_pipe_miscdev variable into the driver state

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is a series of patches to move mutable file-scope variables
into the driver state. This change will help to introduce another
version of the pipe driver (with different state) for the older
host interface or having several instances of this device.

Signed-off-by: Roman Kiryanov 
---
Changes in v2:
 - Updated the commit message.

 drivers/platform/goldfish/goldfish_pipe.c | 20 +---
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index ba9aede17d57..8ca709b45e1f 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -211,6 +211,8 @@ struct goldfish_pipe_dev {
 
/* an irq tasklet to run goldfish_interrupt_task */
struct tasklet_struct irq_tasklet;
+
+   struct miscdevice miscdev;
 };
 
 static struct goldfish_pipe_dev goldfish_pipe_dev;
@@ -785,11 +787,14 @@ static const struct file_operations goldfish_pipe_fops = {
.release = goldfish_pipe_release,
 };
 
-static struct miscdevice goldfish_pipe_miscdev = {
-   .minor = MISC_DYNAMIC_MINOR,
-   .name = "goldfish_pipe",
-   .fops = _pipe_fops,
-};
+static void init_miscdevice(struct miscdevice *miscdev)
+{
+   memset(miscdev, 0, sizeof(*miscdev));
+
+   miscdev->minor = MISC_DYNAMIC_MINOR;
+   miscdev->name = "goldfish_pipe";
+   miscdev->fops = _pipe_fops;
+}
 
 static void write_pa_addr(void *addr, void __iomem *portl, void __iomem *porth)
 {
@@ -815,7 +820,8 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev)
return err;
}
 
-   err = misc_register(_pipe_miscdev);
+   init_miscdevice(>miscdev);
+   err = misc_register(>miscdev);
if (err) {
dev_err(>dev, "unable to register v2 device\n");
return err;
@@ -860,7 +866,7 @@ static int goldfish_pipe_device_init(struct platform_device 
*pdev)
 
 static void goldfish_pipe_device_deinit(struct platform_device *pdev)
 {
-   misc_deregister(_pipe_miscdev);
+   misc_deregister(_pipe_dev.miscdev);
tasklet_kill(_pipe_dev.irq_tasklet);
kfree(goldfish_pipe_dev.pipes);
free_page((unsigned long)goldfish_pipe_dev.buffers);
-- 
2.19.0.605.g01d371f741-goog



Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-10-02 Thread leo . yan
On Tue, Oct 02, 2018 at 11:24:56AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sat, Sep 29, 2018 at 03:39:03PM +0800, leo@linaro.org escreveu:
> > On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > > > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > > > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > > > as well.  This patch is to document only for intel_pt, later if we
> > > > enable this feature on Arm platform we need to change the doc;
> > > > alternatively we can use more general description for these two options
> > > > at the first place.  How about you think for this?
> > > 
> > > Likely it already works for CoreSight
> > 
> > I think Kim played with this patch series and he also pointed me for
> > this series.
> > 
> > > I specified intel_pt, because if we just say traces the users won't
> > > know what PMU to specify for record. Being too abstract is
> > > often not helpful.
> > > 
> > > If someone successfully tests it on CoreSight they could submit
> > > a patch to the documentation to add "or " to these
> > > two cases. That would make it then clear for those users too.
> > 
> > Okay, agree.
> > 
> > Actually I applied your patch series v6 on the perf latest core branch
> > and tested on Arm Juno board, I observed there have couple issues, one
> > is CoreSight trace data doesn't support timestamp so I need to use
> > '-F,-time' to workaround the command failure; another issue is now
> > CoreSight is absent to set sample flags so perf fails to resolve
> > symbols [1]; these two issues are only related with CoreSight decoder
> > and it's no matter with this patch, so I didn't mention in my previous
> > replying.
> 
> Could I take that as a Tested-by? I.e. you actually applied the patches,
> run it and saw that it works as advertised, right?

Yes, Arnaldo.  This is my testing tag:

Tested-by: Leo Yan 

> - Arnaldo
>  
> > I need a bit more time to work out more formal CoreSight fixing patches
> > and will send for reviewing (also will include one patch to clarifying
> > Arm Coresight support in doc as suggested).
> > 
> > Thanks,
> > Leo Yan
> > 
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


Re: [PATCH v6 3/5] tools, perf, script: Add --call-trace and --call-ret-trace

2018-10-02 Thread leo . yan
On Tue, Oct 02, 2018 at 11:24:56AM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sat, Sep 29, 2018 at 03:39:03PM +0800, leo@linaro.org escreveu:
> > On Fri, Sep 28, 2018 at 10:19:44AM -0700, Andi Kleen wrote:
> > > > Seems to me, these two features are _NOT_ only benefit for intel_pt,
> > > > other hardware tracing (e.g. Arm CoreSight) can enable these features
> > > > as well.  This patch is to document only for intel_pt, later if we
> > > > enable this feature on Arm platform we need to change the doc;
> > > > alternatively we can use more general description for these two options
> > > > at the first place.  How about you think for this?
> > > 
> > > Likely it already works for CoreSight
> > 
> > I think Kim played with this patch series and he also pointed me for
> > this series.
> > 
> > > I specified intel_pt, because if we just say traces the users won't
> > > know what PMU to specify for record. Being too abstract is
> > > often not helpful.
> > > 
> > > If someone successfully tests it on CoreSight they could submit
> > > a patch to the documentation to add "or " to these
> > > two cases. That would make it then clear for those users too.
> > 
> > Okay, agree.
> > 
> > Actually I applied your patch series v6 on the perf latest core branch
> > and tested on Arm Juno board, I observed there have couple issues, one
> > is CoreSight trace data doesn't support timestamp so I need to use
> > '-F,-time' to workaround the command failure; another issue is now
> > CoreSight is absent to set sample flags so perf fails to resolve
> > symbols [1]; these two issues are only related with CoreSight decoder
> > and it's no matter with this patch, so I didn't mention in my previous
> > replying.
> 
> Could I take that as a Tested-by? I.e. you actually applied the patches,
> run it and saw that it works as advertised, right?

Yes, Arnaldo.  This is my testing tag:

Tested-by: Leo Yan 

> - Arnaldo
>  
> > I need a bit more time to work out more formal CoreSight fixing patches
> > and will send for reviewing (also will include one patch to clarifying
> > Arm Coresight support in doc as suggested).
> > 
> > Thanks,
> > Leo Yan
> > 
> > [1] 
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/builtin-script.c?h=perf/core#n1128


[PATCH 1/2] ARM: dts: uniphier: add SD/eMMC controller nodes

2018-10-02 Thread Masahiro Yamada
Add SD controller nodes for LD4, Pro4, sLD8, Pro5, and PXs2.
This is also used as an eMMC controller for LD4, Pro4, and sLD8.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/boot/dts/uniphier-ld4-ref.dts |  4 +++
 arch/arm/boot/dts/uniphier-ld4.dtsi| 34 +
 arch/arm/boot/dts/uniphier-ld6b-ref.dts|  4 +++
 arch/arm/boot/dts/uniphier-pinctrl.dtsi|  5 
 arch/arm/boot/dts/uniphier-pro4-ace.dts|  4 +++
 arch/arm/boot/dts/uniphier-pro4-ref.dts|  4 +++
 arch/arm/boot/dts/uniphier-pro4-sanji.dts  |  4 +++
 arch/arm/boot/dts/uniphier-pro4.dtsi   | 48 ++
 arch/arm/boot/dts/uniphier-pro5.dtsi   | 34 +
 arch/arm/boot/dts/uniphier-pxs2-gentil.dts |  4 +++
 arch/arm/boot/dts/uniphier-pxs2-vodka.dts  |  4 +++
 arch/arm/boot/dts/uniphier-pxs2.dtsi   | 34 +
 arch/arm/boot/dts/uniphier-sld8-ref.dts|  4 +++
 arch/arm/boot/dts/uniphier-sld8.dtsi   | 34 +
 14 files changed, 221 insertions(+)

diff --git a/arch/arm/boot/dts/uniphier-ld4-ref.dts 
b/arch/arm/boot/dts/uniphier-ld4-ref.dts
index 21407e1..3aaca10 100644
--- a/arch/arm/boot/dts/uniphier-ld4-ref.dts
+++ b/arch/arm/boot/dts/uniphier-ld4-ref.dts
@@ -63,6 +63,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/uniphier-ld4.dtsi 
b/arch/arm/boot/dts/uniphier-ld4.dtsi
index 2a17066..fa00ec8 100644
--- a/arch/arm/boot/dts/uniphier-ld4.dtsi
+++ b/arch/arm/boot/dts/uniphier-ld4.dtsi
@@ -224,6 +224,40 @@
};
};
 
+   sd: sdhc@5a40 {
+   compatible = "socionext,uniphier-sd-v2.91";
+   status = "disabled";
+   reg = <0x5a40 0x200>;
+   interrupts = <0 76 4>;
+   pinctrl-names = "default", "uhs";
+   pinctrl-0 = <_sd>;
+   pinctrl-1 = <_sd_uhs>;
+   clocks = <_clk 0>;
+   reset-names = "host", "bridge";
+   resets = <_rst 0>, <_rst 3>;
+   bus-width = <4>;
+   cap-sd-highspeed;
+   sd-uhs-sdr12;
+   sd-uhs-sdr25;
+   sd-uhs-sdr50;
+   };
+
+   emmc: sdhc@5a50 {
+   compatible = "socionext,uniphier-sd-v2.91";
+   status = "disabled";
+   reg = <0x5a50 0x200>;
+   interrupts = <0 78 4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_emmc>;
+   clocks = <_clk 1>;
+   reset-names = "host", "bridge", "hw";
+   resets = <_rst 1>, <_rst 4>, <_rst 6>;
+   bus-width = <8>;
+   cap-mmc-highspeed;
+   cap-mmc-hw-reset;
+   non-removable;
+   };
+
usb0: usb@5a800100 {
compatible = "socionext,uniphier-ehci", "generic-ehci";
status = "disabled";
diff --git a/arch/arm/boot/dts/uniphier-ld6b-ref.dts 
b/arch/arm/boot/dts/uniphier-ld6b-ref.dts
index a0a44a4..e505a94 100644
--- a/arch/arm/boot/dts/uniphier-ld6b-ref.dts
+++ b/arch/arm/boot/dts/uniphier-ld6b-ref.dts
@@ -65,6 +65,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
phy-handle = <>;
diff --git a/arch/arm/boot/dts/uniphier-pinctrl.dtsi 
b/arch/arm/boot/dts/uniphier-pinctrl.dtsi
index 51f0e69..aeb47b0 100644
--- a/arch/arm/boot/dts/uniphier-pinctrl.dtsi
+++ b/arch/arm/boot/dts/uniphier-pinctrl.dtsi
@@ -121,6 +121,11 @@
function = "sd";
};
 
+   pinctrl_sd_uhs: sd-uhs {
+   groups = "sd";
+   function = "sd";
+   };
+
pinctrl_sd1: sd1 {
groups = "sd1";
function = "sd1";
diff --git a/arch/arm/boot/dts/uniphier-pro4-ace.dts 
b/arch/arm/boot/dts/uniphier-pro4-ace.dts
index db1b089..46e0917 100644
--- a/arch/arm/boot/dts/uniphier-pro4-ace.dts
+++ b/arch/arm/boot/dts/uniphier-pro4-ace.dts
@@ -68,6 +68,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/uniphier-pro4-ref.dts 
b/arch/arm/boot/dts/uniphier-pro4-ref.dts
index efb0849..1429908 100644
--- a/arch/arm/boot/dts/uniphier-pro4-ref.dts
+++ b/arch/arm/boot/dts/uniphier-pro4-ref.dts
@@ -65,6 +65,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/uniphier-pro4-sanji.dts 
b/arch/arm/boot/dts/uniphier-pro4-sanji.dts
index dac4d66..eaca4a7 100644
--- a/arch/arm/boot/dts/uniphier-pro4-sanji.dts
+++ 

[PATCH 2/2] arm64: dts: uniphier: add SD controller nodes

2018-10-02 Thread Masahiro Yamada
Add SD controller nodes for LD20 and PXs3.
LD20 does not support the UHS mode, while PXs3 supports it.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi| 14 ++
 arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts |  4 
 arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi| 18 ++
 3 files changed, 36 insertions(+)

diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
index 6932cef..ee92605 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
@@ -528,6 +528,20 @@
cdns,phy-dll-delay-sdclk-hsmmc = <21>;
};
 
+   sd: sdhc@5a40 {
+   compatible = "socionext,uniphier-sd-v3.1.1";
+   status = "disabled";
+   reg = <0x5a40 0x800>;
+   interrupts = <0 76 4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_sd>;
+   clocks = <_clk 0>;
+   reset-names = "host";
+   resets = <_rst 0>;
+   bus-width = <4>;
+   cap-sd-highspeed;
+   };
+
soc_glue: soc-glue@5f80 {
compatible = "socionext,uniphier-ld20-soc-glue",
 "simple-mfd", "syscon";
diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts 
b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts
index c1bb607..1ad149c 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts
+++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts
@@ -75,6 +75,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
phy-handle = <>;
diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
index fd2bcd4..f3f19f5 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
@@ -341,6 +341,24 @@
cdns,phy-dll-delay-sdclk-hsmmc = <21>;
};
 
+   sd: sdhc@5a40 {
+   compatible = "socionext,uniphier-sd-v3.1.1";
+   status = "disabled";
+   reg = <0x5a40 0x800>;
+   interrupts = <0 76 4>;
+   pinctrl-names = "default", "uhs";
+   pinctrl-0 = <_sd>;
+   pinctrl-1 = <_sd_uhs>;
+   clocks = <_clk 0>;
+   reset-names = "host";
+   resets = <_rst 0>;
+   bus-width = <4>;
+   cap-sd-highspeed;
+   sd-uhs-sdr12;
+   sd-uhs-sdr25;
+   sd-uhs-sdr50;
+   };
+
soc_glue: soc-glue@5f80 {
compatible = "socionext,uniphier-pxs3-soc-glue",
 "simple-mfd", "syscon";
-- 
2.7.4



Re: [PATCH 1/2] mmc: tmio: move MFD variant reset to a platform hook

2018-10-02 Thread Wolfram Sang
Hi Yamada-san,

On Mon, Oct 01, 2018 at 09:31:01PM +0900, Masahiro Yamada wrote:
> CTL_RESET_SDIO register is specific to the TMIO MFD (tmio_mmc.c).
> 
> Add a new hook host->reset for performing a platform-specific reset
> sequence, and move CTL_RESET_SDIO over there.
> 
> Signed-off-by: Masahiro Yamada 

I like it in general.

> +static void tmio_mmc_reset(struct tmio_mmc_host *host)
> +{
> + sd_ctrl_write16(host, CTL_RESET_SDIO, 0x);
> + usleep_range(1, 11000);
> + sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
> + usleep_range(1, 11000);
> +}
> +

Are you sure resetting SDIO works independently of resetting SD? Maybe
we should add resetting SD here, too, to keep the pattern...

> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -164,14 +164,13 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
>  {
>   /* FIXME - should we set stop clock reg here */
>   sd_ctrl_write16(host, CTL_RESET_SD, 0x);
> - if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
> - sd_ctrl_write16(host, CTL_RESET_SDIO, 0x);
>   usleep_range(1, 11000);
>   sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
> - if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
> - sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
>   usleep_range(1, 11000);

... and have this simplified reset pattern either also in a seperate
function, or doing...

>  
> + if (host->reset)
> + host->reset(host);
else
simplified_reset_pattern

?

What's your opinion?

Regards,

   Wolfram



signature.asc
Description: PGP signature


[PATCH 1/2] ARM: dts: uniphier: add SD/eMMC controller nodes

2018-10-02 Thread Masahiro Yamada
Add SD controller nodes for LD4, Pro4, sLD8, Pro5, and PXs2.
This is also used as an eMMC controller for LD4, Pro4, and sLD8.

Signed-off-by: Masahiro Yamada 
---

 arch/arm/boot/dts/uniphier-ld4-ref.dts |  4 +++
 arch/arm/boot/dts/uniphier-ld4.dtsi| 34 +
 arch/arm/boot/dts/uniphier-ld6b-ref.dts|  4 +++
 arch/arm/boot/dts/uniphier-pinctrl.dtsi|  5 
 arch/arm/boot/dts/uniphier-pro4-ace.dts|  4 +++
 arch/arm/boot/dts/uniphier-pro4-ref.dts|  4 +++
 arch/arm/boot/dts/uniphier-pro4-sanji.dts  |  4 +++
 arch/arm/boot/dts/uniphier-pro4.dtsi   | 48 ++
 arch/arm/boot/dts/uniphier-pro5.dtsi   | 34 +
 arch/arm/boot/dts/uniphier-pxs2-gentil.dts |  4 +++
 arch/arm/boot/dts/uniphier-pxs2-vodka.dts  |  4 +++
 arch/arm/boot/dts/uniphier-pxs2.dtsi   | 34 +
 arch/arm/boot/dts/uniphier-sld8-ref.dts|  4 +++
 arch/arm/boot/dts/uniphier-sld8.dtsi   | 34 +
 14 files changed, 221 insertions(+)

diff --git a/arch/arm/boot/dts/uniphier-ld4-ref.dts 
b/arch/arm/boot/dts/uniphier-ld4-ref.dts
index 21407e1..3aaca10 100644
--- a/arch/arm/boot/dts/uniphier-ld4-ref.dts
+++ b/arch/arm/boot/dts/uniphier-ld4-ref.dts
@@ -63,6 +63,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/uniphier-ld4.dtsi 
b/arch/arm/boot/dts/uniphier-ld4.dtsi
index 2a17066..fa00ec8 100644
--- a/arch/arm/boot/dts/uniphier-ld4.dtsi
+++ b/arch/arm/boot/dts/uniphier-ld4.dtsi
@@ -224,6 +224,40 @@
};
};
 
+   sd: sdhc@5a40 {
+   compatible = "socionext,uniphier-sd-v2.91";
+   status = "disabled";
+   reg = <0x5a40 0x200>;
+   interrupts = <0 76 4>;
+   pinctrl-names = "default", "uhs";
+   pinctrl-0 = <_sd>;
+   pinctrl-1 = <_sd_uhs>;
+   clocks = <_clk 0>;
+   reset-names = "host", "bridge";
+   resets = <_rst 0>, <_rst 3>;
+   bus-width = <4>;
+   cap-sd-highspeed;
+   sd-uhs-sdr12;
+   sd-uhs-sdr25;
+   sd-uhs-sdr50;
+   };
+
+   emmc: sdhc@5a50 {
+   compatible = "socionext,uniphier-sd-v2.91";
+   status = "disabled";
+   reg = <0x5a50 0x200>;
+   interrupts = <0 78 4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_emmc>;
+   clocks = <_clk 1>;
+   reset-names = "host", "bridge", "hw";
+   resets = <_rst 1>, <_rst 4>, <_rst 6>;
+   bus-width = <8>;
+   cap-mmc-highspeed;
+   cap-mmc-hw-reset;
+   non-removable;
+   };
+
usb0: usb@5a800100 {
compatible = "socionext,uniphier-ehci", "generic-ehci";
status = "disabled";
diff --git a/arch/arm/boot/dts/uniphier-ld6b-ref.dts 
b/arch/arm/boot/dts/uniphier-ld6b-ref.dts
index a0a44a4..e505a94 100644
--- a/arch/arm/boot/dts/uniphier-ld6b-ref.dts
+++ b/arch/arm/boot/dts/uniphier-ld6b-ref.dts
@@ -65,6 +65,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
phy-handle = <>;
diff --git a/arch/arm/boot/dts/uniphier-pinctrl.dtsi 
b/arch/arm/boot/dts/uniphier-pinctrl.dtsi
index 51f0e69..aeb47b0 100644
--- a/arch/arm/boot/dts/uniphier-pinctrl.dtsi
+++ b/arch/arm/boot/dts/uniphier-pinctrl.dtsi
@@ -121,6 +121,11 @@
function = "sd";
};
 
+   pinctrl_sd_uhs: sd-uhs {
+   groups = "sd";
+   function = "sd";
+   };
+
pinctrl_sd1: sd1 {
groups = "sd1";
function = "sd1";
diff --git a/arch/arm/boot/dts/uniphier-pro4-ace.dts 
b/arch/arm/boot/dts/uniphier-pro4-ace.dts
index db1b089..46e0917 100644
--- a/arch/arm/boot/dts/uniphier-pro4-ace.dts
+++ b/arch/arm/boot/dts/uniphier-pro4-ace.dts
@@ -68,6 +68,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/uniphier-pro4-ref.dts 
b/arch/arm/boot/dts/uniphier-pro4-ref.dts
index efb0849..1429908 100644
--- a/arch/arm/boot/dts/uniphier-pro4-ref.dts
+++ b/arch/arm/boot/dts/uniphier-pro4-ref.dts
@@ -65,6 +65,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
 };
diff --git a/arch/arm/boot/dts/uniphier-pro4-sanji.dts 
b/arch/arm/boot/dts/uniphier-pro4-sanji.dts
index dac4d66..eaca4a7 100644
--- a/arch/arm/boot/dts/uniphier-pro4-sanji.dts
+++ 

[PATCH 2/2] arm64: dts: uniphier: add SD controller nodes

2018-10-02 Thread Masahiro Yamada
Add SD controller nodes for LD20 and PXs3.
LD20 does not support the UHS mode, while PXs3 supports it.

Signed-off-by: Masahiro Yamada 
---

 arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi| 14 ++
 arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts |  4 
 arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi| 18 ++
 3 files changed, 36 insertions(+)

diff --git a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
index 6932cef..ee92605 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-ld20.dtsi
@@ -528,6 +528,20 @@
cdns,phy-dll-delay-sdclk-hsmmc = <21>;
};
 
+   sd: sdhc@5a40 {
+   compatible = "socionext,uniphier-sd-v3.1.1";
+   status = "disabled";
+   reg = <0x5a40 0x800>;
+   interrupts = <0 76 4>;
+   pinctrl-names = "default";
+   pinctrl-0 = <_sd>;
+   clocks = <_clk 0>;
+   reset-names = "host";
+   resets = <_rst 0>;
+   bus-width = <4>;
+   cap-sd-highspeed;
+   };
+
soc_glue: soc-glue@5f80 {
compatible = "socionext,uniphier-ld20-soc-glue",
 "simple-mfd", "syscon";
diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts 
b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts
index c1bb607..1ad149c 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts
+++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3-ref.dts
@@ -75,6 +75,10 @@
status = "okay";
 };
 
+ {
+   status = "okay";
+};
+
  {
status = "okay";
phy-handle = <>;
diff --git a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi 
b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
index fd2bcd4..f3f19f5 100644
--- a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
+++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi
@@ -341,6 +341,24 @@
cdns,phy-dll-delay-sdclk-hsmmc = <21>;
};
 
+   sd: sdhc@5a40 {
+   compatible = "socionext,uniphier-sd-v3.1.1";
+   status = "disabled";
+   reg = <0x5a40 0x800>;
+   interrupts = <0 76 4>;
+   pinctrl-names = "default", "uhs";
+   pinctrl-0 = <_sd>;
+   pinctrl-1 = <_sd_uhs>;
+   clocks = <_clk 0>;
+   reset-names = "host";
+   resets = <_rst 0>;
+   bus-width = <4>;
+   cap-sd-highspeed;
+   sd-uhs-sdr12;
+   sd-uhs-sdr25;
+   sd-uhs-sdr50;
+   };
+
soc_glue: soc-glue@5f80 {
compatible = "socionext,uniphier-pxs3-soc-glue",
 "simple-mfd", "syscon";
-- 
2.7.4



Re: [PATCH 1/2] mmc: tmio: move MFD variant reset to a platform hook

2018-10-02 Thread Wolfram Sang
Hi Yamada-san,

On Mon, Oct 01, 2018 at 09:31:01PM +0900, Masahiro Yamada wrote:
> CTL_RESET_SDIO register is specific to the TMIO MFD (tmio_mmc.c).
> 
> Add a new hook host->reset for performing a platform-specific reset
> sequence, and move CTL_RESET_SDIO over there.
> 
> Signed-off-by: Masahiro Yamada 

I like it in general.

> +static void tmio_mmc_reset(struct tmio_mmc_host *host)
> +{
> + sd_ctrl_write16(host, CTL_RESET_SDIO, 0x);
> + usleep_range(1, 11000);
> + sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
> + usleep_range(1, 11000);
> +}
> +

Are you sure resetting SDIO works independently of resetting SD? Maybe
we should add resetting SD here, too, to keep the pattern...

> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -164,14 +164,13 @@ static void tmio_mmc_reset(struct tmio_mmc_host *host)
>  {
>   /* FIXME - should we set stop clock reg here */
>   sd_ctrl_write16(host, CTL_RESET_SD, 0x);
> - if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
> - sd_ctrl_write16(host, CTL_RESET_SDIO, 0x);
>   usleep_range(1, 11000);
>   sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
> - if (host->pdata->flags & TMIO_MMC_HAVE_HIGH_REG)
> - sd_ctrl_write16(host, CTL_RESET_SDIO, 0x0001);
>   usleep_range(1, 11000);

... and have this simplified reset pattern either also in a seperate
function, or doing...

>  
> + if (host->reset)
> + host->reset(host);
else
simplified_reset_pattern

?

What's your opinion?

Regards,

   Wolfram



signature.asc
Description: PGP signature


Re: [PATCHv1 00/14] power: supply: Fix custom sysfs attribute registration

2018-10-02 Thread Greg Kroah-Hartman
On Mon, Oct 01, 2018 at 12:03:35AM +0200, Sebastian Reichel wrote:
> Hi,
> 
> Udev may not detect sysfs attributes, that have been added
> after the device has been created. Code doing that is racy [0].
> The power-supply class properly registers its attributes
> when the device is created, but some drivers add additional
> custom attributes in a racy way.
> 
> The first patch from this series adds native support for custom
> sysfs attributes to the power-supply subsystem. This feature
> allows cleaner code and avoids a race condition preventing udev
> from noticing the custom properties.
> 
> The following patches replace all instances of sysfs_create_*
> in drivers/power/supply to use the new feature and a couple
> of small cleanups.
> 
> TL;DR: This patchsets replaces all sysfs_create_* in power-supply.
> 
> [0] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
> 
> -- Sebastian
> 
> Sebastian Reichel (14):
>   power: supply: core: add support for custom sysfs attributes
>   power: supply: bq2415x: fix race-condition in sysfs registration
>   power: supply: ds2780: fix race-condition in sysfs registration
>   power: supply: ds2781: fix race-condition in sysfs registration
>   power: supply: lp8788: fix race-condition in sysfs registration
>   power: supply: bq24190_charger: fix race-condition in sysfs
> registration
>   power: supply: bq24257: fix race-condition in sysfs registration
>   power: supply: charger-manager: simplify generation of sysfs attribute
> group name
>   power: supply: charger-manager: fix race-condition in sysfs
> registration
>   power: supply: pcf50633: fix race-condition in sysfs registration
>   power: supply: ds2780: fix race-condition in bin attribute
> registration
>   power: supply: ds2781: fix race-condition in bin attribute
> registration
>   power: supply: ds2780: switch to devm_power_supply_register
>   power: supply: ds2781: switch to devm_power_supply_register
> 
>  drivers/power/supply/bq2415x_charger.c   | 119 ++-
>  drivers/power/supply/bq24190_charger.c   |  43 ++--
>  drivers/power/supply/bq24257_charger.c   |  15 +--
>  drivers/power/supply/charger-manager.c   |  62 +---
>  drivers/power/supply/ds2780_battery.c|  87 +
>  drivers/power/supply/ds2781_battery.c|  82 +---
>  drivers/power/supply/lp8788-charger.c|  62 +---
>  drivers/power/supply/pcf50633-charger.c  |  17 ++--
>  drivers/power/supply/power_supply_core.c |   1 +
>  include/linux/power/charger-manager.h|   3 +-
>  include/linux/power_supply.h |   3 +
>  11 files changed, 172 insertions(+), 322 deletions(-)

Nice work, and it removes more code than it adds, always a win.

greg k-h


Re: [PATCHv1 00/14] power: supply: Fix custom sysfs attribute registration

2018-10-02 Thread Greg Kroah-Hartman
On Mon, Oct 01, 2018 at 12:03:35AM +0200, Sebastian Reichel wrote:
> Hi,
> 
> Udev may not detect sysfs attributes, that have been added
> after the device has been created. Code doing that is racy [0].
> The power-supply class properly registers its attributes
> when the device is created, but some drivers add additional
> custom attributes in a racy way.
> 
> The first patch from this series adds native support for custom
> sysfs attributes to the power-supply subsystem. This feature
> allows cleaner code and avoids a race condition preventing udev
> from noticing the custom properties.
> 
> The following patches replace all instances of sysfs_create_*
> in drivers/power/supply to use the new feature and a couple
> of small cleanups.
> 
> TL;DR: This patchsets replaces all sysfs_create_* in power-supply.
> 
> [0] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
> 
> -- Sebastian
> 
> Sebastian Reichel (14):
>   power: supply: core: add support for custom sysfs attributes
>   power: supply: bq2415x: fix race-condition in sysfs registration
>   power: supply: ds2780: fix race-condition in sysfs registration
>   power: supply: ds2781: fix race-condition in sysfs registration
>   power: supply: lp8788: fix race-condition in sysfs registration
>   power: supply: bq24190_charger: fix race-condition in sysfs
> registration
>   power: supply: bq24257: fix race-condition in sysfs registration
>   power: supply: charger-manager: simplify generation of sysfs attribute
> group name
>   power: supply: charger-manager: fix race-condition in sysfs
> registration
>   power: supply: pcf50633: fix race-condition in sysfs registration
>   power: supply: ds2780: fix race-condition in bin attribute
> registration
>   power: supply: ds2781: fix race-condition in bin attribute
> registration
>   power: supply: ds2780: switch to devm_power_supply_register
>   power: supply: ds2781: switch to devm_power_supply_register
> 
>  drivers/power/supply/bq2415x_charger.c   | 119 ++-
>  drivers/power/supply/bq24190_charger.c   |  43 ++--
>  drivers/power/supply/bq24257_charger.c   |  15 +--
>  drivers/power/supply/charger-manager.c   |  62 +---
>  drivers/power/supply/ds2780_battery.c|  87 +
>  drivers/power/supply/ds2781_battery.c|  82 +---
>  drivers/power/supply/lp8788-charger.c|  62 +---
>  drivers/power/supply/pcf50633-charger.c  |  17 ++--
>  drivers/power/supply/power_supply_core.c |   1 +
>  include/linux/power/charger-manager.h|   3 +-
>  include/linux/power_supply.h |   3 +
>  11 files changed, 172 insertions(+), 322 deletions(-)

Nice work, and it removes more code than it adds, always a win.

greg k-h


Re: [PATCH] misc: cxl: Move a deference below a NULL test

2018-10-02 Thread Greg KH
On Wed, Sep 26, 2018 at 07:41:12PM +0800, zhong jiang wrote:
> It is safe to move a deference below a NULL test.
> 
> Signed-off-by: zhong jiang 
> Acked-by: Andrew Donnellan 
> ---
>  drivers/misc/cxl/guest.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index 3bc0c15..559e835 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int 
> slice, struct device_node *afu_n
>  
>  void cxl_guest_remove_afu(struct cxl_afu *afu)
>  {
> - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> -
>   if (!afu)
>   return;
>  
> + pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> +

This call should just be deleted, ftrace can be used if this type of
thing is really needed.

thanks,

greg k-h


Re: [PATCH] misc: cxl: Move a deference below a NULL test

2018-10-02 Thread Greg KH
On Wed, Sep 26, 2018 at 07:41:12PM +0800, zhong jiang wrote:
> It is safe to move a deference below a NULL test.
> 
> Signed-off-by: zhong jiang 
> Acked-by: Andrew Donnellan 
> ---
>  drivers/misc/cxl/guest.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/misc/cxl/guest.c b/drivers/misc/cxl/guest.c
> index 3bc0c15..559e835 100644
> --- a/drivers/misc/cxl/guest.c
> +++ b/drivers/misc/cxl/guest.c
> @@ -1018,11 +1018,11 @@ int cxl_guest_init_afu(struct cxl *adapter, int 
> slice, struct device_node *afu_n
>  
>  void cxl_guest_remove_afu(struct cxl_afu *afu)
>  {
> - pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> -
>   if (!afu)
>   return;
>  
> + pr_devel("in %s - AFU(%d)\n", __func__, afu->slice);
> +

This call should just be deleted, ftrace can be used if this type of
thing is really needed.

thanks,

greg k-h


Re: [PATCH] pinctrl: qcom: fix 'const' pointer handling

2018-10-02 Thread Bjorn Andersson
On Tue 02 Oct 14:15 PDT 2018, Arnd Bergmann wrote:

> The 'tiles' array is initialized to a constant pointers to constant
> strings, but the declaration is only half as constant:
> 
> drivers/pinctrl/qcom/pinctrl-qcs404.c:1660:11: error: initialization discards 
> 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> drivers/pinctrl/qcom/pinctrl-sdm660.c:1417:11: error: initialization discards 
> 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> 
> Let's make it more constant.
> 
> Fixes: 22eb8301dbc1 ("pinctrl: qcom: Add qcs404 pinctrl driver")
> Fixes: a46d5e98190d ("pinctrl: qcom: Support dispersed tiles")
> Signed-off-by: Arnd Bergmann 

Not sure why my compiler doesn't complain about this, thanks for the fix
Arnd.

Reviewed-by: Bjorn Andersson 

Regards,
Bjorn

> ---
>  drivers/pinctrl/qcom/pinctrl-msm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h 
> b/drivers/pinctrl/qcom/pinctrl-msm.h
> index 0ad4bc55e2e1..29172fdf5882 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.h
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.h
> @@ -119,7 +119,7 @@ struct msm_pinctrl_soc_data {
>   unsigned ngroups;
>   unsigned ngpios;
>   bool pull_no_keeper;
> - const char **tiles;
> + const char *const *tiles;
>   unsigned int ntiles;
>  };
>  
> -- 
> 2.18.0
> 


[PATCH] [v4] HID: add support for Apple Magic Trackpad 2

2018-10-02 Thread Sean O'Brien
USB device
Vendor 05ac (Apple)
Device 0265 (Magic Trackpad 2)
Bluetooth device
Vendor 004c (Apple)
Device 0265 (Magic Trackpad 2)

Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
the device in multi-touch mode.

Signed-off-by: Claudio Mettler 
Signed-off-by: Marek Wyborski 
Signed-off-by: Sean O'Brien 
---

 drivers/hid/hid-ids.h|   1 +
 drivers/hid/hid-magicmouse.c | 142 ---
 2 files changed, 132 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 5146ee029db4..bb0cd212c7cc 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -92,6 +92,7 @@
 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
 #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
 #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD  0x030e
+#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
 #define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index b454c4386157..1d5ea678d268 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -54,6 +54,8 @@ module_param(report_undeciphered, bool, 0644);
 MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state 
field using a MSC_RAW event");
 
 #define TRACKPAD_REPORT_ID 0x28
+#define TRACKPAD2_USB_REPORT_ID 0x02
+#define TRACKPAD2_BT_REPORT_ID 0x31
 #define MOUSE_REPORT_ID0x29
 #define DOUBLE_REPORT_ID   0xf7
 /* These definitions are not precise, but they're close enough.  (Bits
@@ -91,6 +93,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered 
multi-touch state fie
 #define TRACKPAD_RES_Y \
((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
 
+#define TRACKPAD2_DIMENSION_X (float)16000
+#define TRACKPAD2_MIN_X -3678
+#define TRACKPAD2_MAX_X 3934
+#define TRACKPAD2_RES_X \
+   ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 100))
+#define TRACKPAD2_DIMENSION_Y (float)11490
+#define TRACKPAD2_MIN_Y -2478
+#define TRACKPAD2_MAX_Y 2587
+#define TRACKPAD2_RES_Y \
+   ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 100))
+
 /**
  * struct magicmouse_sc - Tracks Magic Mouse-specific data.
  * @input: Input device through which we report events.
@@ -183,6 +196,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
 {
struct input_dev *input = msc->input;
int id, x, y, size, orientation, touch_major, touch_minor, state, down;
+   int pressure = 0;
 
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
@@ -194,6 +208,17 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
touch_minor = tdata[4];
state = tdata[7] & TOUCH_STATE_MASK;
down = state != TOUCH_STATE_NONE;
+   } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+   id = tdata[8] & 0xf;
+   x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
+   y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) >> 19);
+   size = tdata[6];
+   orientation = (tdata[8] >> 5) - 4;
+   touch_major = tdata[4];
+   touch_minor = tdata[5];
+   pressure = tdata[7];
+   state = tdata[3] & 0xC0;
+   down = state == 0x80;
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
id = (tdata[7] << 2 | tdata[6] >> 6) & 0xf;
x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
@@ -215,7 +240,8 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
/* If requested, emulate a scroll wheel by detecting small
 * vertical touch motions.
 */
-   if (emulate_scroll_wheel) {
+   if (emulate_scroll_wheel && (input->id.product !=
+   USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)) {
unsigned long now = jiffies;
int step_x = msc->touches[id].scroll_x - x;
int step_y = msc->touches[id].scroll_y - y;
@@ -269,10 +295,14 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
 
+   if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)
+   input_report_abs(input, ABS_MT_PRESSURE, pressure);
+
if (report_undeciphered) {
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
input_event(input, EV_MSC, MSC_RAW, tdata[7]);
-   else /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+ 

Re: [PATCH] pinctrl: qcom: fix 'const' pointer handling

2018-10-02 Thread Bjorn Andersson
On Tue 02 Oct 14:15 PDT 2018, Arnd Bergmann wrote:

> The 'tiles' array is initialized to a constant pointers to constant
> strings, but the declaration is only half as constant:
> 
> drivers/pinctrl/qcom/pinctrl-qcs404.c:1660:11: error: initialization discards 
> 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> drivers/pinctrl/qcom/pinctrl-sdm660.c:1417:11: error: initialization discards 
> 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
> 
> Let's make it more constant.
> 
> Fixes: 22eb8301dbc1 ("pinctrl: qcom: Add qcs404 pinctrl driver")
> Fixes: a46d5e98190d ("pinctrl: qcom: Support dispersed tiles")
> Signed-off-by: Arnd Bergmann 

Not sure why my compiler doesn't complain about this, thanks for the fix
Arnd.

Reviewed-by: Bjorn Andersson 

Regards,
Bjorn

> ---
>  drivers/pinctrl/qcom/pinctrl-msm.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h 
> b/drivers/pinctrl/qcom/pinctrl-msm.h
> index 0ad4bc55e2e1..29172fdf5882 100644
> --- a/drivers/pinctrl/qcom/pinctrl-msm.h
> +++ b/drivers/pinctrl/qcom/pinctrl-msm.h
> @@ -119,7 +119,7 @@ struct msm_pinctrl_soc_data {
>   unsigned ngroups;
>   unsigned ngpios;
>   bool pull_no_keeper;
> - const char **tiles;
> + const char *const *tiles;
>   unsigned int ntiles;
>  };
>  
> -- 
> 2.18.0
> 


[PATCH] [v4] HID: add support for Apple Magic Trackpad 2

2018-10-02 Thread Sean O'Brien
USB device
Vendor 05ac (Apple)
Device 0265 (Magic Trackpad 2)
Bluetooth device
Vendor 004c (Apple)
Device 0265 (Magic Trackpad 2)

Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
the device in multi-touch mode.

Signed-off-by: Claudio Mettler 
Signed-off-by: Marek Wyborski 
Signed-off-by: Sean O'Brien 
---

 drivers/hid/hid-ids.h|   1 +
 drivers/hid/hid-magicmouse.c | 142 ---
 2 files changed, 132 insertions(+), 11 deletions(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 5146ee029db4..bb0cd212c7cc 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -92,6 +92,7 @@
 #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
 #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
 #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD  0x030e
+#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
 #define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
index b454c4386157..1d5ea678d268 100644
--- a/drivers/hid/hid-magicmouse.c
+++ b/drivers/hid/hid-magicmouse.c
@@ -54,6 +54,8 @@ module_param(report_undeciphered, bool, 0644);
 MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch state 
field using a MSC_RAW event");
 
 #define TRACKPAD_REPORT_ID 0x28
+#define TRACKPAD2_USB_REPORT_ID 0x02
+#define TRACKPAD2_BT_REPORT_ID 0x31
 #define MOUSE_REPORT_ID0x29
 #define DOUBLE_REPORT_ID   0xf7
 /* These definitions are not precise, but they're close enough.  (Bits
@@ -91,6 +93,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report undeciphered 
multi-touch state fie
 #define TRACKPAD_RES_Y \
((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
 
+#define TRACKPAD2_DIMENSION_X (float)16000
+#define TRACKPAD2_MIN_X -3678
+#define TRACKPAD2_MAX_X 3934
+#define TRACKPAD2_RES_X \
+   ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 100))
+#define TRACKPAD2_DIMENSION_Y (float)11490
+#define TRACKPAD2_MIN_Y -2478
+#define TRACKPAD2_MAX_Y 2587
+#define TRACKPAD2_RES_Y \
+   ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 100))
+
 /**
  * struct magicmouse_sc - Tracks Magic Mouse-specific data.
  * @input: Input device through which we report events.
@@ -183,6 +196,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
 {
struct input_dev *input = msc->input;
int id, x, y, size, orientation, touch_major, touch_minor, state, down;
+   int pressure = 0;
 
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
@@ -194,6 +208,17 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
touch_minor = tdata[4];
state = tdata[7] & TOUCH_STATE_MASK;
down = state != TOUCH_STATE_NONE;
+   } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) {
+   id = tdata[8] & 0xf;
+   x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
+   y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) >> 19);
+   size = tdata[6];
+   orientation = (tdata[8] >> 5) - 4;
+   touch_major = tdata[4];
+   touch_minor = tdata[5];
+   pressure = tdata[7];
+   state = tdata[3] & 0xC0;
+   down = state == 0x80;
} else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
id = (tdata[7] << 2 | tdata[6] >> 6) & 0xf;
x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
@@ -215,7 +240,8 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
/* If requested, emulate a scroll wheel by detecting small
 * vertical touch motions.
 */
-   if (emulate_scroll_wheel) {
+   if (emulate_scroll_wheel && (input->id.product !=
+   USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)) {
unsigned long now = jiffies;
int step_x = msc->touches[id].scroll_x - x;
int step_y = msc->touches[id].scroll_y - y;
@@ -269,10 +295,14 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
*msc, int raw_id, u8 *tda
input_report_abs(input, ABS_MT_POSITION_X, x);
input_report_abs(input, ABS_MT_POSITION_Y, y);
 
+   if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2)
+   input_report_abs(input, ABS_MT_PRESSURE, pressure);
+
if (report_undeciphered) {
if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE)
input_event(input, EV_MSC, MSC_RAW, tdata[7]);
-   else /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
+ 

[PATCH] x86/cpu/amd: Remove unnecessary parentheses

2018-10-02 Thread Nathan Chancellor
Clang warns when multiple pairs of parentheses are used for a single
conditional statement.

arch/x86/kernel/cpu/amd.c:925:14: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
if ((c->x86 == 6)) {
 ~~~^~~~
arch/x86/kernel/cpu/amd.c:925:14: note: remove extraneous parentheses
around the comparison to silence this warning
if ((c->x86 == 6)) {
~   ^   ~
arch/x86/kernel/cpu/amd.c:925:14: note: use '=' to turn this equality
comparison into an assignment
if ((c->x86 == 6)) {
^~
=
1 warning generated.

Link: https://github.com/ClangBuiltLinux/linux/issues/187
Signed-off-by: Nathan Chancellor 
---
 arch/x86/kernel/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 22ab408177b2..eeea634bee0a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -922,7 +922,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
 {
/* AMD errata T13 (order #21922) */
-   if ((c->x86 == 6)) {
+   if (c->x86 == 6) {
/* Duron Rev A0 */
if (c->x86_model == 3 && c->x86_stepping == 0)
size = 64;
-- 
2.19.0



[PATCH] x86/cpu/amd: Remove unnecessary parentheses

2018-10-02 Thread Nathan Chancellor
Clang warns when multiple pairs of parentheses are used for a single
conditional statement.

arch/x86/kernel/cpu/amd.c:925:14: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
if ((c->x86 == 6)) {
 ~~~^~~~
arch/x86/kernel/cpu/amd.c:925:14: note: remove extraneous parentheses
around the comparison to silence this warning
if ((c->x86 == 6)) {
~   ^   ~
arch/x86/kernel/cpu/amd.c:925:14: note: use '=' to turn this equality
comparison into an assignment
if ((c->x86 == 6)) {
^~
=
1 warning generated.

Link: https://github.com/ClangBuiltLinux/linux/issues/187
Signed-off-by: Nathan Chancellor 
---
 arch/x86/kernel/cpu/amd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 22ab408177b2..eeea634bee0a 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -922,7 +922,7 @@ static void init_amd(struct cpuinfo_x86 *c)
 static unsigned int amd_size_cache(struct cpuinfo_x86 *c, unsigned int size)
 {
/* AMD errata T13 (order #21922) */
-   if ((c->x86 == 6)) {
+   if (c->x86 == 6) {
/* Duron Rev A0 */
if (c->x86_model == 3 && c->x86_stepping == 0)
size = 64;
-- 
2.19.0



Re: Leaking Path in XFS's ioctl interface(missing LSM check)

2018-10-02 Thread Dave Chinner
On Wed, Oct 03, 2018 at 05:20:31AM +1000, James Morris wrote:
> On Tue, 2 Oct 2018, Dave Chinner wrote:
> 
> > On Tue, Oct 02, 2018 at 06:08:16AM +1000, James Morris wrote:
> > > On Mon, 1 Oct 2018, Darrick J. Wong wrote:
> > > 
> > > > If we /did/ replace CAP_SYS_ADMIN checking with a pile of LSM hooks,
> > > 
> > > Not sure we'd need a pile of hooks, what about just "read" and "write" 
> > > storage admin?
> > > 
> > > Or even two new capabilities along these lines, which we convert existing 
> > > CAP_SYS_ADMIN etc. to?
> > 
> > So instead of having hundreds of management ioctls under
> > CAP_SYS_ADMIN, we'd now have hundreds of non-storage ioctls under
> > CAP_SYS_ADMIN and hundreds of storage ioctls under
> > CAP_SYS_STORAGE_ADMIN?
> > 
> > Maybe I'm missing something, but I don't see how that improves the
> > situation w.r.t. locked down LSM configurations?
> 
> I'm not sure about capabilities, but having two specific LSM hooks for 
> storage admin would allow SELinux et al to explicitly control privileged 
> access to these interfaces.  Storage admin seems to be a special case of 
> its own which we want to be able to mediate as such.

Perhaps so - as a stepping stone it would allow isolation in
specific cases where no management should be allowed, but there are
cases with modern filesystems where users need access to storage
APIs.

e.g. It's entirely plausible that /home is set up as a subvolume per
user, and that subvols in a fileystem can be independently
snapshotted. Hence it would be completely acceptible to allow users
to have access to snapshot management APIs to be able to snapshot
their home directories for backup/rollback purposes.

Hence I'm not sure that black/white storage admin LSM hooks are a
solution that will end up being particularly useful to the wider
population...

Cheers,

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


Re: Leaking Path in XFS's ioctl interface(missing LSM check)

2018-10-02 Thread Dave Chinner
On Wed, Oct 03, 2018 at 05:20:31AM +1000, James Morris wrote:
> On Tue, 2 Oct 2018, Dave Chinner wrote:
> 
> > On Tue, Oct 02, 2018 at 06:08:16AM +1000, James Morris wrote:
> > > On Mon, 1 Oct 2018, Darrick J. Wong wrote:
> > > 
> > > > If we /did/ replace CAP_SYS_ADMIN checking with a pile of LSM hooks,
> > > 
> > > Not sure we'd need a pile of hooks, what about just "read" and "write" 
> > > storage admin?
> > > 
> > > Or even two new capabilities along these lines, which we convert existing 
> > > CAP_SYS_ADMIN etc. to?
> > 
> > So instead of having hundreds of management ioctls under
> > CAP_SYS_ADMIN, we'd now have hundreds of non-storage ioctls under
> > CAP_SYS_ADMIN and hundreds of storage ioctls under
> > CAP_SYS_STORAGE_ADMIN?
> > 
> > Maybe I'm missing something, but I don't see how that improves the
> > situation w.r.t. locked down LSM configurations?
> 
> I'm not sure about capabilities, but having two specific LSM hooks for 
> storage admin would allow SELinux et al to explicitly control privileged 
> access to these interfaces.  Storage admin seems to be a special case of 
> its own which we want to be able to mediate as such.

Perhaps so - as a stepping stone it would allow isolation in
specific cases where no management should be allowed, but there are
cases with modern filesystems where users need access to storage
APIs.

e.g. It's entirely plausible that /home is set up as a subvolume per
user, and that subvols in a fileystem can be independently
snapshotted. Hence it would be completely acceptible to allow users
to have access to snapshot management APIs to be able to snapshot
their home directories for backup/rollback purposes.

Hence I'm not sure that black/white storage admin LSM hooks are a
solution that will end up being particularly useful to the wider
population...

Cheers,

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


Re: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable

2018-10-02 Thread Greg KH
On Tue, Oct 02, 2018 at 03:33:11PM -0700, Roman Kiryanov wrote:
> > I don't see a "global" variable here, what are you referring to.
> >
> > This one:
> >
> > > -static DECLARE_TASKLET(goldfish_interrupt_tasklet, 
> > > goldfish_interrupt_task, 0);
> >
> > ?
> 
> Yes.
> 
> > That looks static to this file to me.
> > what am I missing here?
> 
> It has a global lifetime but it is visible only in this file. How do I
> say better, just drop the word "global"?

Yes.  It's not a global variable at all.  It's file-scope only.

What you are doing is moving the variable to be attached to the device
itself, allowing you to have multiple devices handled by the same code,
which is great.  But please document it as such.

Same goes for the other patches in this series.

thanks,

greg k-h


Re: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable

2018-10-02 Thread Greg KH
On Tue, Oct 02, 2018 at 03:33:11PM -0700, Roman Kiryanov wrote:
> > I don't see a "global" variable here, what are you referring to.
> >
> > This one:
> >
> > > -static DECLARE_TASKLET(goldfish_interrupt_tasklet, 
> > > goldfish_interrupt_task, 0);
> >
> > ?
> 
> Yes.
> 
> > That looks static to this file to me.
> > what am I missing here?
> 
> It has a global lifetime but it is visible only in this file. How do I
> say better, just drop the word "global"?

Yes.  It's not a global variable at all.  It's file-scope only.

What you are doing is moving the variable to be attached to the device
itself, allowing you to have multiple devices handled by the same code,
which is great.  But please document it as such.

Same goes for the other patches in this series.

thanks,

greg k-h


Re: [PATCH v6 2/2] spi: Introduce new driver for Qualcomm QuadSPI controller

2018-10-02 Thread Doug Anderson
Hi,

On Tue, Oct 2, 2018 at 2:48 PM Ryan Case  wrote:
> +#define RD_FIFO_STATUS 0x002c
> +#define FIFO_EMPTY BIT(11)
> +#define WR_CNTS_MSK0x7f0
> +#define WR_CNTS_SHFT   4
> +#define RDY_64BYTE BIT(3)
> +#define RDY_32BYTE BIT(2)
> +#define RDY_16BYTE BIT(1)
> +#define FIFO_RDY   BIT(0)
> +
> +#define RD_FIFO_CFG0x0028
> +#define CONTINUOUS_MODEBIT(0)

You missed the above when re-sorting.  The section for 0x0028 should
be above the section for 0x002c.

IMO there's been enough spins of this patch and it's a pretty minor
change.  Mark: maybe you'd be OK with applying the current patch and
either fixing up the sort order as you apply or letting us know to
post a followup patch?  ...or if you'd like a v7 then please yell.


> +static int __maybe_unused qcom_qspi_suspend(struct device *dev)
> +{
> +   struct spi_master *master = dev_get_drvdata(dev);
> +   int ret;
> +
> +   ret = spi_master_suspend(master);
> +   if (ret)
> +   return ret;
> +
> +   ret = pm_runtime_force_suspend(dev);
> +   if (ret)
> +   spi_master_resume(master);
> +
> +   return ret;
> +}
> +
> +static int __maybe_unused qcom_qspi_resume(struct device *dev)
> +{
> +   struct spi_master *master = dev_get_drvdata(dev);
> +   int ret;
> +
> +   ret = pm_runtime_force_resume(dev);
> +   if (ret)
> +   return ret;
> +
> +   ret = spi_master_resume(master);
> +   if (ret)
> +   pm_runtime_force_suspend(dev);
> +
> +   return ret;
> +}

As per my new understanding (now that I've been educated by Rafael)
[1] possibly the error handling here could be revamped to handle the
case where suspend() may be called again after a failed resume().  I'd
rather not block this patch based on that discussion though, so this
feels like something to address by a follow-up patch.  Thus:

Reviewed-by: Douglas Anderson 


[1] 
https://lkml.kernel.org/r/cajz5v0hsohuzvjcvcqzy_ddsypvppoabk0helsa3dpvf12l...@mail.gmail.com


Re: [PATCH] cpufreq / CPPC: Mark acpi_ids as used

2018-10-02 Thread Nick Desaulniers
On Tue, Oct 2, 2018 at 3:35 PM Nathan Chancellor
 wrote:
>
> Clang warns:
>
> drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
> is not needed and will not be emitted [-Wunneeded-internal-declaration]
> static const struct acpi_device_id cppc_acpi_ids[] = {
>^
> 1 warning generated.
>
> Mark the definition as used so that Clang understands we don't want this
> warning while not inhibiting Clang's dead code elimination from removing
> the unreferenced internal symbol when moving the data it contains to the
> globally available symbol via MODULE_DEVICE_TABLE.
>
> $ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
>  0040 R __mod_acpi__cppc_acpi_ids_device_table
>
> Suggested-by: Nick Desaulniers 
> Reviewed-by: Nick Desaulniers 
> Signed-off-by: Nathan Chancellor 
> ---
>  drivers/cpufreq/cppc_cpufreq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index 30f302149730..fd25c21cee72 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
>
>  late_initcall(cppc_cpufreq_init);
>
> -static const struct acpi_device_id cppc_acpi_ids[] = {
> +static const struct acpi_device_id cppc_acpi_ids[] __used = {
> {ACPI_PROCESSOR_DEVICE_HID, },
> {}
>  };
> --
> 2.19.0
>

LGTM, thanks Nathan.  For other reviewers,
https://lkml.org/lkml/2018/9/27/91 might provide more insight into why
this is the correct fix for this particular bug.
-- 
Thanks,
~Nick Desaulniers


Re: [PATCH v6 2/2] spi: Introduce new driver for Qualcomm QuadSPI controller

2018-10-02 Thread Doug Anderson
Hi,

On Tue, Oct 2, 2018 at 2:48 PM Ryan Case  wrote:
> +#define RD_FIFO_STATUS 0x002c
> +#define FIFO_EMPTY BIT(11)
> +#define WR_CNTS_MSK0x7f0
> +#define WR_CNTS_SHFT   4
> +#define RDY_64BYTE BIT(3)
> +#define RDY_32BYTE BIT(2)
> +#define RDY_16BYTE BIT(1)
> +#define FIFO_RDY   BIT(0)
> +
> +#define RD_FIFO_CFG0x0028
> +#define CONTINUOUS_MODEBIT(0)

You missed the above when re-sorting.  The section for 0x0028 should
be above the section for 0x002c.

IMO there's been enough spins of this patch and it's a pretty minor
change.  Mark: maybe you'd be OK with applying the current patch and
either fixing up the sort order as you apply or letting us know to
post a followup patch?  ...or if you'd like a v7 then please yell.


> +static int __maybe_unused qcom_qspi_suspend(struct device *dev)
> +{
> +   struct spi_master *master = dev_get_drvdata(dev);
> +   int ret;
> +
> +   ret = spi_master_suspend(master);
> +   if (ret)
> +   return ret;
> +
> +   ret = pm_runtime_force_suspend(dev);
> +   if (ret)
> +   spi_master_resume(master);
> +
> +   return ret;
> +}
> +
> +static int __maybe_unused qcom_qspi_resume(struct device *dev)
> +{
> +   struct spi_master *master = dev_get_drvdata(dev);
> +   int ret;
> +
> +   ret = pm_runtime_force_resume(dev);
> +   if (ret)
> +   return ret;
> +
> +   ret = spi_master_resume(master);
> +   if (ret)
> +   pm_runtime_force_suspend(dev);
> +
> +   return ret;
> +}

As per my new understanding (now that I've been educated by Rafael)
[1] possibly the error handling here could be revamped to handle the
case where suspend() may be called again after a failed resume().  I'd
rather not block this patch based on that discussion though, so this
feels like something to address by a follow-up patch.  Thus:

Reviewed-by: Douglas Anderson 


[1] 
https://lkml.kernel.org/r/cajz5v0hsohuzvjcvcqzy_ddsypvppoabk0helsa3dpvf12l...@mail.gmail.com


Re: [PATCH] cpufreq / CPPC: Mark acpi_ids as used

2018-10-02 Thread Nick Desaulniers
On Tue, Oct 2, 2018 at 3:35 PM Nathan Chancellor
 wrote:
>
> Clang warns:
>
> drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
> is not needed and will not be emitted [-Wunneeded-internal-declaration]
> static const struct acpi_device_id cppc_acpi_ids[] = {
>^
> 1 warning generated.
>
> Mark the definition as used so that Clang understands we don't want this
> warning while not inhibiting Clang's dead code elimination from removing
> the unreferenced internal symbol when moving the data it contains to the
> globally available symbol via MODULE_DEVICE_TABLE.
>
> $ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
>  0040 R __mod_acpi__cppc_acpi_ids_device_table
>
> Suggested-by: Nick Desaulniers 
> Reviewed-by: Nick Desaulniers 
> Signed-off-by: Nathan Chancellor 
> ---
>  drivers/cpufreq/cppc_cpufreq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
> index 30f302149730..fd25c21cee72 100644
> --- a/drivers/cpufreq/cppc_cpufreq.c
> +++ b/drivers/cpufreq/cppc_cpufreq.c
> @@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
>
>  late_initcall(cppc_cpufreq_init);
>
> -static const struct acpi_device_id cppc_acpi_ids[] = {
> +static const struct acpi_device_id cppc_acpi_ids[] __used = {
> {ACPI_PROCESSOR_DEVICE_HID, },
> {}
>  };
> --
> 2.19.0
>

LGTM, thanks Nathan.  For other reviewers,
https://lkml.org/lkml/2018/9/27/91 might provide more insight into why
this is the correct fix for this particular bug.
-- 
Thanks,
~Nick Desaulniers


Re: [PATCH] [v3] HID: add support for Apple Magic Trackpad 2

2018-10-02 Thread Sean O'Brien
On Mon, Oct 1, 2018 at 1:43 AM Benjamin Tissoires
 wrote:
>
> [adding Peter, for the libinput question]
>
> On Fri, Sep 21, 2018 at 1:13 AM Sean O'Brien  wrote:
> >
> > USB device
> > Vendor 05ac (Apple)
> > Device 0265 (Magic Trackpad 2)
> > Bluetooth device
> > Vendor 004c (Apple)
> > Device 0265 (Magic Trackpad 2)
> >
> > Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
> > the device in multi-touch mode.
> >
> > Signed-off-by: Claudio Mettler 
> > Signed-off-by: Marek Wyborski 
> > Signed-off-by: Sean O'Brien 
> > ---
> >
>
> a few nitpcks:
>
> >  drivers/hid/hid-ids.h|   1 +
> >  drivers/hid/hid-magicmouse.c | 149 +++
> >  2 files changed, 134 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> > index 5146ee029db4..bb0cd212c7cc 100644
> > --- a/drivers/hid/hid-ids.h
> > +++ b/drivers/hid/hid-ids.h
> > @@ -92,6 +92,7 @@
> >  #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
> >  #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
> >  #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD  0x030e
> > +#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
> >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
> >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
> >  #define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
> > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> > index b454c4386157..6a3a6c83e509 100644
> > --- a/drivers/hid/hid-magicmouse.c
> > +++ b/drivers/hid/hid-magicmouse.c
> > @@ -54,6 +54,8 @@ module_param(report_undeciphered, bool, 0644);
> >  MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch 
> > state field using a MSC_RAW event");
> >
> >  #define TRACKPAD_REPORT_ID 0x28
> > +#define TRACKPAD2_USB_REPORT_ID 0x02
> > +#define TRACKPAD2_BT_REPORT_ID 0x31
> >  #define MOUSE_REPORT_ID0x29
> >  #define DOUBLE_REPORT_ID   0xf7
> >  /* These definitions are not precise, but they're close enough.  (Bits
> > @@ -91,6 +93,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report 
> > undeciphered multi-touch state fie
> >  #define TRACKPAD_RES_Y \
> > ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
> >
> > +#define TRACKPAD2_DIMENSION_X (float)16000
> > +#define TRACKPAD2_MIN_X -3678
> > +#define TRACKPAD2_MAX_X 3934
> > +#define TRACKPAD2_RES_X \
> > +   ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 
> > 100))
> > +#define TRACKPAD2_DIMENSION_Y (float)11490
> > +#define TRACKPAD2_MIN_Y -2478
> > +#define TRACKPAD2_MAX_Y 2587
> > +#define TRACKPAD2_RES_Y \
> > +   ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 
> > 100))
> > +
> >  /**
> >   * struct magicmouse_sc - Tracks Magic Mouse-specific data.
> >   * @input: Input device through which we report events.
> > @@ -183,6 +196,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
> > *msc, int raw_id, u8 *tda
> >  {
> > struct input_dev *input = msc->input;
> > int id, x, y, size, orientation, touch_major, touch_minor, state, 
> > down;
> > +   int pressure = 0;
> >
> > if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
> > id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
> > @@ -194,6 +208,20 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
> > *msc, int raw_id, u8 *tda
> > touch_minor = tdata[4];
> > state = tdata[7] & TOUCH_STATE_MASK;
> > down = state != TOUCH_STATE_NONE;
> > +   } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) 
> > {
> > +   id = tdata[8] & 0xf;
> > +   x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
> > +   y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) >> 
> > 19);
> > +   size = tdata[6];
> > +   orientation = (tdata[8] >> 5) - 4;
> > +   touch_major = tdata[4];
> > +   touch_minor = tdata[5];
> > +   /* Add to pressure to prevent libraries such as libinput
> > +* from ignoring low pressure touches
> > +*/
> > +   pressure = tdata[7] + 30;
>
> Peter, can you have a look?
>
> To me, while adding this threshold, you are basically fooling
> userspace, and we might want to come back to the raw values at some
> point.
> If there is a userspace problem, it has to be solved in userspace.
>

I'm fine with removing the offset.  I haven't personally tested using
libinput, but the chromium OS gesture detector I've been using can
handle pressure values of 0.

> > +   state = tdata[3] & 0xC0;
> > +   down = state == 0x80;
> > } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
> > id = (tdata[7] << 2 | tdata[6] >> 6) & 0xf;
> > x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
> > @@ -215,7 +243,8 @@ static void magicmouse_emit_touch(struct 

Re: [PATCH] [v3] HID: add support for Apple Magic Trackpad 2

2018-10-02 Thread Sean O'Brien
On Mon, Oct 1, 2018 at 1:43 AM Benjamin Tissoires
 wrote:
>
> [adding Peter, for the libinput question]
>
> On Fri, Sep 21, 2018 at 1:13 AM Sean O'Brien  wrote:
> >
> > USB device
> > Vendor 05ac (Apple)
> > Device 0265 (Magic Trackpad 2)
> > Bluetooth device
> > Vendor 004c (Apple)
> > Device 0265 (Magic Trackpad 2)
> >
> > Add support for Apple Magic Trackpad 2 over USB and bluetooth, putting
> > the device in multi-touch mode.
> >
> > Signed-off-by: Claudio Mettler 
> > Signed-off-by: Marek Wyborski 
> > Signed-off-by: Sean O'Brien 
> > ---
> >
>
> a few nitpcks:
>
> >  drivers/hid/hid-ids.h|   1 +
> >  drivers/hid/hid-magicmouse.c | 149 +++
> >  2 files changed, 134 insertions(+), 16 deletions(-)
> >
> > diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> > index 5146ee029db4..bb0cd212c7cc 100644
> > --- a/drivers/hid/hid-ids.h
> > +++ b/drivers/hid/hid-ids.h
> > @@ -92,6 +92,7 @@
> >  #define USB_DEVICE_ID_APPLE_MIGHTYMOUSE0x0304
> >  #define USB_DEVICE_ID_APPLE_MAGICMOUSE 0x030d
> >  #define USB_DEVICE_ID_APPLE_MAGICTRACKPAD  0x030e
> > +#define USB_DEVICE_ID_APPLE_MAGICTRACKPAD2 0x0265
> >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ANSI  0x020e
> >  #define USB_DEVICE_ID_APPLE_FOUNTAIN_ISO   0x020f
> >  #define USB_DEVICE_ID_APPLE_GEYSER_ANSI0x0214
> > diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> > index b454c4386157..6a3a6c83e509 100644
> > --- a/drivers/hid/hid-magicmouse.c
> > +++ b/drivers/hid/hid-magicmouse.c
> > @@ -54,6 +54,8 @@ module_param(report_undeciphered, bool, 0644);
> >  MODULE_PARM_DESC(report_undeciphered, "Report undeciphered multi-touch 
> > state field using a MSC_RAW event");
> >
> >  #define TRACKPAD_REPORT_ID 0x28
> > +#define TRACKPAD2_USB_REPORT_ID 0x02
> > +#define TRACKPAD2_BT_REPORT_ID 0x31
> >  #define MOUSE_REPORT_ID0x29
> >  #define DOUBLE_REPORT_ID   0xf7
> >  /* These definitions are not precise, but they're close enough.  (Bits
> > @@ -91,6 +93,17 @@ MODULE_PARM_DESC(report_undeciphered, "Report 
> > undeciphered multi-touch state fie
> >  #define TRACKPAD_RES_Y \
> > ((TRACKPAD_MAX_Y - TRACKPAD_MIN_Y) / (TRACKPAD_DIMENSION_Y / 100))
> >
> > +#define TRACKPAD2_DIMENSION_X (float)16000
> > +#define TRACKPAD2_MIN_X -3678
> > +#define TRACKPAD2_MAX_X 3934
> > +#define TRACKPAD2_RES_X \
> > +   ((TRACKPAD2_MAX_X - TRACKPAD2_MIN_X) / (TRACKPAD2_DIMENSION_X / 
> > 100))
> > +#define TRACKPAD2_DIMENSION_Y (float)11490
> > +#define TRACKPAD2_MIN_Y -2478
> > +#define TRACKPAD2_MAX_Y 2587
> > +#define TRACKPAD2_RES_Y \
> > +   ((TRACKPAD2_MAX_Y - TRACKPAD2_MIN_Y) / (TRACKPAD2_DIMENSION_Y / 
> > 100))
> > +
> >  /**
> >   * struct magicmouse_sc - Tracks Magic Mouse-specific data.
> >   * @input: Input device through which we report events.
> > @@ -183,6 +196,7 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
> > *msc, int raw_id, u8 *tda
> >  {
> > struct input_dev *input = msc->input;
> > int id, x, y, size, orientation, touch_major, touch_minor, state, 
> > down;
> > +   int pressure = 0;
> >
> > if (input->id.product == USB_DEVICE_ID_APPLE_MAGICMOUSE) {
> > id = (tdata[6] << 2 | tdata[5] >> 6) & 0xf;
> > @@ -194,6 +208,20 @@ static void magicmouse_emit_touch(struct magicmouse_sc 
> > *msc, int raw_id, u8 *tda
> > touch_minor = tdata[4];
> > state = tdata[7] & TOUCH_STATE_MASK;
> > down = state != TOUCH_STATE_NONE;
> > +   } else if (input->id.product == USB_DEVICE_ID_APPLE_MAGICTRACKPAD2) 
> > {
> > +   id = tdata[8] & 0xf;
> > +   x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
> > +   y = -((tdata[3] << 30 | tdata[2] << 22 | tdata[1] << 14) >> 
> > 19);
> > +   size = tdata[6];
> > +   orientation = (tdata[8] >> 5) - 4;
> > +   touch_major = tdata[4];
> > +   touch_minor = tdata[5];
> > +   /* Add to pressure to prevent libraries such as libinput
> > +* from ignoring low pressure touches
> > +*/
> > +   pressure = tdata[7] + 30;
>
> Peter, can you have a look?
>
> To me, while adding this threshold, you are basically fooling
> userspace, and we might want to come back to the raw values at some
> point.
> If there is a userspace problem, it has to be solved in userspace.
>

I'm fine with removing the offset.  I haven't personally tested using
libinput, but the chromium OS gesture detector I've been using can
handle pressure values of 0.

> > +   state = tdata[3] & 0xC0;
> > +   down = state == 0x80;
> > } else { /* USB_DEVICE_ID_APPLE_MAGICTRACKPAD */
> > id = (tdata[7] << 2 | tdata[6] >> 6) & 0xf;
> > x = (tdata[1] << 27 | tdata[0] << 19) >> 19;
> > @@ -215,7 +243,8 @@ static void magicmouse_emit_touch(struct 

[PATCH] cpufreq / CPPC: Mark acpi_ids as used

2018-10-02 Thread Nathan Chancellor
Clang warns:

drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct acpi_device_id cppc_acpi_ids[] = {
   ^
1 warning generated.

Mark the definition as used so that Clang understands we don't want this
warning while not inhibiting Clang's dead code elimination from removing
the unreferenced internal symbol when moving the data it contains to the
globally available symbol via MODULE_DEVICE_TABLE.

$ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
 0040 R __mod_acpi__cppc_acpi_ids_device_table

Suggested-by: Nick Desaulniers 
Reviewed-by: Nick Desaulniers 
Signed-off-by: Nathan Chancellor 
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 30f302149730..fd25c21cee72 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
 
 late_initcall(cppc_cpufreq_init);
 
-static const struct acpi_device_id cppc_acpi_ids[] = {
+static const struct acpi_device_id cppc_acpi_ids[] __used = {
{ACPI_PROCESSOR_DEVICE_HID, },
{}
 };
-- 
2.19.0



[PATCH] cpufreq / CPPC: Mark acpi_ids as used

2018-10-02 Thread Nathan Chancellor
Clang warns:

drivers/cpufreq/cppc_cpufreq.c:431:36: warning: variable 'cppc_acpi_ids'
is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct acpi_device_id cppc_acpi_ids[] = {
   ^
1 warning generated.

Mark the definition as used so that Clang understands we don't want this
warning while not inhibiting Clang's dead code elimination from removing
the unreferenced internal symbol when moving the data it contains to the
globally available symbol via MODULE_DEVICE_TABLE.

$ nm -S drivers/cpufreq/cppc_cpufreq.o | grep acpi | tail -1
 0040 R __mod_acpi__cppc_acpi_ids_device_table

Suggested-by: Nick Desaulniers 
Reviewed-by: Nick Desaulniers 
Signed-off-by: Nathan Chancellor 
---
 drivers/cpufreq/cppc_cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index 30f302149730..fd25c21cee72 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -428,7 +428,7 @@ MODULE_LICENSE("GPL");
 
 late_initcall(cppc_cpufreq_init);
 
-static const struct acpi_device_id cppc_acpi_ids[] = {
+static const struct acpi_device_id cppc_acpi_ids[] __used = {
{ACPI_PROCESSOR_DEVICE_HID, },
{}
 };
-- 
2.19.0



Re: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable

2018-10-02 Thread Roman Kiryanov
> I don't see a "global" variable here, what are you referring to.
>
> This one:
>
> > -static DECLARE_TASKLET(goldfish_interrupt_tasklet, 
> > goldfish_interrupt_task, 0);
>
> ?

Yes.

> That looks static to this file to me.
> what am I missing here?

It has a global lifetime but it is visible only in this file. How do I
say better, just drop the word "global"?


Re: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable

2018-10-02 Thread Roman Kiryanov
> I don't see a "global" variable here, what are you referring to.
>
> This one:
>
> > -static DECLARE_TASKLET(goldfish_interrupt_tasklet, 
> > goldfish_interrupt_task, 0);
>
> ?

Yes.

> That looks static to this file to me.
> what am I missing here?

It has a global lifetime but it is visible only in this file. How do I
say better, just drop the word "global"?


Re: [PATCH] fat: Expand a slightly out-of-date comment

2018-10-02 Thread Andrew Morton
On Fri, 28 Sep 2018 14:49:47 -0500 Mihir Mehta  wrote:

> The file namei.c seems to have been renamed to namei_msdos.c, so I
> decided to update the comment with the correct name, and expand it a bit
> to tell the reader what to look for.

Please send us a Signed-off-by: for this patch, as per
Documentation/process/submitting-patches.rst, section 11.

Thanks.


Re: [PATCH] fat: Expand a slightly out-of-date comment

2018-10-02 Thread Andrew Morton
On Fri, 28 Sep 2018 14:49:47 -0500 Mihir Mehta  wrote:

> The file namei.c seems to have been renamed to namei_msdos.c, so I
> decided to update the comment with the correct name, and expand it a bit
> to tell the reader what to look for.

Please send us a Signed-off-by: for this patch, as per
Documentation/process/submitting-patches.rst, section 11.

Thanks.


Re: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable

2018-10-02 Thread Greg KH
On Tue, Oct 02, 2018 at 03:18:49PM -0700, r...@google.com wrote:
> From: Roman Kiryanov 
> 
> This is a series of patches to remove mutable global variables
> to introduce another version of the pipe driver for the older
> host interface. I don't want to have two driver states where only
> one is used.

I don't see a "global" variable here, what are you referring to.

This one:

> -static DECLARE_TASKLET(goldfish_interrupt_tasklet, goldfish_interrupt_task, 
> 0);

?

That looks static to this file to me.

what am I missing here?

greg k-h


Re: [PATCH 01/15] platform: goldfish: pipe: Remove the goldfish_interrupt_tasklet global variable

2018-10-02 Thread Greg KH
On Tue, Oct 02, 2018 at 03:18:49PM -0700, r...@google.com wrote:
> From: Roman Kiryanov 
> 
> This is a series of patches to remove mutable global variables
> to introduce another version of the pipe driver for the older
> host interface. I don't want to have two driver states where only
> one is used.

I don't see a "global" variable here, what are you referring to.

This one:

> -static DECLARE_TASKLET(goldfish_interrupt_tasklet, goldfish_interrupt_task, 
> 0);

?

That looks static to this file to me.

what am I missing here?

greg k-h


Re: [PATCH] eeprom: New ee1004 driver for DDR4 memory

2018-10-02 Thread Greg Kroah-Hartman
On Tue, Oct 02, 2018 at 11:43:46AM +0200, Jean Delvare wrote:
> On Mon, 26 Feb 2018 14:40:42 +0100, Bartosz Golaszewski wrote:
> > 2018-02-26 10:20 GMT+01:00 Jean Delvare :
> > > The EEPROMs which hold the SPD data on DDR4 memory modules are no
> > > longer standard AT24C02-compatible EEPROMs. They are 512-byte EEPROMs
> > > which use only 1 I2C address for data access. You need to switch
> > > between the lower page and the upper page of data by sending commands
> > > on the SMBus.
> > >
> > > Signed-off-by: Jean Delvare 
> > > ---
> > >  drivers/misc/eeprom/Kconfig  |   11 +
> > >  drivers/misc/eeprom/Makefile |1
> > >  drivers/misc/eeprom/ee1004.c |  281 
> > > +++
> > >  3 files changed, 293 insertions(+)
> > 
> > is there any reason not to use regmap as is done currently in at24? It
> > would spare you a lot of code.
> 
> As it turns out, I don't have the time to look into this. The driver is
> not exactly big, it is functional, and I would hate if someone else
> would duplicate the work just because my driver is not upstream.
> 
> So, Greg, can we just get the driver in the kernel tree as is, and if
> anyone really cares about it using regmap, that person will convert the
> driver later?

Fine with me, but someone needs to resend it as it is no longer in my
patch queue at all...

thanks,

greg k-h


Re: [PATCH] eeprom: New ee1004 driver for DDR4 memory

2018-10-02 Thread Greg Kroah-Hartman
On Tue, Oct 02, 2018 at 11:43:46AM +0200, Jean Delvare wrote:
> On Mon, 26 Feb 2018 14:40:42 +0100, Bartosz Golaszewski wrote:
> > 2018-02-26 10:20 GMT+01:00 Jean Delvare :
> > > The EEPROMs which hold the SPD data on DDR4 memory modules are no
> > > longer standard AT24C02-compatible EEPROMs. They are 512-byte EEPROMs
> > > which use only 1 I2C address for data access. You need to switch
> > > between the lower page and the upper page of data by sending commands
> > > on the SMBus.
> > >
> > > Signed-off-by: Jean Delvare 
> > > ---
> > >  drivers/misc/eeprom/Kconfig  |   11 +
> > >  drivers/misc/eeprom/Makefile |1
> > >  drivers/misc/eeprom/ee1004.c |  281 
> > > +++
> > >  3 files changed, 293 insertions(+)
> > 
> > is there any reason not to use regmap as is done currently in at24? It
> > would spare you a lot of code.
> 
> As it turns out, I don't have the time to look into this. The driver is
> not exactly big, it is functional, and I would hate if someone else
> would duplicate the work just because my driver is not upstream.
> 
> So, Greg, can we just get the driver in the kernel tree as is, and if
> anyone really cares about it using regmap, that person will convert the
> driver later?

Fine with me, but someone needs to resend it as it is no longer in my
patch queue at all...

thanks,

greg k-h


Re: [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled

2018-10-02 Thread Greg KH
On Tue, Oct 02, 2018 at 01:02:46PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski 
> 
> The following warning is produced when building nvmem core if
> CONFIG_OF is disabled:
> 
> drivers/nvmem/core.c:496:1: warning: 'nvmem_find_cell_by_index' defined but 
> not used [-Wunused-function]
>  nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
>  ^~~~
> 
> This is caused by the fact that the only caller of this routine is
> under an ifdef depending on this option. Fix it by adding a relevant
> ifdef to the function in question as well.
> 
> Signed-off-by: Bartosz Golaszewski 

No "reported-by:" lines on this and the other patch?

Not nice :(


Re: [PATCH] nvmem: only build nvmem_find_cell_by_index() if OF is enabled

2018-10-02 Thread Greg KH
On Tue, Oct 02, 2018 at 01:02:46PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski 
> 
> The following warning is produced when building nvmem core if
> CONFIG_OF is disabled:
> 
> drivers/nvmem/core.c:496:1: warning: 'nvmem_find_cell_by_index' defined but 
> not used [-Wunused-function]
>  nvmem_find_cell_by_index(struct nvmem_device *nvmem, int index)
>  ^~~~
> 
> This is caused by the fact that the only caller of this routine is
> under an ifdef depending on this option. Fix it by adding a relevant
> ifdef to the function in question as well.
> 
> Signed-off-by: Bartosz Golaszewski 

No "reported-by:" lines on this and the other patch?

Not nice :(


Re: [GIT PULL] parisc fixes for kernel v4.19

2018-10-02 Thread Greg Kroah-Hartman
On Tue, Oct 02, 2018 at 11:46:11PM +0200, Helge Deller wrote:
> Hi Greg,
> 
> On 02.10.2018 23:16, Greg Kroah-Hartman wrote:
> > On Tue, Oct 02, 2018 at 11:02:13PM +0200, Helge Deller wrote:
> >> please pull a last set of fixes for the parisc architecture for kernel 
> >> 4.19 from:
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git 
> >> parisc-4.19-3
> >>
> >> The major change is for parisc64 to use a 64-bit suseconds_t type to
> >> match what glibc expects for 64-bit userspace. It's an ABI change, but
> >> since we don't have a 64-bit userspace on parisc yet, it won't introduce
> >> a breakage.
> > 
> > Isn't it a bit "late" in the release cycle for such a change?  Why not
> > do this on the -rc1 release?
> 
> I've tagged it for stable release.
> So, it can go in now, or just wait until -rc1 and go in later.

Why is a major API change a viable stable change?  What bugfix does it
provide?

> >> Other than that we simply drop unused code and outdated gcc version
> >> checks.
> > 
> > Why are those needed now?
> 
> The patch in there which is by me changes one line simply cleans up a patch 
> which
> went in during the 4.19 merge cycle. So it would be nice to have it
> added now before v4.19 gets released.
> The other two patches are trivial and just remove dead code.
> I rate them all as non-critical, but nice-to-have-in-v4.19. 
> 
> If you disagree I'm absolutely fine to wait with all of them 
> for the next merge window.

Normally I only let "bugfixes" into my trees at this point in time.
cleanups always wait for the next -rc1 merge window as that's what it is
there for.  So I'd recommend waiting as well.

I'm more "worried" about the api change listed above.

thanks,

greg k-h


Re: [GIT PULL] parisc fixes for kernel v4.19

2018-10-02 Thread Greg Kroah-Hartman
On Tue, Oct 02, 2018 at 11:46:11PM +0200, Helge Deller wrote:
> Hi Greg,
> 
> On 02.10.2018 23:16, Greg Kroah-Hartman wrote:
> > On Tue, Oct 02, 2018 at 11:02:13PM +0200, Helge Deller wrote:
> >> please pull a last set of fixes for the parisc architecture for kernel 
> >> 4.19 from:
> >>
> >>   git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux.git 
> >> parisc-4.19-3
> >>
> >> The major change is for parisc64 to use a 64-bit suseconds_t type to
> >> match what glibc expects for 64-bit userspace. It's an ABI change, but
> >> since we don't have a 64-bit userspace on parisc yet, it won't introduce
> >> a breakage.
> > 
> > Isn't it a bit "late" in the release cycle for such a change?  Why not
> > do this on the -rc1 release?
> 
> I've tagged it for stable release.
> So, it can go in now, or just wait until -rc1 and go in later.

Why is a major API change a viable stable change?  What bugfix does it
provide?

> >> Other than that we simply drop unused code and outdated gcc version
> >> checks.
> > 
> > Why are those needed now?
> 
> The patch in there which is by me changes one line simply cleans up a patch 
> which
> went in during the 4.19 merge cycle. So it would be nice to have it
> added now before v4.19 gets released.
> The other two patches are trivial and just remove dead code.
> I rate them all as non-critical, but nice-to-have-in-v4.19. 
> 
> If you disagree I'm absolutely fine to wait with all of them 
> for the next merge window.

Normally I only let "bugfixes" into my trees at this point in time.
cleanups always wait for the next -rc1 merge window as that's what it is
there for.  So I'd recommend waiting as well.

I'm more "worried" about the api change listed above.

thanks,

greg k-h


[PATCH 14/15] platform: goldfish: pipe: Rename PIPE_REG to PIPE_V2_REG

2018-10-02 Thread rkir
From: Roman Kiryanov 

PIPE_V1_REG will be introduced later for v1 support.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/goldfish_pipe.c  |  4 ++--
 drivers/platform/goldfish/goldfish_pipe_qemu.h | 18 +-
 drivers/platform/goldfish/goldfish_pipe_v2.c   | 16 
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 7b0920e962eb..353f7ce94aa7 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -81,8 +81,8 @@ static int goldfish_pipe_probe(struct platform_device *pdev)
 *  reading device version back: this allows the host implementation to
 *  detect the old driver (if there was no version write before read).
 */
-   writel(PIPE_DRIVER_VERSION, base + PIPE_REG_VERSION);
-   version = readl(base + PIPE_REG_VERSION);
+   writel(PIPE_DRIVER_VERSION, base + PIPE_V2_REG_VERSION);
+   version = readl(base + PIPE_V2_REG_VERSION);
 
if (WARN_ON(version < PIPE_CURRENT_DEVICE_VERSION))
return -EINVAL;
diff --git a/drivers/platform/goldfish/goldfish_pipe_qemu.h 
b/drivers/platform/goldfish/goldfish_pipe_qemu.h
index b4d78c108afd..24b02710769f 100644
--- a/drivers/platform/goldfish/goldfish_pipe_qemu.h
+++ b/drivers/platform/goldfish/goldfish_pipe_qemu.h
@@ -62,19 +62,19 @@ enum PipeFlagsBits {
BIT_WAKE_ON_READ   = 2,  /* want to be woken on reads */
 };
 
-enum PipeRegs {
-   PIPE_REG_CMD = 0,
+enum PipeV2Regs {
+   PIPE_V2_REG_CMD = 0,
 
-   PIPE_REG_SIGNAL_BUFFER_HIGH = 4,
-   PIPE_REG_SIGNAL_BUFFER = 8,
-   PIPE_REG_SIGNAL_BUFFER_COUNT = 12,
+   PIPE_V2_REG_SIGNAL_BUFFER_HIGH = 4,
+   PIPE_V2_REG_SIGNAL_BUFFER = 8,
+   PIPE_V2_REG_SIGNAL_BUFFER_COUNT = 12,
 
-   PIPE_REG_OPEN_BUFFER_HIGH = 20,
-   PIPE_REG_OPEN_BUFFER = 24,
+   PIPE_V2_REG_OPEN_BUFFER_HIGH = 20,
+   PIPE_V2_REG_OPEN_BUFFER = 24,
 
-   PIPE_REG_VERSION = 36,
+   PIPE_V2_REG_VERSION = 36,
 
-   PIPE_REG_GET_SIGNALLED = 48,
+   PIPE_V2_REG_GET_SIGNALLED = 48,
 };
 
 enum PipeCmdCode {
diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c 
b/drivers/platform/goldfish/goldfish_pipe_v2.c
index 0e2a62322477..c99317548128 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -197,7 +197,7 @@ static int goldfish_pipe_cmd_locked(struct goldfish_pipe 
*pipe,
pipe->command_buffer->cmd = cmd;
/* failure by default */
pipe->command_buffer->status = PIPE_ERROR_INVAL;
-   writel(pipe->id, pipe->dev->base + PIPE_REG_CMD);
+   writel(pipe->id, pipe->dev->base + PIPE_V2_REG_CMD);
return pipe->command_buffer->status;
 }
 
@@ -214,7 +214,7 @@ static int goldfish_pipe_cmd(struct goldfish_pipe *pipe, 
enum PipeCmdCode cmd)
 
 /*
  * This function converts an error code returned by the emulator through
- * the PIPE_REG_STATUS i/o register into a valid negative errno value.
+ * the PIPE_V2_REG_STATUS i/o register into a valid negative errno value.
  */
 static int goldfish_pipe_error_convert(int status)
 {
@@ -611,7 +611,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void 
*dev_id)
/* Request the signalled pipes from the device */
spin_lock_irqsave(>lock, flags);
 
-   count = readl(dev->base + PIPE_REG_GET_SIGNALLED);
+   count = readl(dev->base + PIPE_V2_REG_GET_SIGNALLED);
if (count == 0) {
spin_unlock_irqrestore(>lock, flags);
return IRQ_NONE;
@@ -847,15 +847,15 @@ int goldfish_pipe_device_v2_init(struct platform_device 
*pdev,
 
/* Send the buffer addresses to the host */
write_pa_addr(>buffers->signalled_pipe_buffers,
- dev->base + PIPE_REG_SIGNAL_BUFFER,
- dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH);
+ dev->base + PIPE_V2_REG_SIGNAL_BUFFER,
+ dev->base + PIPE_V2_REG_SIGNAL_BUFFER_HIGH);
 
writel(MAX_SIGNALLED_PIPES,
-  dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT);
+  dev->base + PIPE_V2_REG_SIGNAL_BUFFER_COUNT);
 
write_pa_addr(>buffers->open_command_params,
- dev->base + PIPE_REG_OPEN_BUFFER,
- dev->base + PIPE_REG_OPEN_BUFFER_HIGH);
+ dev->base + PIPE_V2_REG_OPEN_BUFFER,
+ dev->base + PIPE_V2_REG_OPEN_BUFFER_HIGH);
 
platform_set_drvdata(pdev, dev);
return 0;
-- 
2.19.0.605.g01d371f741-goog



[PATCH 14/15] platform: goldfish: pipe: Rename PIPE_REG to PIPE_V2_REG

2018-10-02 Thread rkir
From: Roman Kiryanov 

PIPE_V1_REG will be introduced later for v1 support.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/goldfish_pipe.c  |  4 ++--
 drivers/platform/goldfish/goldfish_pipe_qemu.h | 18 +-
 drivers/platform/goldfish/goldfish_pipe_v2.c   | 16 
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 7b0920e962eb..353f7ce94aa7 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -81,8 +81,8 @@ static int goldfish_pipe_probe(struct platform_device *pdev)
 *  reading device version back: this allows the host implementation to
 *  detect the old driver (if there was no version write before read).
 */
-   writel(PIPE_DRIVER_VERSION, base + PIPE_REG_VERSION);
-   version = readl(base + PIPE_REG_VERSION);
+   writel(PIPE_DRIVER_VERSION, base + PIPE_V2_REG_VERSION);
+   version = readl(base + PIPE_V2_REG_VERSION);
 
if (WARN_ON(version < PIPE_CURRENT_DEVICE_VERSION))
return -EINVAL;
diff --git a/drivers/platform/goldfish/goldfish_pipe_qemu.h 
b/drivers/platform/goldfish/goldfish_pipe_qemu.h
index b4d78c108afd..24b02710769f 100644
--- a/drivers/platform/goldfish/goldfish_pipe_qemu.h
+++ b/drivers/platform/goldfish/goldfish_pipe_qemu.h
@@ -62,19 +62,19 @@ enum PipeFlagsBits {
BIT_WAKE_ON_READ   = 2,  /* want to be woken on reads */
 };
 
-enum PipeRegs {
-   PIPE_REG_CMD = 0,
+enum PipeV2Regs {
+   PIPE_V2_REG_CMD = 0,
 
-   PIPE_REG_SIGNAL_BUFFER_HIGH = 4,
-   PIPE_REG_SIGNAL_BUFFER = 8,
-   PIPE_REG_SIGNAL_BUFFER_COUNT = 12,
+   PIPE_V2_REG_SIGNAL_BUFFER_HIGH = 4,
+   PIPE_V2_REG_SIGNAL_BUFFER = 8,
+   PIPE_V2_REG_SIGNAL_BUFFER_COUNT = 12,
 
-   PIPE_REG_OPEN_BUFFER_HIGH = 20,
-   PIPE_REG_OPEN_BUFFER = 24,
+   PIPE_V2_REG_OPEN_BUFFER_HIGH = 20,
+   PIPE_V2_REG_OPEN_BUFFER = 24,
 
-   PIPE_REG_VERSION = 36,
+   PIPE_V2_REG_VERSION = 36,
 
-   PIPE_REG_GET_SIGNALLED = 48,
+   PIPE_V2_REG_GET_SIGNALLED = 48,
 };
 
 enum PipeCmdCode {
diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c 
b/drivers/platform/goldfish/goldfish_pipe_v2.c
index 0e2a62322477..c99317548128 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -197,7 +197,7 @@ static int goldfish_pipe_cmd_locked(struct goldfish_pipe 
*pipe,
pipe->command_buffer->cmd = cmd;
/* failure by default */
pipe->command_buffer->status = PIPE_ERROR_INVAL;
-   writel(pipe->id, pipe->dev->base + PIPE_REG_CMD);
+   writel(pipe->id, pipe->dev->base + PIPE_V2_REG_CMD);
return pipe->command_buffer->status;
 }
 
@@ -214,7 +214,7 @@ static int goldfish_pipe_cmd(struct goldfish_pipe *pipe, 
enum PipeCmdCode cmd)
 
 /*
  * This function converts an error code returned by the emulator through
- * the PIPE_REG_STATUS i/o register into a valid negative errno value.
+ * the PIPE_V2_REG_STATUS i/o register into a valid negative errno value.
  */
 static int goldfish_pipe_error_convert(int status)
 {
@@ -611,7 +611,7 @@ static irqreturn_t goldfish_pipe_interrupt(int irq, void 
*dev_id)
/* Request the signalled pipes from the device */
spin_lock_irqsave(>lock, flags);
 
-   count = readl(dev->base + PIPE_REG_GET_SIGNALLED);
+   count = readl(dev->base + PIPE_V2_REG_GET_SIGNALLED);
if (count == 0) {
spin_unlock_irqrestore(>lock, flags);
return IRQ_NONE;
@@ -847,15 +847,15 @@ int goldfish_pipe_device_v2_init(struct platform_device 
*pdev,
 
/* Send the buffer addresses to the host */
write_pa_addr(>buffers->signalled_pipe_buffers,
- dev->base + PIPE_REG_SIGNAL_BUFFER,
- dev->base + PIPE_REG_SIGNAL_BUFFER_HIGH);
+ dev->base + PIPE_V2_REG_SIGNAL_BUFFER,
+ dev->base + PIPE_V2_REG_SIGNAL_BUFFER_HIGH);
 
writel(MAX_SIGNALLED_PIPES,
-  dev->base + PIPE_REG_SIGNAL_BUFFER_COUNT);
+  dev->base + PIPE_V2_REG_SIGNAL_BUFFER_COUNT);
 
write_pa_addr(>buffers->open_command_params,
- dev->base + PIPE_REG_OPEN_BUFFER,
- dev->base + PIPE_REG_OPEN_BUFFER_HIGH);
+ dev->base + PIPE_V2_REG_OPEN_BUFFER,
+ dev->base + PIPE_V2_REG_OPEN_BUFFER_HIGH);
 
platform_set_drvdata(pdev, dev);
return 0;
-- 
2.19.0.605.g01d371f741-goog



[PATCH 15/15] platform: goldfish: pipe: Add the goldfish_pipe_v1 driver

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is the v1 goldfish pipe driver.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/Makefile|   2 +-
 drivers/platform/goldfish/goldfish_pipe.c |   9 +-
 .../platform/goldfish/goldfish_pipe_qemu.h|  27 +
 drivers/platform/goldfish/goldfish_pipe_v1.c  | 632 ++
 drivers/platform/goldfish/goldfish_pipe_v1.h  |  24 +
 5 files changed, 689 insertions(+), 5 deletions(-)
 create mode 100644 drivers/platform/goldfish/goldfish_pipe_v1.c
 create mode 100644 drivers/platform/goldfish/goldfish_pipe_v1.h

diff --git a/drivers/platform/goldfish/Makefile 
b/drivers/platform/goldfish/Makefile
index 016769e003d8..3fb7427b9dd8 100644
--- a/drivers/platform/goldfish/Makefile
+++ b/drivers/platform/goldfish/Makefile
@@ -2,4 +2,4 @@
 # Makefile for Goldfish platform specific drivers
 #
 obj-$(CONFIG_GOLDFISH_PIPE)+= goldfish_pipe_all.o
-goldfish_pipe_all-objs := goldfish_pipe.o goldfish_pipe_v2.o
+goldfish_pipe_all-objs := goldfish_pipe.o goldfish_pipe_v1.o goldfish_pipe_v2.o
diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 353f7ce94aa7..05a67895cc06 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -39,6 +39,7 @@
 #include 
 #include "goldfish_pipe_qemu.h"
 #include "goldfish_pipe.h"
+#include "goldfish_pipe_v1.h"
 #include "goldfish_pipe_v2.h"
 
 /*
@@ -84,10 +85,10 @@ static int goldfish_pipe_probe(struct platform_device *pdev)
writel(PIPE_DRIVER_VERSION, base + PIPE_V2_REG_VERSION);
version = readl(base + PIPE_V2_REG_VERSION);
 
-   if (WARN_ON(version < PIPE_CURRENT_DEVICE_VERSION))
-   return -EINVAL;
-
-   return goldfish_pipe_device_v2_init(pdev, base, irq);
+   if (version < PIPE_CURRENT_DEVICE_VERSION)
+   return goldfish_pipe_device_v1_init(pdev, base, irq);
+   else
+   return goldfish_pipe_device_v2_init(pdev, base, irq);
 }
 
 static int goldfish_pipe_remove(struct platform_device *pdev)
diff --git a/drivers/platform/goldfish/goldfish_pipe_qemu.h 
b/drivers/platform/goldfish/goldfish_pipe_qemu.h
index 24b02710769f..9a8275f3583d 100644
--- a/drivers/platform/goldfish/goldfish_pipe_qemu.h
+++ b/drivers/platform/goldfish/goldfish_pipe_qemu.h
@@ -62,6 +62,33 @@ enum PipeFlagsBits {
BIT_WAKE_ON_READ   = 2,  /* want to be woken on reads */
 };
 
+enum PipeV1Regs {
+   /* write: value = command */
+   PIPE_V1_REG_COMMAND = 0x00,
+   /* read */
+   PIPE_V1_REG_STATUS  = 0x04,
+   /* read/write: channel id */
+   PIPE_V1_REG_CHANNEL = 0x08,
+   /* read/write: channel id */
+   PIPE_V1_REG_CHANNEL_HIGH= 0x30,
+   /* read/write: buffer size */
+   PIPE_V1_REG_SIZE= 0x0C,
+   /* write: physical address */
+   PIPE_V1_REG_ADDRESS = 0x10,
+   /* write: physical address */
+   PIPE_V1_REG_ADDRESS_HIGH= 0x34,
+   /* read: wake flags */
+   PIPE_V1_REG_WAKES   = 0x14,
+   /* read/write: batch data address */
+   PIPE_V1_REG_PARAMS_ADDR_LOW = 0x18,
+   /* read/write: batch data address */
+   PIPE_V1_REG_PARAMS_ADDR_HIGH= 0x1C,
+   /* write: batch access */
+   PIPE_V1_REG_ACCESS_PARAMS   = 0x20,
+   /* read: device version */
+   PIPE_V1_REG_VERSION = 0x24,
+};
+
 enum PipeV2Regs {
PIPE_V2_REG_CMD = 0,
 
diff --git a/drivers/platform/goldfish/goldfish_pipe_v1.c 
b/drivers/platform/goldfish/goldfish_pipe_v1.c
new file mode 100644
index ..6e603204dd62
--- /dev/null
+++ b/drivers/platform/goldfish/goldfish_pipe_v1.c
@@ -0,0 +1,632 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2011 Google, Inc.
+ * Copyright (C) 2012 Intel, Inc.
+ * Copyright (C) 2013 Intel, Inc.
+ * Copyright (C) 2014 Linaro Limited
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/* This source file contains the implementation of the legacy version of
+ * a goldfish pipe device driver. See goldfish_pipe_v2.c for the current
+ * version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "goldfish_pipe_qemu.h"
+#include "goldfish_pipe.h"
+
+#define MAX_PAGES_TO_GRAB 32
+
+/* A value that will not be set by qemu emulator */
+#define INITIAL_BATCH_RESULT (0xdeadbeaf)
+
+struct goldfish_pipe_dev;
+
+/* This data type 

[PATCH 15/15] platform: goldfish: pipe: Add the goldfish_pipe_v1 driver

2018-10-02 Thread rkir
From: Roman Kiryanov 

This is the v1 goldfish pipe driver.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/Makefile|   2 +-
 drivers/platform/goldfish/goldfish_pipe.c |   9 +-
 .../platform/goldfish/goldfish_pipe_qemu.h|  27 +
 drivers/platform/goldfish/goldfish_pipe_v1.c  | 632 ++
 drivers/platform/goldfish/goldfish_pipe_v1.h  |  24 +
 5 files changed, 689 insertions(+), 5 deletions(-)
 create mode 100644 drivers/platform/goldfish/goldfish_pipe_v1.c
 create mode 100644 drivers/platform/goldfish/goldfish_pipe_v1.h

diff --git a/drivers/platform/goldfish/Makefile 
b/drivers/platform/goldfish/Makefile
index 016769e003d8..3fb7427b9dd8 100644
--- a/drivers/platform/goldfish/Makefile
+++ b/drivers/platform/goldfish/Makefile
@@ -2,4 +2,4 @@
 # Makefile for Goldfish platform specific drivers
 #
 obj-$(CONFIG_GOLDFISH_PIPE)+= goldfish_pipe_all.o
-goldfish_pipe_all-objs := goldfish_pipe.o goldfish_pipe_v2.o
+goldfish_pipe_all-objs := goldfish_pipe.o goldfish_pipe_v1.o goldfish_pipe_v2.o
diff --git a/drivers/platform/goldfish/goldfish_pipe.c 
b/drivers/platform/goldfish/goldfish_pipe.c
index 353f7ce94aa7..05a67895cc06 100644
--- a/drivers/platform/goldfish/goldfish_pipe.c
+++ b/drivers/platform/goldfish/goldfish_pipe.c
@@ -39,6 +39,7 @@
 #include 
 #include "goldfish_pipe_qemu.h"
 #include "goldfish_pipe.h"
+#include "goldfish_pipe_v1.h"
 #include "goldfish_pipe_v2.h"
 
 /*
@@ -84,10 +85,10 @@ static int goldfish_pipe_probe(struct platform_device *pdev)
writel(PIPE_DRIVER_VERSION, base + PIPE_V2_REG_VERSION);
version = readl(base + PIPE_V2_REG_VERSION);
 
-   if (WARN_ON(version < PIPE_CURRENT_DEVICE_VERSION))
-   return -EINVAL;
-
-   return goldfish_pipe_device_v2_init(pdev, base, irq);
+   if (version < PIPE_CURRENT_DEVICE_VERSION)
+   return goldfish_pipe_device_v1_init(pdev, base, irq);
+   else
+   return goldfish_pipe_device_v2_init(pdev, base, irq);
 }
 
 static int goldfish_pipe_remove(struct platform_device *pdev)
diff --git a/drivers/platform/goldfish/goldfish_pipe_qemu.h 
b/drivers/platform/goldfish/goldfish_pipe_qemu.h
index 24b02710769f..9a8275f3583d 100644
--- a/drivers/platform/goldfish/goldfish_pipe_qemu.h
+++ b/drivers/platform/goldfish/goldfish_pipe_qemu.h
@@ -62,6 +62,33 @@ enum PipeFlagsBits {
BIT_WAKE_ON_READ   = 2,  /* want to be woken on reads */
 };
 
+enum PipeV1Regs {
+   /* write: value = command */
+   PIPE_V1_REG_COMMAND = 0x00,
+   /* read */
+   PIPE_V1_REG_STATUS  = 0x04,
+   /* read/write: channel id */
+   PIPE_V1_REG_CHANNEL = 0x08,
+   /* read/write: channel id */
+   PIPE_V1_REG_CHANNEL_HIGH= 0x30,
+   /* read/write: buffer size */
+   PIPE_V1_REG_SIZE= 0x0C,
+   /* write: physical address */
+   PIPE_V1_REG_ADDRESS = 0x10,
+   /* write: physical address */
+   PIPE_V1_REG_ADDRESS_HIGH= 0x34,
+   /* read: wake flags */
+   PIPE_V1_REG_WAKES   = 0x14,
+   /* read/write: batch data address */
+   PIPE_V1_REG_PARAMS_ADDR_LOW = 0x18,
+   /* read/write: batch data address */
+   PIPE_V1_REG_PARAMS_ADDR_HIGH= 0x1C,
+   /* write: batch access */
+   PIPE_V1_REG_ACCESS_PARAMS   = 0x20,
+   /* read: device version */
+   PIPE_V1_REG_VERSION = 0x24,
+};
+
 enum PipeV2Regs {
PIPE_V2_REG_CMD = 0,
 
diff --git a/drivers/platform/goldfish/goldfish_pipe_v1.c 
b/drivers/platform/goldfish/goldfish_pipe_v1.c
new file mode 100644
index ..6e603204dd62
--- /dev/null
+++ b/drivers/platform/goldfish/goldfish_pipe_v1.c
@@ -0,0 +1,632 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2011 Google, Inc.
+ * Copyright (C) 2012 Intel, Inc.
+ * Copyright (C) 2013 Intel, Inc.
+ * Copyright (C) 2014 Linaro Limited
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+/* This source file contains the implementation of the legacy version of
+ * a goldfish pipe device driver. See goldfish_pipe_v2.c for the current
+ * version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "goldfish_pipe_qemu.h"
+#include "goldfish_pipe.h"
+
+#define MAX_PAGES_TO_GRAB 32
+
+/* A value that will not be set by qemu emulator */
+#define INITIAL_BATCH_RESULT (0xdeadbeaf)
+
+struct goldfish_pipe_dev;
+
+/* This data type 

[PATCH 13/15] platform: goldfish: pipe: Add a dedicated constant for the device name

2018-10-02 Thread rkir
From: Roman Kiryanov 

Create a constant to refer to the device name instead if several copies
of a string.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/goldfish_pipe.h| 2 ++
 drivers/platform/goldfish/goldfish_pipe_v2.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.h 
b/drivers/platform/goldfish/goldfish_pipe.h
index ee0b54bcb165..0fa6ecb32c6d 100644
--- a/drivers/platform/goldfish/goldfish_pipe.h
+++ b/drivers/platform/goldfish/goldfish_pipe.h
@@ -2,6 +2,8 @@
 #ifndef GOLDFISH_PIPE_H
 #define GOLDFISH_PIPE_H
 
+#define DEVICE_NAME "goldfish_pipe"
+
 struct goldfish_pipe_dev_base {
/* the destructor, the pointer is set in init */
int (*deinit)(void *pipe_dev, struct platform_device *pdev);
diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c 
b/drivers/platform/goldfish/goldfish_pipe_v2.c
index 9857ce07d0e6..0e2a62322477 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -775,7 +775,7 @@ static void init_miscdevice(struct miscdevice *miscdev)
memset(miscdev, 0, sizeof(*miscdev));
 
miscdev->minor = MISC_DYNAMIC_MINOR;
-   miscdev->name = "goldfish_pipe";
+   miscdev->name = DEVICE_NAME;
miscdev->fops = _pipe_fops;
 }
 
@@ -806,7 +806,7 @@ int goldfish_pipe_device_v2_init(struct platform_device 
*pdev,
 
err = devm_request_irq(>dev, irq,
   goldfish_pipe_interrupt,
-  IRQF_SHARED, "goldfish_pipe", dev);
+  IRQF_SHARED, DEVICE_NAME, dev);
if (err) {
dev_err(>dev, "unable to allocate IRQ for v2\n");
return err;
-- 
2.19.0.605.g01d371f741-goog



[PATCH 10/15] platform: goldfish: pipe: Remove the license boilerplate

2018-10-02 Thread rkir
From: Roman Kiryanov 

Not required with the SPDX-License-Identifier header.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/goldfish_pipe_v2.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c 
b/drivers/platform/goldfish/goldfish_pipe_v2.c
index a1fbbf49cc3f..ff5d88e7959a 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -1,21 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2012 Intel, Inc.
- * Copyright (C) 2013 Intel, Inc.
- * Copyright (C) 2014 Linaro Limited
- * Copyright (C) 2011-2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
 /* This source file contains the implementation of a special device driver
  * that intends to provide a *very* fast communication channel between the
  * guest system and the QEMU emulator.
-- 
2.19.0.605.g01d371f741-goog



[PATCH 13/15] platform: goldfish: pipe: Add a dedicated constant for the device name

2018-10-02 Thread rkir
From: Roman Kiryanov 

Create a constant to refer to the device name instead if several copies
of a string.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/goldfish_pipe.h| 2 ++
 drivers/platform/goldfish/goldfish_pipe_v2.c | 4 ++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe.h 
b/drivers/platform/goldfish/goldfish_pipe.h
index ee0b54bcb165..0fa6ecb32c6d 100644
--- a/drivers/platform/goldfish/goldfish_pipe.h
+++ b/drivers/platform/goldfish/goldfish_pipe.h
@@ -2,6 +2,8 @@
 #ifndef GOLDFISH_PIPE_H
 #define GOLDFISH_PIPE_H
 
+#define DEVICE_NAME "goldfish_pipe"
+
 struct goldfish_pipe_dev_base {
/* the destructor, the pointer is set in init */
int (*deinit)(void *pipe_dev, struct platform_device *pdev);
diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c 
b/drivers/platform/goldfish/goldfish_pipe_v2.c
index 9857ce07d0e6..0e2a62322477 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -775,7 +775,7 @@ static void init_miscdevice(struct miscdevice *miscdev)
memset(miscdev, 0, sizeof(*miscdev));
 
miscdev->minor = MISC_DYNAMIC_MINOR;
-   miscdev->name = "goldfish_pipe";
+   miscdev->name = DEVICE_NAME;
miscdev->fops = _pipe_fops;
 }
 
@@ -806,7 +806,7 @@ int goldfish_pipe_device_v2_init(struct platform_device 
*pdev,
 
err = devm_request_irq(>dev, irq,
   goldfish_pipe_interrupt,
-  IRQF_SHARED, "goldfish_pipe", dev);
+  IRQF_SHARED, DEVICE_NAME, dev);
if (err) {
dev_err(>dev, "unable to allocate IRQ for v2\n");
return err;
-- 
2.19.0.605.g01d371f741-goog



[PATCH 10/15] platform: goldfish: pipe: Remove the license boilerplate

2018-10-02 Thread rkir
From: Roman Kiryanov 

Not required with the SPDX-License-Identifier header.

Signed-off-by: Roman Kiryanov 
---
 drivers/platform/goldfish/goldfish_pipe_v2.c | 17 -
 1 file changed, 17 deletions(-)

diff --git a/drivers/platform/goldfish/goldfish_pipe_v2.c 
b/drivers/platform/goldfish/goldfish_pipe_v2.c
index a1fbbf49cc3f..ff5d88e7959a 100644
--- a/drivers/platform/goldfish/goldfish_pipe_v2.c
+++ b/drivers/platform/goldfish/goldfish_pipe_v2.c
@@ -1,21 +1,4 @@
 // SPDX-License-Identifier: GPL-2.0
-/*
- * Copyright (C) 2012 Intel, Inc.
- * Copyright (C) 2013 Intel, Inc.
- * Copyright (C) 2014 Linaro Limited
- * Copyright (C) 2011-2016 Google, Inc.
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
 /* This source file contains the implementation of a special device driver
  * that intends to provide a *very* fast communication channel between the
  * guest system and the QEMU emulator.
-- 
2.19.0.605.g01d371f741-goog



<    1   2   3   4   5   6   7   8   9   10   >