Message ID | 20190304180920.21534-1-svens@stackframe.org |
---|---|
State | New |
Headers | show |
Series | [1/5] lsi: use ldn_le_p()/stn_le_p() | expand |
On 3/4/19 12:09 PM, Sven Schnelle wrote:
> Signed-off-by: Sven Schnelle <svens@stackframe.org>
The commit header says "what" (good), but the commit body says nothing
at all (generally, it should say "why"). If you give your reviewers a
reason why it is good to use the new functions, it makes it easier to
apply your patch.
Also, don't forget to send a 0/5 cover letter when sending a patch
series; you can have git do this for you with 'git config
format.coverletter auto'. https://wiki.qemu.org/Contribute/SubmitAPatch
has more hints for improved patch handling.
Hi Eric, On Mon, Mar 04, 2019 at 12:40:50PM -0600, Eric Blake wrote: > On 3/4/19 12:09 PM, Sven Schnelle wrote: > > Signed-off-by: Sven Schnelle <svens@stackframe.org> > > The commit header says "what" (good), but the commit body says nothing at > all (generally, it should say "why"). If you give your reviewers a reason > why it is good to use the new functions, it makes it easier to apply your > patch. > > Also, don't forget to send a 0/5 cover letter when sending a patch series; > you can have git do this for you with 'git config format.coverletter auto'. > https://wiki.qemu.org/Contribute/SubmitAPatch has more hints for improved > patch handling. Thanks, will keep this in mind, sorry. Should i resend the series? Regards Sven
On 3/4/19 2:38 PM, Sven Schnelle wrote: > Hi Eric, > > On Mon, Mar 04, 2019 at 12:40:50PM -0600, Eric Blake wrote: >> On 3/4/19 12:09 PM, Sven Schnelle wrote: >>> Signed-off-by: Sven Schnelle <svens@stackframe.org> >> >> The commit header says "what" (good), but the commit body says nothing at >> all (generally, it should say "why"). If you give your reviewers a reason >> why it is good to use the new functions, it makes it easier to apply your >> patch. >> >> Also, don't forget to send a 0/5 cover letter when sending a patch series; >> you can have git do this for you with 'git config format.coverletter auto'. >> https://wiki.qemu.org/Contribute/SubmitAPatch has more hints for improved >> patch handling. > > Thanks, will keep this in mind, sorry. Should i resend the series? Up to you, but if it were me, I'd probably wait a day or two for any other review comments to address those at the same time, or for a definitive answer from the particular maintainer that will be including your patches.
On 3/4/19 7:09 PM, Sven Schnelle wrote: > Signed-off-by: Sven Schnelle <svens@stackframe.org> > --- > hw/scsi/lsi53c895a.c | 24 ++++-------------------- > 1 file changed, 4 insertions(+), 20 deletions(-) > > diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c > index 25c6926039..6d280f8b77 100644 > --- a/hw/scsi/lsi53c895a.c > +++ b/hw/scsi/lsi53c895a.c > @@ -289,8 +289,7 @@ typedef struct { > uint8_t sbr; > uint32_t adder; > > - /* Script ram is stored as 32-bit words in host byteorder. */ > - uint32_t script_ram[2048]; > + uint8_t script_ram[8192]; I'm tempted to use here: uint8_t script_ram[2048 * sizeof(uint32_t)]; > } LSIState; > > #define TYPE_LSI53C810 "lsi53c810" > @@ -2077,29 +2076,14 @@ static void lsi_ram_write(void *opaque, hwaddr addr, > uint64_t val, unsigned size) > { > LSIState *s = opaque; > - uint32_t newval; > - uint32_t mask; > - int shift; > - > - newval = s->script_ram[addr >> 2]; > - shift = (addr & 3) * 8; > - mask = ((uint64_t)1 << (size * 8)) - 1; > - newval &= ~(mask << shift); > - newval |= val << shift; > - s->script_ram[addr >> 2] = newval; > + stn_le_p(s->script_ram + addr, size, val); > } > > static uint64_t lsi_ram_read(void *opaque, hwaddr addr, > unsigned size) > { > LSIState *s = opaque; > - uint32_t val; > - uint32_t mask; > - Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> > - val = s->script_ram[addr >> 2]; > - mask = ((uint64_t)1 << (size * 8)) - 1; > - val >>= (addr & 3) * 8; > - return val & mask; > + return ldn_le_p(s->script_ram + addr, size); > } > > static const MemoryRegionOps lsi_ram_ops = { > @@ -2242,7 +2226,7 @@ static const VMStateDescription vmstate_lsi_scsi = { > VMSTATE_BUFFER_UNSAFE(scratch, LSIState, 0, 18 * sizeof(uint32_t)), > VMSTATE_UINT8(sbr, LSIState), > > - VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 0, 2048 * sizeof(uint32_t)), > + VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 0, 8192), > VMSTATE_END_OF_LIST() > } > }; >
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 25c6926039..6d280f8b77 100644 --- a/hw/scsi/lsi53c895a.c +++ b/hw/scsi/lsi53c895a.c @@ -289,8 +289,7 @@ typedef struct { uint8_t sbr; uint32_t adder; - /* Script ram is stored as 32-bit words in host byteorder. */ - uint32_t script_ram[2048]; + uint8_t script_ram[8192]; } LSIState; #define TYPE_LSI53C810 "lsi53c810" @@ -2077,29 +2076,14 @@ static void lsi_ram_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { LSIState *s = opaque; - uint32_t newval; - uint32_t mask; - int shift; - - newval = s->script_ram[addr >> 2]; - shift = (addr & 3) * 8; - mask = ((uint64_t)1 << (size * 8)) - 1; - newval &= ~(mask << shift); - newval |= val << shift; - s->script_ram[addr >> 2] = newval; + stn_le_p(s->script_ram + addr, size, val); } static uint64_t lsi_ram_read(void *opaque, hwaddr addr, unsigned size) { LSIState *s = opaque; - uint32_t val; - uint32_t mask; - - val = s->script_ram[addr >> 2]; - mask = ((uint64_t)1 << (size * 8)) - 1; - val >>= (addr & 3) * 8; - return val & mask; + return ldn_le_p(s->script_ram + addr, size); } static const MemoryRegionOps lsi_ram_ops = { @@ -2242,7 +2226,7 @@ static const VMStateDescription vmstate_lsi_scsi = { VMSTATE_BUFFER_UNSAFE(scratch, LSIState, 0, 18 * sizeof(uint32_t)), VMSTATE_UINT8(sbr, LSIState), - VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 0, 2048 * sizeof(uint32_t)), + VMSTATE_BUFFER_UNSAFE(script_ram, LSIState, 0, 8192), VMSTATE_END_OF_LIST() } };
Signed-off-by: Sven Schnelle <svens@stackframe.org> --- hw/scsi/lsi53c895a.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-)