diff mbox series

[v2] main: Set I2C backend device specified in arguments

Message ID 20190204092010.j5dldqf2c7wtpj6b@gmail.com
State Accepted
Headers show
Series [v2] main: Set I2C backend device specified in arguments | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success master/apply_patch Successfully applied
snowpatch_ozlabs/build-multiarch success Test build-multiarch on branch master

Commit Message

Artem Senichev Feb. 4, 2019, 9:20 a.m. UTC
Restores the functionality that allows to set I2C backend
device through command line arguments, it was broken by commit
dacc9b57e4615f125eb1f56d842a64c40abb1408

Signed-off-by: Artem Senichev <artemsen@gmail.com>
---
 src/main.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Amitay Isaacs Feb. 5, 2019, 1:25 a.m. UTC | #1
It's the same patch as before.  This one after Artem figuring out the
git workflow. :-)

Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>

On Mon, 2019-02-04 at 12:20 +0300, Artem Senichev wrote:
> Restores the functionality that allows to set I2C backend
> device through command line arguments, it was broken by commit
> dacc9b57e4615f125eb1f56d842a64c40abb1408
> 
> Signed-off-by: Artem Senichev <artemsen@gmail.com>
> ---
>  src/main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/main.c b/src/main.c
> index 22e74a5..d5f9385 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -532,6 +532,14 @@ static bool target_selection(void)
>  #ifdef TARGET_ARM
>  	case I2C:
>  		pdbg_targets_init(&_binary_p8_i2c_dtb_o_start);
> +		/* Set device for I2C backend */
> +		if (device_node) {
> +			struct pdbg_target *pib;
> +			const size_t len = strlen(device_node) + 1 /*
> include last null */;
> +			pdbg_for_each_class_target("pib", pib) {
> +				pdbg_target_set_property(pib, "bus",
> device_node, len);
> +			}
> +		}
>  		break;
>  
>  	case FSI:
> -- 
> 2.20.1
> 

Amitay.
Alistair Popple Feb. 5, 2019, 2:12 a.m. UTC | #2
Thanks Artem for the contibution and fix! I've just pushed it to master. For 
background the orignal idea was to pass these sorts of parameters via device-
tree, but I can see why being able to set it on the command line would be 
helpful.

- Alistair

On Tuesday, 5 February 2019 12:25:16 PM AEDT Amitay Isaacs wrote:
> It's the same patch as before.  This one after Artem figuring out the
> git workflow. :-)
> 
> Reviewed-by: Amitay Isaacs <amitay@ozlabs.org>
> 
> On Mon, 2019-02-04 at 12:20 +0300, Artem Senichev wrote:
> > Restores the functionality that allows to set I2C backend
> > device through command line arguments, it was broken by commit
> > dacc9b57e4615f125eb1f56d842a64c40abb1408
> > 
> > Signed-off-by: Artem Senichev <artemsen@gmail.com>
> > ---
> > 
> >  src/main.c | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/src/main.c b/src/main.c
> > index 22e74a5..d5f9385 100644
> > --- a/src/main.c
> > +++ b/src/main.c
> > @@ -532,6 +532,14 @@ static bool target_selection(void)
> > 
> >  #ifdef TARGET_ARM
> >  
> >  	case I2C:
> >  		pdbg_targets_init(&_binary_p8_i2c_dtb_o_start);
> > 
> > +		/* Set device for I2C backend */
> > +		if (device_node) {
> > +			struct pdbg_target *pib;
> > +			const size_t len = strlen(device_node) + 1 /*
> > include last null */;
> > +			pdbg_for_each_class_target("pib", pib) {
> > +				pdbg_target_set_property(pib, "bus",
> > device_node, len);
> > +			}
> > +		}
> > 
> >  		break;
> >  	
> >  	case FSI:
> Amitay.
diff mbox series

Patch

diff --git a/src/main.c b/src/main.c
index 22e74a5..d5f9385 100644
--- a/src/main.c
+++ b/src/main.c
@@ -532,6 +532,14 @@  static bool target_selection(void)
 #ifdef TARGET_ARM
 	case I2C:
 		pdbg_targets_init(&_binary_p8_i2c_dtb_o_start);
+		/* Set device for I2C backend */
+		if (device_node) {
+			struct pdbg_target *pib;
+			const size_t len = strlen(device_node) + 1 /* include last null */;
+			pdbg_for_each_class_target("pib", pib) {
+				pdbg_target_set_property(pib, "bus", device_node, len);
+			}
+		}
 		break;
 
 	case FSI: