Skip to contentSkip to conversation

test: dm: adc: use the real device name

PATCH New Peng Fan 3 participants 12 messages May 22, 2019 – Jul 14, 2019

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH v2 1/3 test: dm: adc: use the real device name

"adc" is not the real device name, "adc at 0" is.

---

V2:
new

 test/dm/adc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
test/dm/adc.c +8 -8
index 1f82304f41..da7bd4bf1f 100644
@@ -24,7 +24,7 @@ static int dm_test_adc_bind(struct unit_test_state *uts)
 	struct udevice *dev;
 	unsigned int channel_mask;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0", &dev));
 	ut_asserteq_str(SANDBOX_ADC_DEVNAME, dev->name);
 
 	ut_assertok(adc_channel_mask(dev, &channel_mask));
@@ -38,7 +38,7 @@ static int dm_test_adc_wrong_channel_selection(struct unit_test_state *uts)
 {
 	struct udevice *dev;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0", &dev));
 	ut_asserteq(-EINVAL, adc_start_channel(dev, SANDBOX_ADC_CHANNELS));
 
 	return 0;
@@ -51,7 +51,7 @@ static int dm_test_adc_supply(struct unit_test_state *uts)
 	struct udevice *dev;
 	int uV;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0", &dev));
 
 	/* Test Vss value - predefined 0 uV */
 	ut_assertok(adc_vss_value(dev, &uV));
@@ -94,7 +94,7 @@ static int dm_test_adc_single_channel_conversion(struct unit_test_state *uts)
 	unsigned int i, data;
 	struct udevice *dev;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0", &dev));
 	/* Test each ADC channel's value */
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) {
 		ut_assertok(adc_start_channel(dev, tdata->id));
@@ -117,7 +117,7 @@ static int dm_test_adc_multi_channel_conversion(struct unit_test_state *uts)
 		       ADC_CHANNEL(2) | ADC_CHANNEL(3);
 
 	/* Start multi channel conversion */
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0", &dev));
 	ut_assertok(adc_start_channels(dev, channel_mask));
 	ut_assertok(adc_channels_data(dev, channel_mask, channels));
 
@@ -136,7 +136,7 @@ static int dm_test_adc_single_channel_shot(struct unit_test_state *uts)
 
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) {
 		/* Start single channel conversion */
-		ut_assertok(adc_channel_single_shot("adc", tdata->id, &data));
+		ut_assertok(adc_channel_single_shot("adc at 0", tdata->id, &data));
 		/* Compare the expected and returned conversion data. */
 		ut_asserteq(tdata->data, data);
 	}
@@ -155,7 +155,7 @@ static int dm_test_adc_multi_channel_shot(struct unit_test_state *uts)
 		       ADC_CHANNEL(2) | ADC_CHANNEL(3);
 
 	/* Start single call and multi channel conversion */
-	ut_assertok(adc_channels_single_shot("adc", channel_mask, channels));
+	ut_assertok(adc_channels_single_shot("adc at 0", channel_mask, channels));
 
 	/* Compare the expected and returned conversion data. */
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++)
@@ -183,7 +183,7 @@ static int dm_test_adc_raw_to_uV(struct unit_test_state *uts)
 	struct udevice *dev;
 	int uV;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc@0", &dev));
 	/* Test each ADC channel's value in microvolts */
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) {
 		ut_assertok(adc_start_channel(dev, tdata->id));
Signature · 1 line
2.16.4
author
#1 lore raw

PATCH v2 1/3 test: dm: adc: use the real device name

Hi Simon, Tom

Quoted 5 lines

Subject: [PATCH V2 1/3] test: dm: adc: use the real device name

"adc" is not the real device name, "adc at 0" is.

Will you pick up this patchset?
https://patchwork.ozlabs.org/patch/1103212/
https://patchwork.ozlabs.org/patch/1103213/
https://patchwork.ozlabs.org/patch/1103214/

Thanks,
Peng.

Quoted 99 lines

---

V2:
new

 test/dm/adc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
test/dm/adc.c index 1f82304f41..da7bd4bf1f renamed from test/dm/adc.c +0 -0

100644

test/dm/adc.c +1 -1
@@ -24,7 +24,7 @@ static int dm_test_adc_bind(struct unit_test_state *uts)
 	struct udevice *dev;
 	unsigned int channel_mask;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0",
 &dev));
 	ut_asserteq_str(SANDBOX_ADC_DEVNAME, dev->name);
 

