Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1453383 > unrolled thread

[PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops

Started byTal Shorer <tal.shorer@gmail.com>
First post2016-08-01 20:20 +0200
Last post2016-08-09 18:50 +0200
Articles 11 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 06/10] usb: ulpi: remove old api callbacks from struct ulpi_ops Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 10/10] usb: dwc3: ulpi: make dwc3_ulpi_ops constant Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 03/10] usb: ulpi: use new api functions if available Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 08/10] usb: ulpi: remove "dev" field from struct ulpi_ops Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 07/10] usb: ulpi: rename operations {read|write}_dev to simply {read|write} Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 04/10] usb: dwc3: ulpi: use new api Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    [PATCH v2 09/10] usb: ulpi: make ops struct constant Tal Shorer <tal.shorer@gmail.com> - 2016-08-01 20:20 +0200
    Re: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct  ulpi_ops Greg KH <gregkh@linuxfoundation.org> - 2016-08-09 16:10 +0200
      Re: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops Tal Shorer <tal.shorer@gmail.com> - 2016-08-09 18:00 +0200
        Re: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct  ulpi_ops Greg KH <gregkh@linuxfoundation.org> - 2016-08-09 18:50 +0200

#1453383 — [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops
Message-ID<s1pYK-1pc-15@gated-at.bofh.it>
struct ulpi_ops is defined as follows:

struct ulpi_ops {
        struct device *dev;
        int (*read)(struct ulpi_ops *ops, u8 addr);
        int (*write)(struct ulpi_ops *ops, u8 addr, u8 val);
};

Upon calling ulpi_register_interface(), the struct device argument is
put inside the struct ulpi_ops argument's dev field. Later, when
calling the actual read()/write() operations, the struct ulpi_ops is
passed to them and they use the stored device to access whatever
private data they need.

This means that if one wishes to reuse the same oprations for multiple
interfaces (e.g if we have multiple instances of the same controller),
any but the last interface registered will not operate properly (and
the one that does work will be at the mercy of the others to not mess
it up).

I understand that barely any driver uses this bus right now, but I
suppose it's there to be used at some point. We might as well fix the
design here before we hit this bug.

This series fixes this by passing the given struct device directly to
the operation functions via ulpi->dev.parent in ulpi_read() and
ulpi_write(). It also changes the operations struct to be constant
since now nobody has a reason to modify it.

Changes from v1:
 * Split the actual api change into multiple patch as per Felipe Balbi's
   suggestion. The series now first adds the new api, then migrates
   everything to use and only then removes the old api.

Tal Shorer (10):
  usb: ulpi: move setting of ulpi->dev parent up in ulpi_register()
  usb: ulpi: add new api functions, {read|write}_dev()
  usb: ulpi: use new api functions if available
  usb: dwc3: ulpi: use new api
  usb: ulpi: remove calls to old api callbacks
  usb: ulpi: remove old api callbacks from struct ulpi_ops
  usb: ulpi: rename operations {read|write}_dev to simply {read|write}
  usb: ulpi: remove "dev" field from struct ulpi_ops
  usb: ulpi: make ops struct constant
  usb: dwc3: ulpi: make dwc3_ulpi_ops constant

 drivers/usb/common/ulpi.c      | 11 ++++++-----
 drivers/usb/dwc3/ulpi.c        | 10 +++++-----
 include/linux/ulpi/driver.h    |  2 +-
 include/linux/ulpi/interface.h |  8 ++++----
 4 files changed, 16 insertions(+), 15 deletions(-)

-- 
2.7.4

[toc] | [next] | [standalone]


