{"id":804525,"url":"http://patchwork.ozlabs.org/api/patches/804525/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/1503414919-30820-11-git-send-email-bmeng.cn@gmail.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1503414919-30820-11-git-send-email-bmeng.cn@gmail.com>","list_archive_url":null,"date":"2017-08-22T15:15:15","name":"[U-Boot,10/14] nvme: Use blk_create_devicef() API","commit_ref":"d5b7ee9c6e19993b10b549ac763aa7db8dbacee0","pull_url":null,"state":"accepted","archived":false,"hash":"e163896ff082d1dc3271255c8be2f92f19c82d3d","submitter":{"id":64981,"url":"http://patchwork.ozlabs.org/api/people/64981/?format=json","name":"Bin Meng","email":"bmeng.cn@gmail.com"},"delegate":{"id":3651,"url":"http://patchwork.ozlabs.org/api/users/3651/?format=json","username":"trini","first_name":"Tom","last_name":"Rini","email":"trini@ti.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/1503414919-30820-11-git-send-email-bmeng.cn@gmail.com/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/804525/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/804525/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=lists.denx.de\n\t(client-ip=81.169.180.215; helo=lists.denx.de;\n\tenvelope-from=u-boot-bounces@lists.denx.de;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"kGzkAP/v\"; dkim-atps=neutral"],"Received":["from lists.denx.de (dione.denx.de [81.169.180.215])\n\tby ozlabs.org (Postfix) with ESMTP id 3xcDfm3TFvz9sNd\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 23 Aug 2017 01:16:31 +1000 (AEST)","by lists.denx.de (Postfix, from userid 105)\n\tid 83A2CC21EFF; Tue, 22 Aug 2017 15:12:48 +0000 (UTC)","from lists.denx.de (localhost [IPv6:::1])\n\tby lists.denx.de (Postfix) with ESMTP id 183B3C21EBE;\n\tTue, 22 Aug 2017 15:11:34 +0000 (UTC)","by lists.denx.de (Postfix, from userid 105)\n\tid 7AC05C21EBE; Tue, 22 Aug 2017 15:11:16 +0000 (UTC)","from mail-io0-f195.google.com (mail-io0-f195.google.com\n\t[209.85.223.195])\n\tby lists.denx.de (Postfix) with ESMTPS id 82C85C21EDE\n\tfor <u-boot@lists.denx.de>; Tue, 22 Aug 2017 15:11:13 +0000 (UTC)","by mail-io0-f195.google.com with SMTP id g71so5207828ioe.5\n\tfor <u-boot@lists.denx.de>; Tue, 22 Aug 2017 08:11:13 -0700 (PDT)","from ala-d2121-lx1.wrs.com (unknown-156-139.windriver.com.\n\t[147.11.156.139]) by smtp.gmail.com with ESMTPSA id\n\ta189sm5182572itd.5.2017.08.22.08.11.11\n\t(version=TLS1_1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 22 Aug 2017 08:11:11 -0700 (PDT)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=0.0 required=5.0 tests=FREEMAIL_FROM,\n\tRCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,\n\tT_DKIM_INVALID autolearn=unavailable\n\tautolearn_force=no version=3.4.0","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:subject:date:message-id:in-reply-to:references;\n\tbh=5gxiuYijV2RglFYvU5xmpCbvcCAE699lecYm7LJVMW0=;\n\tb=kGzkAP/vil8CmoUjfL7Mq6eFOLSky0q8RnDoOcEyNubAJxhXAIpumKfOK05U5pSqCW\n\tveI9TPbtzsuJWUs/xeOnXjccM+3P46poglMV7Kplqe07mhzrRsTjuNSDFCNKklxyVsNu\n\tRb7wGUdUHcqQvN7As5DPin9eULYMtOHJ46uTSGoZMCUnMny08EyPp/6F2S4F1qzBs9Tx\n\tOVLO8V9rWjzSJAE8vp02I6J55hcULYXd0FNYMn1zycAvZ/Pr9y8KUf8QkD2fc79XZoHE\n\tOrCwfvVU9Vv1H/AFIBxwXUCm2GYaarOfd217Yz81tbA2HDx+FlgrVl6qNWacx64DwANy\n\taOcg==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=5gxiuYijV2RglFYvU5xmpCbvcCAE699lecYm7LJVMW0=;\n\tb=eMCZ+Jst80xN7P5VahCgfl4/4Z6eMtccs1ulP/357TlHlvid/ooSVE5PDfXLR6APXT\n\t5n1sh24aDOiAbLTJIYY0Ru/ltx5uu+YMHD0U/wlFXVc6NiOttEd4L/q/mCFdT8FVEy2g\n\tRudwvPhLFZulY2/hdmP0qe234IMlfl8GoshvutXtMidt8sSgEYx1wOxqJVNIykqX5ZsK\n\tk1obxa/uSb+ySGwryMmJpr0Alp4Wqt+ZQmwbBGFQgO/KukWPtNERmYf0ciRKfYocswNK\n\tBNpxl25h1p0NXOWgc92x9Slr0tq+3fYiJj5oGWIzZvlr/Q3K+W5eacgPNIWssgE8s2rq\n\tN1Fg==","X-Gm-Message-State":"AHYfb5gP2epSDPfDAUqIgUSwtgeNsczCwHin1xz8zt+i+IBLQWWanPIy\n\tVXfepT/3/Qu37pHp","X-Received":"by 10.107.15.195 with SMTP id 64mr857577iop.121.1503414672512;\n\tTue, 22 Aug 2017 08:11:12 -0700 (PDT)","From":"Bin Meng <bmeng.cn@gmail.com>","To":"Tom Rini <trini@konsulko.com>, U-Boot Mailing List <u-boot@lists.denx.de>","Date":"Tue, 22 Aug 2017 08:15:15 -0700","Message-Id":"<1503414919-30820-11-git-send-email-bmeng.cn@gmail.com>","X-Mailer":"git-send-email 1.7.9.5","In-Reply-To":"<1503414919-30820-1-git-send-email-bmeng.cn@gmail.com>","References":"<1503414919-30820-1-git-send-email-bmeng.cn@gmail.com>","Subject":"[U-Boot] [PATCH 10/14] nvme: Use blk_create_devicef() API","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.18","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<http://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n\t<mailto:u-boot-request@lists.denx.de?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>"},"content":"The codes in nvme_uclass_post_probe() can be replaced to call the\nblk_create_devicef() API directly.\n\nSigned-off-by: Bin Meng <bmeng.cn@gmail.com>\n---\n\n drivers/nvme/nvme-uclass.c | 12 +++---------\n 1 file changed, 3 insertions(+), 9 deletions(-)","diff":"diff --git a/drivers/nvme/nvme-uclass.c b/drivers/nvme/nvme-uclass.c\nindex 0895bc9..334628c 100644\n--- a/drivers/nvme/nvme-uclass.c\n+++ b/drivers/nvme/nvme-uclass.c\n@@ -26,28 +26,22 @@ static int nvme_info_init(struct uclass *uc)\n static int nvme_uclass_post_probe(struct udevice *udev)\n {\n \tchar name[20];\n-\tchar *str;\n \tstruct udevice *ns_udev;\n \tint i, ret;\n \tstruct nvme_dev *ndev = dev_get_priv(udev);\n \n \t/* Create a blk device for each namespace */\n \tfor (i = 0; i < ndev->nn; i++) {\n-\t\tsprintf(name, \"nvme-blk#%d\", nvme_info->ns_num);\n-\t\tstr = strdup(name);\n-\t\tif (!str)\n-\t\t\treturn -ENOMEM;\n+\t\tsprintf(name, \"blk#%d\", nvme_info->ns_num);\n \n \t\t/* The real blksz and size will be set by nvme_blk_probe() */\n-\t\tret = blk_create_device(udev, \"nvme-blk\", str, IF_TYPE_NVME,\n-\t\t\t\t\tnvme_info->ns_num++, 512, 0, &ns_udev);\n+\t\tret = blk_create_devicef(udev, \"nvme-blk\", name, IF_TYPE_NVME,\n+\t\t\t\t\t nvme_info->ns_num++, 512, 0, &ns_udev);\n \t\tif (ret) {\n-\t\t\tfree(str);\n \t\t\tnvme_info->ns_num--;\n \n \t\t\treturn ret;\n \t\t}\n-\t\tdevice_set_name_alloced(ns_udev);\n \t}\n \n \treturn 0;\n","prefixes":["U-Boot","10/14"]}