diff options
author | Emmanuel Vadot <manu@FreeBSD.org> | 2020-08-04 20:02:23 +0000 |
---|---|---|
committer | Emmanuel Vadot <manu@FreeBSD.org> | 2020-08-04 20:02:23 +0000 |
commit | cd2f74af6f191eb2d803abdb4199ff7f063704eb (patch) | |
tree | 31e3cd1ab3c4d5af08fb5b77bf6057feacfd0e27 /sys/cam/mmc/mmc_xpt.c | |
parent | 25f965fdaac3722f2cfaf1b698737fb5fbef3421 (diff) | |
download | src-cd2f74af6f191eb2d803abdb4199ff7f063704eb.tar.gz src-cd2f74af6f191eb2d803abdb4199ff7f063704eb.zip |
mmcam: Use a static length sbuf buffer
We cannot sleep during cam proto_announce and sbuf sleeps so use
a static length buffer like nvme(4)
Reviewed by: kibab
Differential Revision: https://reviews.freebsd.org/D25949
Notes
Notes:
svn path=/head/; revision=363861
Diffstat (limited to 'sys/cam/mmc/mmc_xpt.c')
-rw-r--r-- | sys/cam/mmc/mmc_xpt.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/cam/mmc/mmc_xpt.c b/sys/cam/mmc/mmc_xpt.c index d91ee4e4f190..a4389f1eabb2 100644 --- a/sys/cam/mmc/mmc_xpt.c +++ b/sys/cam/mmc/mmc_xpt.c @@ -411,13 +411,11 @@ mmccam_start_discovery(struct cam_sim *sim) { } /* This func is called per attached device :-( */ -void -mmc_print_ident(struct mmc_params *ident_data) +static void +mmc_print_ident(struct mmc_params *ident_data, struct sbuf *sb) { - struct sbuf *sb; bool space = false; - sb = sbuf_new_auto(); sbuf_printf(sb, "Relative addr: %08x\n", ident_data->card_rca); sbuf_printf(sb, "Card features: <"); if (ident_data->card_features & CARD_FEATURE_MMC) { @@ -463,13 +461,20 @@ mmc_print_ident(struct mmc_params *ident_data) static void mmc_proto_announce(struct cam_ed *device) { - mmc_print_ident(&device->mmc_ident_data); + struct sbuf sb; + char buffer[256]; + + sbuf_new(&sb, buffer, sizeof(buffer), SBUF_FIXEDLEN); + mmc_print_ident(&device->mmc_ident_data, &sb); + sbuf_finish(&sb); + sbuf_putbuf(&sb); } static void mmc_proto_denounce(struct cam_ed *device) { - mmc_print_ident(&device->mmc_ident_data); + + mmc_proto_announce(device); } static void |