#1453384 — [PATCH v2 06/10] usb: ulpi: remove old api callbacks from struct ulpi_ops

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 06/10] usb: ulpi: remove old api callbacks from struct ulpi_ops
Message-ID<s1pYK-1pc-27@gated-at.bofh.it>
In reply to#1453383
The old api callbacks, read() and write(), are not referenced anywhere.
Remove them.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 include/linux/ulpi/interface.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/ulpi/interface.h b/include/linux/ulpi/interface.h
index d8189d0..71f3c99 100644
--- a/include/linux/ulpi/interface.h
+++ b/include/linux/ulpi/interface.h
@@ -13,8 +13,6 @@ struct ulpi;
  */
 struct ulpi_ops {
 	struct device *dev;
-	int (*read)(struct ulpi_ops *ops, u8 addr);
-	int (*write)(struct ulpi_ops *ops, u8 addr, u8 val);
 	int (*read_dev)(struct device *dev, u8 addr);
 	int (*write_dev)(struct device *dev, u8 addr, u8 val);
 };
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1453385 — [PATCH v2 10/10] usb: dwc3: ulpi: make dwc3_ulpi_ops constant

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 10/10] usb: dwc3: ulpi: make dwc3_ulpi_ops constant
Message-ID<s1pYK-1pc-31@gated-at.bofh.it>
In reply to#1453383
ulpi_register_interface() accepts a const struct ulpi_ops and dwc3
doesn't perform any changes to this struct at runtime, so there's no
reason it shouldn't be constant.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 drivers/usb/dwc3/ulpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/ulpi.c b/drivers/usb/dwc3/ulpi.c
index 51ac939..bd86f84 100644
--- a/drivers/usb/dwc3/ulpi.c
+++ b/drivers/usb/dwc3/ulpi.c
@@ -65,7 +65,7 @@ static int dwc3_ulpi_write(struct device *dev, u8 addr, u8 val)
 	return dwc3_ulpi_busyloop(dwc);
 }
 
-static struct ulpi_ops dwc3_ulpi_ops = {
+static const struct ulpi_ops dwc3_ulpi_ops = {
 	.read = dwc3_ulpi_read,
 	.write = dwc3_ulpi_write,
 };
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1453386 — [PATCH v2 03/10] usb: ulpi: use new api functions if available

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 03/10] usb: ulpi: use new api functions if available
Message-ID<s1pYK-1pc-33@gated-at.bofh.it>
In reply to#1453383
If the registered has the new api callbacks {read|write}_dev, call
these instead of the deprecated read, write functions. If the
registered does not support the new callbacks, revert to calling the
old ones as before.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 drivers/usb/common/ulpi.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index d1f419c..a877ddb 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -21,13 +21,17 @@
 
 int ulpi_read(struct ulpi *ulpi, u8 addr)
 {
-	return ulpi->ops->read(ulpi->ops, addr);
+	if (!ulpi->ops->read_dev)
+		return ulpi->ops->read(ulpi->ops, addr);
+	return ulpi->ops->read_dev(ulpi->dev.parent, addr);
 }
 EXPORT_SYMBOL_GPL(ulpi_read);
 
 int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val)
 {
-	return ulpi->ops->write(ulpi->ops, addr, val);
+	if (!ulpi->ops->write_dev)
+		return ulpi->ops->write(ulpi->ops, addr, val);
+	return ulpi->ops->write_dev(ulpi->dev.parent, addr, val);
 }
 EXPORT_SYMBOL_GPL(ulpi_write);
 
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1453387 — [PATCH v2 08/10] usb: ulpi: remove "dev" field from struct ulpi_ops

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 08/10] usb: ulpi: remove "dev" field from struct ulpi_ops
Message-ID<s1pYK-1pc-25@gated-at.bofh.it>
In reply to#1453383
Operations now use ulpi->dev.parent directly instead of via the
ulpi_ops struct, making this field unused. Remove it.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 drivers/usb/common/ulpi.c      | 1 -
 include/linux/ulpi/interface.h | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index fdaed7c..0439e96 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -212,7 +212,6 @@ struct ulpi *ulpi_register_interface(struct device *dev, struct ulpi_ops *ops)
 		return ERR_PTR(-ENOMEM);
 
 	ulpi->ops = ops;
