提交 1ccd7923 编写于 作者: M Michal Nazarewicz 提交者: Greg Kroah-Hartman

USB: gadget: f_mass_storage: use ?: instead of a macro

This commit removes an "OR" macro defined in Mass Storage
Function in favour of a two argument version of "?:" operator
(which is a GCC extension).
Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 17a93611
...@@ -2822,14 +2822,12 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common, ...@@ -2822,14 +2822,12 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
i = 0x0399; i = 0x0399;
} }
} }
#define OR(x, y) ((x) ? (x) : (y))
snprintf(common->inquiry_string, sizeof common->inquiry_string, snprintf(common->inquiry_string, sizeof common->inquiry_string,
"%-8s%-16s%04x", "%-8s%-16s%04x", cfg->vendor_name ?: "Linux",
OR(cfg->vendor_name, "Linux "),
/* Assume product name dependent on the first LUN */ /* Assume product name dependent on the first LUN */
OR(cfg->product_name, common->luns->cdrom cfg->product_name ?: (common->luns->cdrom
? "File-Stor Gadget" ? "File-Stor Gadget"
: "File-CD Gadget "), : "File-CD Gadget"),
i); i);
...@@ -2848,14 +2846,13 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common, ...@@ -2848,14 +2846,13 @@ static struct fsg_common *fsg_common_init(struct fsg_common *common,
/* Tell the thread to start working */ /* Tell the thread to start working */
common->thread_task = common->thread_task =
kthread_create(fsg_main_thread, common, kthread_create(fsg_main_thread, common,
OR(cfg->thread_name, "file-storage")); cfg->thread_name ?: "file-storage");
if (IS_ERR(common->thread_task)) { if (IS_ERR(common->thread_task)) {
rc = PTR_ERR(common->thread_task); rc = PTR_ERR(common->thread_task);
goto error_release; goto error_release;
} }
init_completion(&common->thread_notifier); init_completion(&common->thread_notifier);
init_waitqueue_head(&common->fsg_wait); init_waitqueue_head(&common->fsg_wait);
#undef OR
/* Information */ /* Information */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册