* [PATCH nvme-cli] edit huawei ssd filter @ 2020-05-20 1:39 l00293085 2020-05-20 8:04 ` Chaitanya Kulkarni 0 siblings, 1 reply; 4+ messages in thread From: l00293085 @ 2020-05-20 1:39 UTC (permalink / raw) To: kbusch, linux-nvme; +Cc: liuzhouhua, wangzan, kangwenhong, Michael.wangchong Hi, I'd like to modify command: nvme huawei list, add huawei vendor id as filter Signed-off-by: Andy Liu <liuzhouhua@huawei.com> Reviewed-by: Wang Zan <wangzan@huawei.com> --- plugins/huawei/huawei-nvme.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c index c935f47..c7f3307 100644 --- a/plugins/huawei/huawei-nvme.c +++ b/plugins/huawei/huawei-nvme.c @@ -41,6 +41,7 @@ #define CREATE_CMD #include "huawei-nvme.h" +#define HW_SSD_PCI_VENDOR_ID 0x19E5 #define ARRAY_NAME_LEN 80 #define NS_NAME_LEN 40 @@ -80,16 +81,15 @@ static int huawei_get_nvme_info(int fd, struct huawei_list_item *item, const cha return err; /*identify huawei device*/ - if (strstr(item->ctrl.mn, "Huawei") == NULL) { + if ((strstr(item->ctrl.mn, "Huawei") == NULL) \ + && (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { item->huawei_device = false; return 0; } - else - item->huawei_device = true; + item->huawei_device = true; item->nsid = nvme_get_nsid(fd); - err = nvme_identify_ns(fd, item->nsid, - 0, &item->ns); + err = nvme_identify_ns(fd, item->nsid, 0, &item->ns); if (err) return err; -- 2.22.0 _______________________________________________ linux-nvme mailing list linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nvme-cli] edit huawei ssd filter 2020-05-20 1:39 [PATCH nvme-cli] edit huawei ssd filter l00293085 @ 2020-05-20 8:04 ` Chaitanya Kulkarni 2020-05-21 9:34 ` Zhouhua Liu 0 siblings, 1 reply; 4+ messages in thread From: Chaitanya Kulkarni @ 2020-05-20 8:04 UTC (permalink / raw) To: l00293085, kbusch, linux-nvme; +Cc: wangzan, kangwenhong, Michael.wangchong On 5/19/20 6:47 PM, l00293085 wrote: > Hi, I'd like to modify command: nvme huawei list, add huawei vendor id as filter > Please modify the subject line and patch description as per the style present in the tree. > Signed-off-by: Andy Liu <liuzhouhua@huawei.com> > Reviewed-by: Wang Zan <wangzan@huawei.com> > --- > plugins/huawei/huawei-nvme.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c > index c935f47..c7f3307 100644 > --- a/plugins/huawei/huawei-nvme.c > +++ b/plugins/huawei/huawei-nvme.c > @@ -41,6 +41,7 @@ > #define CREATE_CMD > #include "huawei-nvme.h" > > +#define HW_SSD_PCI_VENDOR_ID 0x19E5 > #define ARRAY_NAME_LEN 80 > #define NS_NAME_LEN 40 > > @@ -80,16 +81,15 @@ static int huawei_get_nvme_info(int fd, struct huawei_list_item *item, const cha > return err; > > /*identify huawei device*/ > - if (strstr(item->ctrl.mn, "Huawei") == NULL) { > + if ((strstr(item->ctrl.mn, "Huawei") == NULL) \ > + && (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { > Consider following coding style to avoid \ in the code and break at the &&. if (err) return err; - /*identify huawei device*/ - if ((strstr(item->ctrl.mn, "Huawei") == NULL) \ - && (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { + /* identify huawei device */ + if ((strstr(item->ctrl.mn, "Huawei") == NULL) && + (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { item->huawei_device = false; return 0; } item->huawei_device = false; > return 0; > } > - else > - item->huawei_device = true; > > + item->huawei_device = true; > item->nsid = nvme_get_nsid(fd); > - err = nvme_identify_ns(fd, item->nsid, > - 0, &item->ns); > + err = nvme_identify_ns(fd, item->nsid, 0, &item->ns); > if (err) > return err; > > _______________________________________________ linux-nvme mailing list linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH nvme-cli] edit huawei ssd filter 2020-05-20 8:04 ` Chaitanya Kulkarni @ 2020-05-21 9:34 ` Zhouhua Liu 2020-05-22 0:58 ` Chaitanya Kulkarni 0 siblings, 1 reply; 4+ messages in thread From: Zhouhua Liu @ 2020-05-21 9:34 UTC (permalink / raw) To: Chaitanya Kulkarni, kbusch, linux-nvme Cc: wangzan, Kangwenhong, Wangchong (Michael) Chaitanya, thank you for your suggestion, the new patch is blow: Signed-off-by: Zhouhua Liu <liuzhouhua@huawei.com> --- plugins/huawei/huawei-nvme.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c index c935f47..b4aef1e 100644 --- a/plugins/huawei/huawei-nvme.c +++ b/plugins/huawei/huawei-nvme.c @@ -41,6 +41,7 @@ #define CREATE_CMD #include "huawei-nvme.h" +#define HW_SSD_PCI_VENDOR_ID 0x19E5 #define ARRAY_NAME_LEN 80 #define NS_NAME_LEN 40 @@ -80,16 +81,15 @@ static int huawei_get_nvme_info(int fd, struct huawei_list_item *item, const cha return err; /*identify huawei device*/ - if (strstr(item->ctrl.mn, "Huawei") == NULL) { + if ((strstr(item->ctrl.mn, "Huawei") == NULL) && + (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { item->huawei_device = false; return 0; } - else - item->huawei_device = true; + item->huawei_device = true; item->nsid = nvme_get_nsid(fd); - err = nvme_identify_ns(fd, item->nsid, - 0, &item->ns); + err = nvme_identify_ns(fd, item->nsid, 0, &item->ns); if (err) return err; -- 2.22.0 On 2020/5/20 16:04, Chaitanya Kulkarni wrote: > On 5/19/20 6:47 PM, l00293085 wrote: >> Hi, I'd like to modify command: nvme huawei list, add huawei vendor id as filter >> > Please modify the subject line and patch description as per the style > present in the tree. >> Signed-off-by: Andy Liu <liuzhouhua@huawei.com> >> Reviewed-by: Wang Zan <wangzan@huawei.com> >> --- >> plugins/huawei/huawei-nvme.c | 10 +++++----- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c >> index c935f47..c7f3307 100644 >> --- a/plugins/huawei/huawei-nvme.c >> +++ b/plugins/huawei/huawei-nvme.c >> @@ -41,6 +41,7 @@ >> #define CREATE_CMD >> #include "huawei-nvme.h" >> >> +#define HW_SSD_PCI_VENDOR_ID 0x19E5 >> #define ARRAY_NAME_LEN 80 >> #define NS_NAME_LEN 40 >> >> @@ -80,16 +81,15 @@ static int huawei_get_nvme_info(int fd, struct huawei_list_item *item, const cha >> return err; >> >> /*identify huawei device*/ >> - if (strstr(item->ctrl.mn, "Huawei") == NULL) { >> + if ((strstr(item->ctrl.mn, "Huawei") == NULL) \ >> + && (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { >> > Consider following coding style to avoid \ in the code and break at the > &&. > if (err) > return err; > > - /*identify huawei device*/ > - if ((strstr(item->ctrl.mn, "Huawei") == NULL) \ > - && (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { > + /* identify huawei device */ > + if ((strstr(item->ctrl.mn, "Huawei") == NULL) && > + (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { > item->huawei_device = false; > return 0; > } > > item->huawei_device = false; >> return 0; >> } >> - else >> - item->huawei_device = true; >> >> + item->huawei_device = true; >> item->nsid = nvme_get_nsid(fd); >> - err = nvme_identify_ns(fd, item->nsid, >> - 0, &item->ns); >> + err = nvme_identify_ns(fd, item->nsid, 0, &item->ns); >> if (err) >> return err; >> >> > > > > . > _______________________________________________ linux-nvme mailing list linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nvme-cli] edit huawei ssd filter 2020-05-21 9:34 ` Zhouhua Liu @ 2020-05-22 0:58 ` Chaitanya Kulkarni 0 siblings, 0 replies; 4+ messages in thread From: Chaitanya Kulkarni @ 2020-05-22 0:58 UTC (permalink / raw) To: Zhouhua Liu, kbusch, linux-nvme; +Cc: wangzan, Kangwenhong, Wangchong (Michael) On 5/21/20 2:35 AM, Zhouhua Liu wrote: > Chaitanya, > > thank you for your suggestion, the new patch is blow: > > Signed-off-by: Zhouhua Liu <liuzhouhua@huawei.com> > --- > plugins/huawei/huawei-nvme.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c > index c935f47..b4aef1e 100644 > --- a/plugins/huawei/huawei-nvme.c > +++ b/plugins/huawei/huawei-nvme.c > @@ -41,6 +41,7 @@ > #define CREATE_CMD > #include "huawei-nvme.h" > > +#define HW_SSD_PCI_VENDOR_ID 0x19E5 > #define ARRAY_NAME_LEN 80 > #define NS_NAME_LEN 40 > > @@ -80,16 +81,15 @@ static int huawei_get_nvme_info(int fd, struct huawei_list_item *item, const cha > return err; > > /*identify huawei device*/ > - if (strstr(item->ctrl.mn, "Huawei") == NULL) { > + if ((strstr(item->ctrl.mn, "Huawei") == NULL) && > + (le16_to_cpu(item->ctrl.vid) != HW_SSD_PCI_VENDOR_ID)) { > item->huawei_device = false; > return 0; > } > - else > - item->huawei_device = true; > > + item->huawei_device = true; > item->nsid = nvme_get_nsid(fd); > - err = nvme_identify_ns(fd, item->nsid, > - 0, &item->ns); > + err = nvme_identify_ns(fd, item->nsid, 0, &item->ns); > if (err) > return err; > This looks okay to me. You need to send a separate patch with V2 prefix and document the code changes from V1. _______________________________________________ linux-nvme mailing list linux-nvme@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-nvme ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-05-22 0:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-05-20 1:39 [PATCH nvme-cli] edit huawei ssd filter l00293085 2020-05-20 8:04 ` Chaitanya Kulkarni 2020-05-21 9:34 ` Zhouhua Liu 2020-05-22 0:58 ` Chaitanya Kulkarni
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).