ut_assertok(adc_channel_mask(dev, &channel_mask)); @@ -38,7 +38,7
@@ static int dm_test_adc_wrong_channel_selection(struct unit_test_state *uts) {

test/dm/adc.c +1 -1
 	struct udevice *dev;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0",

&dev));
ut_asserteq(-EINVAL, adc_start_channel(dev,
SANDBOX_ADC_CHANNELS));

test/dm/adc.c +1 -1
 	return 0;
@@ -51,7 +51,7 @@ static int dm_test_adc_supply(struct unit_test_state
 *uts)
 	struct udevice *dev;
 	int uV;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0",
 &dev));
 
test/dm/adc.c +1 -1
 	/* Test Vss value - predefined 0 uV */
 	ut_assertok(adc_vss_value(dev, &uV));
@@ -94,7 +94,7 @@ static int
 dm_test_adc_single_channel_conversion(struct unit_test_state *uts)
 	unsigned int i, data;
 	struct udevice *dev;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0",
 &dev));
 	/* Test each ADC channel's value */
test/dm/adc.c +0 -0
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) {
 		ut_assertok(adc_start_channel(dev, tdata->id)); @@ -117,7 +117,7

@@ static int dm_test_adc_multi_channel_conversion(struct unit_test_state *uts)

test/dm/adc.c +1 -1
 		       ADC_CHANNEL(2) | ADC_CHANNEL(3);
 
 	/* Start multi channel conversion */
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0",

&dev));

test/dm/adc.c +1 -1
 	ut_assertok(adc_start_channels(dev, channel_mask));
 	ut_assertok(adc_channels_data(dev, channel_mask, channels));
@@ -136,7 +136,7 @@ static int dm_test_adc_single_channel_shot(struct
 unit_test_state *uts)
 
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) {
 		/* Start single channel conversion */
-		ut_assertok(adc_channel_single_shot("adc", tdata->id, &data));
+		ut_assertok(adc_channel_single_shot("adc at 0", tdata->id, &data));
 		/* Compare the expected and returned conversion data. */
 		ut_asserteq(tdata->data, data);
test/dm/adc.c +4 -2
 	}
@@ -155,7 +155,7 @@ static int dm_test_adc_multi_channel_shot(struct
 unit_test_state *uts)
 		       ADC_CHANNEL(2) | ADC_CHANNEL(3);
 
 	/* Start single call and multi channel conversion */
-	ut_assertok(adc_channels_single_shot("adc", channel_mask, channels));
+	ut_assertok(adc_channels_single_shot("adc at 0", channel_mask,
+channels));
 
 	/* Compare the expected and returned conversion data. */
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) @@ -183,7
+183,7 @@ static int dm_test_adc_raw_to_uV(struct unit_test_state *uts)
 	struct udevice *dev;
 	int uV;
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc", &dev));
+	ut_assertok(uclass_get_device_by_name(UCLASS_ADC, "adc at 0",

&dev));