-	ops->dev = dev;
 
 	ret = ulpi_register(dev, ulpi);
 	if (ret) {
diff --git a/include/linux/ulpi/interface.h b/include/linux/ulpi/interface.h
index ac3cd80..ee6e35a 100644
--- a/include/linux/ulpi/interface.h
+++ b/include/linux/ulpi/interface.h
@@ -4,6 +4,7 @@
 #include <linux/types.h>
 
 struct ulpi;
+struct device;
 
 /**
  * struct ulpi_ops - ULPI register access
@@ -12,7 +13,6 @@ struct ulpi;
  * @write: write operation for ULPI register access
  */
 struct ulpi_ops {
-	struct device *dev;
 	int (*read)(struct device *dev, u8 addr);
 	int (*write)(struct device *dev, u8 addr, u8 val);
 };
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1453388 — [PATCH v2 07/10] usb: ulpi: rename operations {read|write}_dev to simply {read|write}

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 07/10] usb: ulpi: rename operations {read|write}_dev to simply {read|write}
Message-ID<s1pYK-1pc-35@gated-at.bofh.it>
In reply to#1453383
With the removal of the old {read|write} operations, we can now safely
rename the new api operations {read|write}_dev to use the shorter and
clearer names {read|write}, respectively.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 drivers/usb/common/ulpi.c      | 4 ++--
 drivers/usb/dwc3/ulpi.c        | 4 ++--
 include/linux/ulpi/interface.h | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 43142c3..fdaed7c 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -21,13 +21,13 @@
 
 int ulpi_read(struct ulpi *ulpi, u8 addr)
 {
-	return ulpi->ops->read_dev(ulpi->dev.parent, addr);
+	return ulpi->ops->read(ulpi->dev.parent, addr);
 }
 EXPORT_SYMBOL_GPL(ulpi_read);
 
 int ulpi_write(struct ulpi *ulpi, u8 addr, u8 val)
 {
-	return ulpi->ops->write_dev(ulpi->dev.parent, addr, val);
+	return ulpi->ops->write(ulpi->dev.parent, addr, val);
 }
 EXPORT_SYMBOL_GPL(ulpi_write);
 
diff --git a/drivers/usb/dwc3/ulpi.c b/drivers/usb/dwc3/ulpi.c
index 94eeb7a..51ac939 100644
--- a/drivers/usb/dwc3/ulpi.c
+++ b/drivers/usb/dwc3/ulpi.c
@@ -66,8 +66,8 @@ static int dwc3_ulpi_write(struct device *dev, u8 addr, u8 val)
 }
 
 static struct ulpi_ops dwc3_ulpi_ops = {
-	.read_dev = dwc3_ulpi_read,
-	.write_dev = dwc3_ulpi_write,
+	.read = dwc3_ulpi_read,
+	.write = dwc3_ulpi_write,
 };
 
 int dwc3_ulpi_init(struct dwc3 *dwc)
diff --git a/include/linux/ulpi/interface.h b/include/linux/ulpi/interface.h
index 71f3c99..ac3cd80 100644
--- a/include/linux/ulpi/interface.h
+++ b/include/linux/ulpi/interface.h
@@ -13,8 +13,8 @@ struct ulpi;
  */
 struct ulpi_ops {
 	struct device *dev;
-	int (*read_dev)(struct device *dev, u8 addr);
-	int (*write_dev)(struct device *dev, u8 addr, u8 val);
+	int (*read)(struct device *dev, u8 addr);
+	int (*write)(struct device *dev, u8 addr, u8 val);
 };
 
 struct ulpi *ulpi_register_interface(struct device *, struct ulpi_ops *);
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1453389 — [PATCH v2 04/10] usb: dwc3: ulpi: use new api

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 04/10] usb: dwc3: ulpi: use new api
Message-ID<s1pYK-1pc-39@gated-at.bofh.it>
In reply to#1453383
The old read, write callbacks in struct ulpi_ops have been deprecated
in favor of new callbacks that pass the parent device directly.
Replace the used callbacks in dwc3's ulpi component with the new api.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 drivers/usb/dwc3/ulpi.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/dwc3/ulpi.c b/drivers/usb/dwc3/ulpi.c
index ec004c6..94eeb7a 100644
--- a/drivers/usb/dwc3/ulpi.c
+++ b/drivers/usb/dwc3/ulpi.c
@@ -35,9 +35,9 @@ static int dwc3_ulpi_busyloop(struct dwc3 *dwc)
 	return -ETIMEDOUT;
 }
 
