All of lore.kernel.org
 help / color / mirror / Atom feed
From: ramesh.thomas at intel.com
To: accel-config@lists.01.org
Subject: [Accel-config] [PATCH v1 4/6] accel-config: Add check for mdev support availability in commands
Date: Sat, 23 Jan 2021 00:35:40 -0500	[thread overview]
Message-ID: <20210123053542.615622-5-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20210123053542.615622-1-ramesh.thomas@intel.com

[-- Attachment #1: Type: text/plain, Size: 1094 bytes --]

From: Ramesh Thomas <ramesh.thomas(a)intel.com>

Add check for mdev support availability in mdev commands and exit
with error message if support is not available.

Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
 accfg/mdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/accfg/mdev.c b/accfg/mdev.c
index 652b734..3bde7eb 100644
--- a/accfg/mdev.c
+++ b/accfg/mdev.c
@@ -90,6 +90,11 @@ int cmd_create_mdev(int argc, const char **argv, void *ctx)
 		usage_with_options(u, options);
 	}
 
+	if (!accfg_device_get_mdev_enabled(device)) {
+		fprintf(stderr, "mdev support not available\n");
+		return 0;
+	}
+
 	argc = parse_options(argc, argv, options, u, 0);
 	if (opt_called)
 		return 0;
@@ -138,6 +143,11 @@ int cmd_remove_mdev(int argc, const char **argv, void *ctx)
 		usage_with_options(u, options);
 	}
 
+	if (!accfg_device_get_mdev_enabled(device)) {
+		fprintf(stderr, "mdev support not available\n");
+		return 0;
+	}
+
 	argc = parse_options(argc, argv, options, u, 0);
 	if (opt_called)
 		return 0;
-- 
2.26.2

                 reply	other threads:[~2021-01-23  5:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210123053542.615622-5-ramesh.thomas@intel.com \
    --to=accel-config@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.