test/dm/adc.c +0 -1
 	/* Test each ADC channel's value in microvolts */
 	for (i = 0; i < SANDBOX_ADC_CHANNELS; i++, tdata++) {
 		ut_assertok(adc_start_channel(dev, tdata->id));
--

2.16.4

#2 lore raw

PATCH v2 1/3 test: dm: adc: use the real device name

Quoted 11 lines · Peng Fan

Hi Simon, Tom

Quoted 5 lines

Subject: [PATCH V2 1/3] test: dm: adc: use the real device name

"adc" is not the real device name, "adc at 0" is.

Will you pick up this patchset?
https://patchwork.ozlabs.org/patch/1103212/
https://patchwork.ozlabs.org/patch/1103213/
https://patchwork.ozlabs.org/patch/1103214/

For the next release. Or should they really come in now? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190624/6437c502/attachment.sig>
author
#3 lore raw

PATCH v2 1/3 test: dm: adc: use the real device name

Quoted 9 lines

Subject: Re: [PATCH V2 1/3] test: dm: adc: use the real device name

Quoted 5 lines · Peng Fan

Hi Simon, Tom

Quoted 4 lines

Subject: [PATCH V2 1/3] test: dm: adc: use the real device name

"adc" is not the real device name, "adc at 0" is.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Will you pick up this patchset?
https://patchwork.ozlabs.org/patch/1103212/
https://patchwork.ozlabs.org/patch/1103213/
https://patchwork.ozlabs.org/patch/1103214/

For the next release. Or should they really come in now? Thanks!

Could wait next release.

Thanks,
Peng.

Quoted 3 lines

--
Tom

author
#4 lore raw

PATCH v2 2/3 test: dm: usb: use the real device name

In reply to Peng Fan

"keyb" is not the real device name, "keyb at 3" is.

---

V2:
New

 test/dm/usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
test/dm/usb.c +1 -1
index 3493617544..ef454b0ae5 100644
@@ -125,7 +125,7 @@ static int dm_test_usb_keyb(struct unit_test_state *uts)
 	/* Initially there should be no characters */
 	ut_asserteq(0, tstc());
 
-	ut_assertok(uclass_get_device_by_name(UCLASS_USB_EMUL, "keyb",
+	ut_assertok(uclass_get_device_by_name(UCLASS_USB_EMUL, "keyb at 3",
 					      &dev));
 
 	/*
Signature · 1 line
2.16.4
#6 lore raw

PATCH v2 2/3 test: dm: usb: use the real device name

In reply to Peng Fan
Quoted 4 lines · Peng Fan

"keyb" is not the real device name, "keyb at 3" is.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190714/e43ce59c/attachment.sig>
author
#8 lore raw

PATCH v2 3/3 drivers: core: use strcmp when find device by name

In reply to Peng Fan

if (!strncmp(dev->name, name, strlen(name))) might find out the wrong device, it might find out dram_pll_ref_sel, when name is dram_pll. So use strcmp to avoid such issue.

---

V2:
None

 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/core/uclass.c +1 -1
index fc3157de39..e2f35393a9 100644
@@ -260,7 +260,7 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name,
 		return ret;
 
 	uclass_foreach_dev(dev, uc) {
-		if (!strncmp(dev->name, name, strlen(name))) {
+		if (!strcmp(dev->name, name)) {
 			*devp = dev;
 			return 0;
 		}
Signature · 1 line
2.16.4
#9 lore raw

PATCH v2 3/3 drivers: core: use strcmp when find device by name

Quoted 7 lines · Peng Fan

if (!strncmp(dev->name, name, strlen(name))) might find out the wrong device, it might find out dram_pll_ref_sel, when name is dram_pll. So use strcmp to avoid such issue.

Quoted 8 lines

---

V2:
None

 drivers/core/uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#10 lore raw

PATCH v2 3/3 drivers: core: use strcmp when find device by name

In reply to Peng Fan
Quoted 7 lines · Peng Fan

if (!strncmp(dev->name, name, strlen(name))) might find out the wrong device, it might find out dram_pll_ref_sel, when name is dram_pll. So use strcmp to avoid such issue.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190714/7e238c89/attachment.sig>
#11 lore raw

PATCH v2 1/3 test: dm: adc: use the real device name

In reply to Peng Fan
Quoted 4 lines · Peng Fan

"adc" is not the real device name, "adc at 0" is.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190714/7a4dcdcf/attachment.sig>