[Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h

minyard@acm.org posted 2 patches 7 years, 8 months ago
[Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by minyard@acm.org 7 years, 8 months ago
From: Corey Minyard <cminyard@mvista.com>

Some devices need access to it.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
---
 hw/i2c/core.c        | 17 -----------------
 include/hw/i2c/i2c.h | 17 +++++++++++++++++
 2 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/hw/i2c/core.c b/hw/i2c/core.c
index 9a54b61..cfccefc 100644
--- a/hw/i2c/core.c
+++ b/hw/i2c/core.c
@@ -10,30 +10,13 @@
 #include "qemu/osdep.h"
 #include "hw/i2c/i2c.h"
 
-typedef struct I2CNode I2CNode;
-
-struct I2CNode {
-    I2CSlave *elt;
-    QLIST_ENTRY(I2CNode) next;
-};
-
 #define I2C_BROADCAST 0x00
 
-struct I2CBus {
-    BusState qbus;
-    QLIST_HEAD(, I2CNode) current_devs;
-    uint8_t saved_address;
-    bool broadcast;
-};
-
 static Property i2c_props[] = {
     DEFINE_PROP_UINT8("address", struct I2CSlave, address, 0),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-#define TYPE_I2C_BUS "i2c-bus"
-#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS)
-
 static const TypeInfo i2c_bus_info = {
     .name = TYPE_I2C_BUS,
     .parent = TYPE_BUS,
diff --git a/include/hw/i2c/i2c.h b/include/hw/i2c/i2c.h
index 8fd449f..d727379 100644
--- a/include/hw/i2c/i2c.h
+++ b/include/hw/i2c/i2c.h
@@ -56,6 +56,23 @@ struct I2CSlave {
     uint8_t address;
 };
 
+#define TYPE_I2C_BUS "i2c-bus"
+#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS)
+
+typedef struct I2CNode I2CNode;
+
+struct I2CNode {
+    I2CSlave *elt;
+    QLIST_ENTRY(I2CNode) next;
+};
+
+struct I2CBus {
+    BusState qbus;
+    QLIST_HEAD(, I2CNode) current_devs;
+    uint8_t saved_address;
+    bool broadcast;
+};
+
 I2CBus *i2c_init_bus(DeviceState *parent, const char *name);
 void i2c_set_slave_address(I2CSlave *dev, uint8_t address);
 int i2c_bus_busy(I2CBus *bus);
-- 
2.7.4


Re: [Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by Peter Maydell 7 years, 8 months ago
On 19 February 2018 at 15:20,  <minyard@acm.org> wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> Some devices need access to it.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>
> ---
>  hw/i2c/core.c        | 17 -----------------
>  include/hw/i2c/i2c.h | 17 +++++++++++++++++
>  2 files changed, 17 insertions(+), 17 deletions(-)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM

Re: [Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by Corey Minyard 7 years, 8 months ago
On 02/19/2018 09:25 AM, Peter Maydell wrote:
> On 19 February 2018 at 15:20,  <minyard@acm.org> wrote:
>> From: Corey Minyard <cminyard@mvista.com>
>>
>> Some devices need access to it.
>>
>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>> ---
>>   hw/i2c/core.c        | 17 -----------------
>>   include/hw/i2c/i2c.h | 17 +++++++++++++++++
>>   2 files changed, 17 insertions(+), 17 deletions(-)
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Linus, Philippe, do you want me to submit this, or do you want
to take it?  You can pull it from:

https://github.com/cminyard/qemu.git tags/i2c-bus-move

-corey

> thanks
> -- PMM



Re: [Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by Linus Walleij 7 years, 8 months ago
On Tue, Feb 20, 2018 at 2:06 PM, Corey Minyard <minyard@acm.org> wrote:
> On 02/19/2018 09:25 AM, Peter Maydell wrote:
>>
>> On 19 February 2018 at 15:20,  <minyard@acm.org> wrote:
>>>
>>> From: Corey Minyard <cminyard@mvista.com>
>>>
>>> Some devices need access to it.
>>>
>>> Signed-off-by: Corey Minyard <cminyard@mvista.com>
>>> ---
>>>   hw/i2c/core.c        | 17 -----------------
>>>   include/hw/i2c/i2c.h | 17 +++++++++++++++++
>>>   2 files changed, 17 insertions(+), 17 deletions(-)
>>
>> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
>
>
> Linus, Philippe, do you want me to submit this, or do you want
> to take it?  You can pull it from:
>
> https://github.com/cminyard/qemu.git tags/i2c-bus-move

I don't have any commit rights, if you can push this to the
QEMU master I will happily rebase my stuff and resubmit :)

Yours,
Linus Walleij

Re: [Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by Peter Maydell 7 years, 8 months ago
On 22 February 2018 at 15:39, Linus Walleij <linus.walleij@linaro.org> wrote:
> On Tue, Feb 20, 2018 at 2:06 PM, Corey Minyard <minyard@acm.org> wrote:
>> Linus, Philippe, do you want me to submit this, or do you want
>> to take it?  You can pull it from:
>>
>> https://github.com/cminyard/qemu.git tags/i2c-bus-move
>
> I don't have any commit rights, if you can push this to the
> QEMU master I will happily rebase my stuff and resubmit :)

I suggest you take Corey's 2 patches, add them to the front
of your patchset and add your signed-off-by line to them.
That way you don't have to wait for them to go into git master.

thanks
-- PMM

Re: [Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by Linus Walleij 7 years, 8 months ago
On Thu, Feb 22, 2018 at 4:44 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> On 22 February 2018 at 15:39, Linus Walleij <linus.walleij@linaro.org> wrote:
>> On Tue, Feb 20, 2018 at 2:06 PM, Corey Minyard <minyard@acm.org> wrote:
>>> Linus, Philippe, do you want me to submit this, or do you want
>>> to take it?  You can pull it from:
>>>
>>> https://github.com/cminyard/qemu.git tags/i2c-bus-move
>>
>> I don't have any commit rights, if you can push this to the
>> QEMU master I will happily rebase my stuff and resubmit :)
>
> I suggest you take Corey's 2 patches, add them to the front
> of your patchset and add your signed-off-by line to them.
> That way you don't have to wait for them to go into git master.

OK no problem!

Yours,
Linus Walleij

Re: [Qemu-devel] [PATCH 2/2] i2c: Move the bus class to i2c.h
Posted by Linus Walleij 7 years, 8 months ago
On Mon, Feb 19, 2018 at 4:20 PM,  <minyard@acm.org> wrote:
> From: Corey Minyard <cminyard@mvista.com>
>
> Some devices need access to it.
>
> Signed-off-by: Corey Minyard <cminyard@mvista.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij