linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again
@ 2016-03-11 15:47 Pawel Baldysiak
  2016-03-11 15:47 ` [PATCH 2/2] super-intel: Simplify for() loop in ahci_enumerate_ports Pawel Baldysiak
  2016-03-11 17:36 ` [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again Jes Sorensen
  0 siblings, 2 replies; 4+ messages in thread
From: Pawel Baldysiak @ 2016-03-11 15:47 UTC (permalink / raw)
  To: linux-raid; +Cc: jes.sorensen, artur.paszkiewicz, Pawel Baldysiak

This patch reverts a0abe1e
(super-intel: Make print_found_intel_controllers() return void)
and make this function "return int" again.
Also, interpreting the return value is added.

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
 super-intel.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/super-intel.c b/super-intel.c
index 3fe304a..8a80c5b 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1766,7 +1766,7 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
 	return err;
 }
 
-static void print_vmd_attached_devs(struct sys_dev *hba)
+static int print_vmd_attached_devs(struct sys_dev *hba)
 {
 	struct dirent *ent;
 	DIR *dir;
@@ -1775,14 +1775,14 @@ static void print_vmd_attached_devs(struct sys_dev *hba)
 	char *c, *rp;
 
 	if (hba->type != SYS_DEV_VMD)
-		return;
+		return 1;
 
 	/* scroll through /sys/dev/block looking for devices attached to
 	 * this hba
 	 */
 	dir = opendir("/sys/bus/pci/drivers/nvme");
 	if (!dir)
-		return;
+		return 1;
 
 	for (ent = readdir(dir); ent; ent = readdir(dir)) {
 		int n;
@@ -1818,6 +1818,7 @@ static void print_vmd_attached_devs(struct sys_dev *hba)
 	}
 
 	closedir(dir);
+	return 0;
 }
 
 static void print_found_intel_controllers(struct sys_dev *elem)
@@ -2024,7 +2025,11 @@ static int detail_platform_imsm(int verbose, int enumerate_only, char *controlle
 					print_imsm_capability(&entry->orom);
 					printf(" I/O Controller : %s (%s)\n",
 						vmd_domain_to_controller(hba, buf), get_sys_dev_type(hba->type));
-					print_vmd_attached_devs(hba);
+					if (print_vmd_attached_devs(hba)) {
+						if (verbose > 0)
+							pr_err("failed to get devices attached to VMD domain.\n");
+						result |= 2;
+					}
 					printf("\n");
 				}
 			}
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] super-intel: Simplify for() loop in ahci_enumerate_ports
  2016-03-11 15:47 [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again Pawel Baldysiak
@ 2016-03-11 15:47 ` Pawel Baldysiak
  2016-03-11 17:36   ` Jes Sorensen
  2016-03-11 17:36 ` [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again Jes Sorensen
  1 sibling, 1 reply; 4+ messages in thread
From: Pawel Baldysiak @ 2016-03-11 15:47 UTC (permalink / raw)
  To: linux-raid; +Cc: jes.sorensen, artur.paszkiewicz, Pawel Baldysiak

This patch simplifies for() loop used in
ahci_enumerate_ports(). It makes it more readable.
Similar thing was done in b913501
({platform,super}-intel: Fix two resource leaks).

Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
---
 super-intel.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/super-intel.c b/super-intel.c
index 8a80c5b..1bc3688 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1624,7 +1624,10 @@ static int ahci_enumerate_ports(const char *hba_path, int port_count, int host_b
 	 * this hba
 	 */
 	dir = opendir("/sys/dev/block");
-	for (ent = dir ? readdir(dir) : NULL; ent; ent = readdir(dir)) {
+	if (!dir)
+		return 1;
+
+	for (ent = readdir(dir); ent; ent = readdir(dir)) {
 		int fd;
 		char model[64];
 		char vendor[64];
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again
  2016-03-11 15:47 [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again Pawel Baldysiak
  2016-03-11 15:47 ` [PATCH 2/2] super-intel: Simplify for() loop in ahci_enumerate_ports Pawel Baldysiak
@ 2016-03-11 17:36 ` Jes Sorensen
  1 sibling, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2016-03-11 17:36 UTC (permalink / raw)
  To: Pawel Baldysiak; +Cc: linux-raid, artur.paszkiewicz

Pawel Baldysiak <pawel.baldysiak@intel.com> writes:
> This patch reverts a0abe1e
> (super-intel: Make print_found_intel_controllers() return void)
> and make this function "return int" again.
> Also, interpreting the return value is added.
>
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
>  super-intel.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)

Applied!

Thanks,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] super-intel: Simplify for() loop in ahci_enumerate_ports
  2016-03-11 15:47 ` [PATCH 2/2] super-intel: Simplify for() loop in ahci_enumerate_ports Pawel Baldysiak
@ 2016-03-11 17:36   ` Jes Sorensen
  0 siblings, 0 replies; 4+ messages in thread
From: Jes Sorensen @ 2016-03-11 17:36 UTC (permalink / raw)
  To: Pawel Baldysiak; +Cc: linux-raid, artur.paszkiewicz

Pawel Baldysiak <pawel.baldysiak@intel.com> writes:
> This patch simplifies for() loop used in
> ahci_enumerate_ports(). It makes it more readable.
> Similar thing was done in b913501
> ({platform,super}-intel: Fix two resource leaks).
>
> Signed-off-by: Pawel Baldysiak <pawel.baldysiak@intel.com>
> ---
>  super-intel.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied!

Thanks,
Jes

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-11 17:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 15:47 [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again Pawel Baldysiak
2016-03-11 15:47 ` [PATCH 2/2] super-intel: Simplify for() loop in ahci_enumerate_ports Pawel Baldysiak
2016-03-11 17:36   ` Jes Sorensen
2016-03-11 17:36 ` [PATCH 1/2] super-intel: Make print_vmd_attached_devs() return int again Jes Sorensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).