-static int dwc3_ulpi_read(struct ulpi_ops *ops, u8 addr)
+static int dwc3_ulpi_read(struct device *dev, u8 addr)
 {
-	struct dwc3 *dwc = dev_get_drvdata(ops->dev);
+	struct dwc3 *dwc = dev_get_drvdata(dev);
 	u32 reg;
 	int ret;
 
@@ -53,9 +53,9 @@ static int dwc3_ulpi_read(struct ulpi_ops *ops, u8 addr)
 	return DWC3_GUSB2PHYACC_DATA(reg);
 }
 
-static int dwc3_ulpi_write(struct ulpi_ops *ops, u8 addr, u8 val)
+static int dwc3_ulpi_write(struct device *dev, u8 addr, u8 val)
 {
-	struct dwc3 *dwc = dev_get_drvdata(ops->dev);
+	struct dwc3 *dwc = dev_get_drvdata(dev);
 	u32 reg;
 
 	reg = DWC3_GUSB2PHYACC_NEWREGREQ | DWC3_ULPI_ADDR(addr);
@@ -66,8 +66,8 @@ static int dwc3_ulpi_write(struct ulpi_ops *ops, u8 addr, u8 val)
 }
 
 static struct ulpi_ops dwc3_ulpi_ops = {
-	.read = dwc3_ulpi_read,
-	.write = dwc3_ulpi_write,
+	.read_dev = dwc3_ulpi_read,
+	.write_dev = dwc3_ulpi_write,
 };
 
 int dwc3_ulpi_init(struct dwc3 *dwc)
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1453390 — [PATCH v2 09/10] usb: ulpi: make ops struct constant

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-01 20:20 +0200
Subject[PATCH v2 09/10] usb: ulpi: make ops struct constant
Message-ID<s1pYK-1pc-37@gated-at.bofh.it>
In reply to#1453383
None of the core ulpi functions perform any changes to the operations
struct, and logically as a struct that contains function pointers
there's no reason it shouldn't be constant.

Signed-off-by: Tal Shorer <tal.shorer@gmail.com>
---
 drivers/usb/common/ulpi.c      | 3 ++-
 include/linux/ulpi/driver.h    | 2 +-
 include/linux/ulpi/interface.h | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c
index 0439e96..d4ff6df 100644
--- a/drivers/usb/common/ulpi.c
+++ b/drivers/usb/common/ulpi.c
@@ -202,7 +202,8 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)
  * Allocates and registers a ULPI device and an interface for it. Called from
  * the USB controller that provides the ULPI interface.
  */
