Message ID | 20210507063528.tvlbu2cwnlczgbga@kewl-virtual-machine |
---|---|
State | New |
Headers | show |
Series | drivers: memstick: core:ms_block.c: Fix alignment of block comment | expand |
On Fri, 7 May 2021 at 08:35, Shubhankar Kuranagatti <shubhankarvk@gmail.com> wrote: > > A * has been added to subsequent lines of block comment > The closing */ has been shifted to a new line > A new line has been give after declaration > This is done to maintain code uniformity. > > Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@gmail.com> Applied for next, thanks! Kind regards Uffe > --- > drivers/memstick/core/ms_block.c | 37 +++++++++++++++++++++----------- > 1 file changed, 24 insertions(+), 13 deletions(-) > > diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c > index 8004dd64d09a..d971acd98236 100644 > --- a/drivers/memstick/core/ms_block.c > +++ b/drivers/memstick/core/ms_block.c > @@ -129,7 +129,7 @@ static int msb_sg_compare_to_buffer(struct scatterlist *sg, > * Each zone consists of 512 eraseblocks, out of which in first > * zone 494 are used and 496 are for all following zones. > * Therefore zone #0 hosts blocks 0-493, zone #1 blocks 494-988, etc... > -*/ > + */ > static int msb_get_zone_from_lba(int lba) > { > if (lba < 494) > @@ -348,8 +348,9 @@ static int h_msb_read_page(struct memstick_dev *card, > switch (msb->state) { > case MSB_RP_SEND_BLOCK_ADDRESS: > /* msb_write_regs sometimes "fails" because it needs to update > - the reg window, and thus it returns request for that. > - Then we stay in this state and retry */ > + * the reg window, and thus it returns request for that. > + * Then we stay in this state and retry > + */ > if (!msb_write_regs(msb, > offsetof(struct ms_register, param), > sizeof(struct ms_param_register), > @@ -368,7 +369,8 @@ static int h_msb_read_page(struct memstick_dev *card, > case MSB_RP_SEND_INT_REQ: > msb->state = MSB_RP_RECEIVE_INT_REQ_RESULT; > /* If dont actually need to send the int read request (only in > - serial mode), then just fall through */ > + * serial mode), then just fall through > + */ > if (msb_read_int_reg(msb, -1)) > return 0; > fallthrough; > @@ -702,7 +704,8 @@ static int h_msb_parallel_switch(struct memstick_dev *card, > > case MSB_PS_SWICH_HOST: > /* Set parallel interface on our side + send a dummy request > - to see if card responds */ > + * to see if card responds > + */ > host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); > memstick_init_req(mrq, MS_TPC_GET_INT, NULL, 1); > msb->state = MSB_PS_CONFIRM; > @@ -821,6 +824,7 @@ static int msb_mark_page_bad(struct msb_data *msb, int pba, int page) > static int msb_erase_block(struct msb_data *msb, u16 pba) > { > int error, try; > + > if (msb->read_only) > return -EROFS; > > @@ -997,6 +1001,7 @@ static int msb_write_block(struct msb_data *msb, > u16 pba, u32 lba, struct scatterlist *sg, int offset) > { > int error, current_try = 1; > + > BUG_ON(sg->length < msb->page_size); > > if (msb->read_only) > @@ -1045,11 +1050,12 @@ static int msb_write_block(struct msb_data *msb, > error = msb_run_state_machine(msb, h_msb_write_block); > > /* Sector we just wrote to is assumed erased since its pba > - was erased. If it wasn't erased, write will succeed > - and will just clear the bits that were set in the block > - thus test that what we have written, > - matches what we expect. > - We do trust the blocks that we erased */ > + * was erased. If it wasn't erased, write will succeed > + * and will just clear the bits that were set in the block > + * thus test that what we have written, > + * matches what we expect. > + * We do trust the blocks that we erased > + */ > if (!error && (verify_writes || > !test_bit(pba, msb->erased_blocks_bitmap))) > error = msb_verify_block(msb, pba, sg, offset); > @@ -1493,6 +1499,7 @@ static int msb_ftl_scan(struct msb_data *msb) > static void msb_cache_flush_timer(struct timer_list *t) > { > struct msb_data *msb = from_timer(msb, t, cache_flush_timer); > + > msb->need_flush_cache = true; > queue_work(msb->io_queue, &msb->io_work); > } > @@ -1673,7 +1680,8 @@ static int msb_cache_read(struct msb_data *msb, int lba, > * This table content isn't that importaint, > * One could put here different values, providing that they still > * cover whole disk. > - * 64 MB entry is what windows reports for my 64M memstick */ > + * 64 MB entry is what windows reports for my 64M memstick > + */ > > static const struct chs_entry chs_table[] = { > /* size sectors cylynders heads */ > @@ -1706,8 +1714,9 @@ static int msb_init_card(struct memstick_dev *card) > return error; > > /* Due to a bug in Jmicron driver written by Alex Dubov, > - its serial mode barely works, > - so we switch to parallel mode right away */ > + * its serial mode barely works, > + * so we switch to parallel mode right away > + */ > if (host->caps & MEMSTICK_CAP_PAR4) > msb_switch_to_parallel(msb); > > @@ -2033,6 +2042,7 @@ static blk_status_t msb_queue_rq(struct blk_mq_hw_ctx *hctx, > static int msb_check_card(struct memstick_dev *card) > { > struct msb_data *msb = memstick_get_drvdata(card); > + > return (msb->card_dead == 0); > } > > @@ -2333,6 +2343,7 @@ static struct memstick_driver msb_driver = { > static int __init msb_init(void) > { > int rc = memstick_register_driver(&msb_driver); > + > if (rc) > pr_err("failed to register memstick driver (error %d)\n", rc); > > -- > 2.17.1 >
diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_block.c index 8004dd64d09a..d971acd98236 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -129,7 +129,7 @@ static int msb_sg_compare_to_buffer(struct scatterlist *sg, * Each zone consists of 512 eraseblocks, out of which in first * zone 494 are used and 496 are for all following zones. * Therefore zone #0 hosts blocks 0-493, zone #1 blocks 494-988, etc... -*/ + */ static int msb_get_zone_from_lba(int lba) { if (lba < 494) @@ -348,8 +348,9 @@ static int h_msb_read_page(struct memstick_dev *card, switch (msb->state) { case MSB_RP_SEND_BLOCK_ADDRESS: /* msb_write_regs sometimes "fails" because it needs to update - the reg window, and thus it returns request for that. - Then we stay in this state and retry */ + * the reg window, and thus it returns request for that. + * Then we stay in this state and retry + */ if (!msb_write_regs(msb, offsetof(struct ms_register, param), sizeof(struct ms_param_register), @@ -368,7 +369,8 @@ static int h_msb_read_page(struct memstick_dev *card, case MSB_RP_SEND_INT_REQ: msb->state = MSB_RP_RECEIVE_INT_REQ_RESULT; /* If dont actually need to send the int read request (only in - serial mode), then just fall through */ + * serial mode), then just fall through + */ if (msb_read_int_reg(msb, -1)) return 0; fallthrough; @@ -702,7 +704,8 @@ static int h_msb_parallel_switch(struct memstick_dev *card, case MSB_PS_SWICH_HOST: /* Set parallel interface on our side + send a dummy request - to see if card responds */ + * to see if card responds + */ host->set_param(host, MEMSTICK_INTERFACE, MEMSTICK_PAR4); memstick_init_req(mrq, MS_TPC_GET_INT, NULL, 1); msb->state = MSB_PS_CONFIRM; @@ -821,6 +824,7 @@ static int msb_mark_page_bad(struct msb_data *msb, int pba, int page) static int msb_erase_block(struct msb_data *msb, u16 pba) { int error, try; + if (msb->read_only) return -EROFS; @@ -997,6 +1001,7 @@ static int msb_write_block(struct msb_data *msb, u16 pba, u32 lba, struct scatterlist *sg, int offset) { int error, current_try = 1; + BUG_ON(sg->length < msb->page_size); if (msb->read_only) @@ -1045,11 +1050,12 @@ static int msb_write_block(struct msb_data *msb, error = msb_run_state_machine(msb, h_msb_write_block); /* Sector we just wrote to is assumed erased since its pba - was erased. If it wasn't erased, write will succeed - and will just clear the bits that were set in the block - thus test that what we have written, - matches what we expect. - We do trust the blocks that we erased */ + * was erased. If it wasn't erased, write will succeed + * and will just clear the bits that were set in the block + * thus test that what we have written, + * matches what we expect. + * We do trust the blocks that we erased + */ if (!error && (verify_writes || !test_bit(pba, msb->erased_blocks_bitmap))) error = msb_verify_block(msb, pba, sg, offset); @@ -1493,6 +1499,7 @@ static int msb_ftl_scan(struct msb_data *msb) static void msb_cache_flush_timer(struct timer_list *t) { struct msb_data *msb = from_timer(msb, t, cache_flush_timer); + msb->need_flush_cache = true; queue_work(msb->io_queue, &msb->io_work); } @@ -1673,7 +1680,8 @@ static int msb_cache_read(struct msb_data *msb, int lba, * This table content isn't that importaint, * One could put here different values, providing that they still * cover whole disk. - * 64 MB entry is what windows reports for my 64M memstick */ + * 64 MB entry is what windows reports for my 64M memstick + */ static const struct chs_entry chs_table[] = { /* size sectors cylynders heads */ @@ -1706,8 +1714,9 @@ static int msb_init_card(struct memstick_dev *card) return error; /* Due to a bug in Jmicron driver written by Alex Dubov, - its serial mode barely works, - so we switch to parallel mode right away */ + * its serial mode barely works, + * so we switch to parallel mode right away + */ if (host->caps & MEMSTICK_CAP_PAR4) msb_switch_to_parallel(msb); @@ -2033,6 +2042,7 @@ static blk_status_t msb_queue_rq(struct blk_mq_hw_ctx *hctx, static int msb_check_card(struct memstick_dev *card) { struct msb_data *msb = memstick_get_drvdata(card); + return (msb->card_dead == 0); } @@ -2333,6 +2343,7 @@ static struct memstick_driver msb_driver = { static int __init msb_init(void) { int rc = memstick_register_driver(&msb_driver); + if (rc) pr_err("failed to register memstick driver (error %d)\n", rc);
A * has been added to subsequent lines of block comment The closing */ has been shifted to a new line A new line has been give after declaration This is done to maintain code uniformity. Signed-off-by: Shubhankar Kuranagatti <shubhankarvk@gmail.com> --- drivers/memstick/core/ms_block.c | 37 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 13 deletions(-)