-struct ulpi *ulpi_register_interface(struct device *dev, struct ulpi_ops *ops)
+struct ulpi *ulpi_register_interface(struct device *dev,
+				     const struct ulpi_ops *ops)
 {
 	struct ulpi *ulpi;
 	int ret;
diff --git a/include/linux/ulpi/driver.h b/include/linux/ulpi/driver.h
index 388f6e0..a44408f 100644
--- a/include/linux/ulpi/driver.h
+++ b/include/linux/ulpi/driver.h
@@ -15,7 +15,7 @@ struct ulpi_ops;
  */
 struct ulpi {
 	struct ulpi_device_id id;
-	struct ulpi_ops *ops;
+	const struct ulpi_ops *ops;
 	struct device dev;
 };
 
diff --git a/include/linux/ulpi/interface.h b/include/linux/ulpi/interface.h
index ee6e35a..43b0738 100644
--- a/include/linux/ulpi/interface.h
+++ b/include/linux/ulpi/interface.h
@@ -17,7 +17,7 @@ struct ulpi_ops {
 	int (*write)(struct device *dev, u8 addr, u8 val);
 };
 
-struct ulpi *ulpi_register_interface(struct device *, struct ulpi_ops *);
+struct ulpi *ulpi_register_interface(struct device *, const struct ulpi_ops *);
 void ulpi_unregister_interface(struct ulpi *);
 
 #endif /* __LINUX_ULPI_INTERFACE_H */
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1458788 — Re: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-08-09 16:10 +0200
SubjectRe: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops
Message-ID<s4fTc-bN-33@gated-at.bofh.it>
In reply to#1453383
On Mon, Aug 01, 2016 at 09:15:48PM +0300, Tal Shorer wrote:
> struct ulpi_ops is defined as follows:
> 
> struct ulpi_ops {
>         struct device *dev;
>         int (*read)(struct ulpi_ops *ops, u8 addr);
>         int (*write)(struct ulpi_ops *ops, u8 addr, u8 val);
> };
> 
> Upon calling ulpi_register_interface(), the struct device argument is
> put inside the struct ulpi_ops argument's dev field. Later, when
> calling the actual read()/write() operations, the struct ulpi_ops is
> passed to them and they use the stored device to access whatever
> private data they need.
> 
> This means that if one wishes to reuse the same oprations for multiple
> interfaces (e.g if we have multiple instances of the same controller),
> any but the last interface registered will not operate properly (and
> the one that does work will be at the mercy of the others to not mess
> it up).
> 
> I understand that barely any driver uses this bus right now, but I
> suppose it's there to be used at some point. We might as well fix the
> design here before we hit this bug.
> 
> This series fixes this by passing the given struct device directly to
> the operation functions via ulpi->dev.parent in ulpi_read() and
> ulpi_write(). It also changes the operations struct to be constant
> since now nobody has a reason to modify it.
> 
> Changes from v1:
>  * Split the actual api change into multiple patch as per Felipe Balbi's
>    suggestion. The series now first adds the new api, then migrates
>    everything to use and only then removes the old api.
> 
> Tal Shorer (10):
>   usb: ulpi: move setting of ulpi->dev parent up in ulpi_register()
>   usb: ulpi: add new api functions, {read|write}_dev()
>   usb: ulpi: use new api functions if available
>   usb: dwc3: ulpi: use new api
>   usb: ulpi: remove calls to old api callbacks
>   usb: ulpi: remove old api callbacks from struct ulpi_ops
>   usb: ulpi: rename operations {read|write}_dev to simply {read|write}
>   usb: ulpi: remove "dev" field from struct ulpi_ops
>   usb: ulpi: make ops struct constant
>   usb: dwc3: ulpi: make dwc3_ulpi_ops constant

I'd like to get Heikki's ack for this series...

[toc] | [prev] | [next] | [standalone]


#1458876

FromTal Shorer <tal.shorer@gmail.com>
Date2016-08-09 18:00 +0200
Message-ID<s4hBE-16y-27@gated-at.bofh.it>
In reply to#1458788
On Tue, Aug 9, 2016 at 5:04 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Mon, Aug 01, 2016 at 09:15:48PM +0300, Tal Shorer wrote:
>> struct ulpi_ops is defined as follows:
>>
>> struct ulpi_ops {
>>         struct device *dev;
>>         int (*read)(struct ulpi_ops *ops, u8 addr);
>>         int (*write)(struct ulpi_ops *ops, u8 addr, u8 val);
>> };
>>
>> Upon calling ulpi_register_interface(), the struct device argument is
>> put inside the struct ulpi_ops argument's dev field. Later, when
>> calling the actual read()/write() operations, the struct ulpi_ops is
>> passed to them and they use the stored device to access whatever
>> private data they need.
>>
>> This means that if one wishes to reuse the same oprations for multiple
>> interfaces (e.g if we have multiple instances of the same controller),
>> any but the last interface registered will not operate properly (and
>> the one that does work will be at the mercy of the others to not mess
>> it up).
>>
>> I understand that barely any driver uses this bus right now, but I
>> suppose it's there to be used at some point. We might as well fix the
>> design here before we hit this bug.
>>
>> This series fixes this by passing the given struct device directly to
>> the operation functions via ulpi->dev.parent in ulpi_read() and
>> ulpi_write(). It also changes the operations struct to be constant
>> since now nobody has a reason to modify it.
>>
>> Changes from v1:
>>  * Split the actual api change into multiple patch as per Felipe Balbi's
>>    suggestion. The series now first adds the new api, then migrates
>>    everything to use and only then removes the old api.
>>
>> Tal Shorer (10):
>>   usb: ulpi: move setting of ulpi->dev parent up in ulpi_register()
>>   usb: ulpi: add new api functions, {read|write}_dev()
>>   usb: ulpi: use new api functions if available
>>   usb: dwc3: ulpi: use new api
>>   usb: ulpi: remove calls to old api callbacks
>>   usb: ulpi: remove old api callbacks from struct ulpi_ops
>>   usb: ulpi: rename operations {read|write}_dev to simply {read|write}
>>   usb: ulpi: remove "dev" field from struct ulpi_ops
>>   usb: ulpi: make ops struct constant
>>   usb: dwc3: ulpi: make dwc3_ulpi_ops constant
>
> I'd like to get Heikki's ack for this series...
Anything to do on my end except waiting?

[toc] | [prev] | [next] | [standalone]


#1458958 — Re: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops

FromGreg KH <gregkh@linuxfoundation.org>
Date2016-08-09 18:50 +0200
SubjectRe: [PATCH v2 00/10] usb: ulpi: remove "dev" field from struct ulpi_ops
Message-ID<s4io2-1E1-17@gated-at.bofh.it>
In reply to#1458876
On Tue, Aug 09, 2016 at 06:55:18PM +0300, Tal Shorer wrote:
> On Tue, Aug 9, 2016 at 5:04 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Mon, Aug 01, 2016 at 09:15:48PM +0300, Tal Shorer wrote:
> >> struct ulpi_ops is defined as follows:
> >>
> >> struct ulpi_ops {
> >>         struct device *dev;
> >>         int (*read)(struct ulpi_ops *ops, u8 addr);
> >>         int (*write)(struct ulpi_ops *ops, u8 addr, u8 val);
> >> };
> >>
> >> Upon calling ulpi_register_interface(), the struct device argument is
> >> put inside the struct ulpi_ops argument's dev field. Later, when
> >> calling the actual read()/write() operations, the struct ulpi_ops is
> >> passed to them and they use the stored device to access whatever
> >> private data they need.
> >>
> >> This means that if one wishes to reuse the same oprations for multiple
> >> interfaces (e.g if we have multiple instances of the same controller),
> >> any but the last interface registered will not operate properly (and
> >> the one that does work will be at the mercy of the others to not mess
> >> it up).
> >>
> >> I understand that barely any driver uses this bus right now, but I
> >> suppose it's there to be used at some point. We might as well fix the
> >> design here before we hit this bug.
> >>
> >> This series fixes this by passing the given struct device directly to
> >> the operation functions via ulpi->dev.parent in ulpi_read() and
> >> ulpi_write(). It also changes the operations struct to be constant
> >> since now nobody has a reason to modify it.
> >>
> >> Changes from v1:
> >>  * Split the actual api change into multiple patch as per Felipe Balbi's
> >>    suggestion. The series now first adds the new api, then migrates
> >>    everything to use and only then removes the old api.
> >>
> >> Tal Shorer (10):
> >>   usb: ulpi: move setting of ulpi->dev parent up in ulpi_register()
> >>   usb: ulpi: add new api functions, {read|write}_dev()
> >>   usb: ulpi: use new api functions if available
> >>   usb: dwc3: ulpi: use new api
> >>   usb: ulpi: remove calls to old api callbacks
> >>   usb: ulpi: remove old api callbacks from struct ulpi_ops
> >>   usb: ulpi: rename operations {read|write}_dev to simply {read|write}
> >>   usb: ulpi: remove "dev" field from struct ulpi_ops
> >>   usb: ulpi: make ops struct constant
> >>   usb: dwc3: ulpi: make dwc3_ulpi_ops constant
> >
> > I'd like to get Heikki's ack for this series...
> Anything to do on my end except waiting?

Wait another week or so, if no response, I'll queue it up for 4.9-rc1 :)

thanks,

greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web