Gabe Black has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/38484 )

Change subject: dev: Style fixes in the ARM HDLCD device.
......................................................................

dev: Style fixes in the ARM HDLCD device.

Change-Id: I230e0e0db879a56bc23c3ed439b9722e76cdd8e4
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38484
Reviewed-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-by: Daniel Carvalho <oda...@yahoo.com.br>
Maintainer: Andreas Sandberg <andreas.sandb...@arm.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/dev/arm/hdlcd.cc
M src/dev/arm/hdlcd.hh
2 files changed, 50 insertions(+), 64 deletions(-)

Approvals:
Andreas Sandberg: Looks good to me, but someone else must approve; Looks good to me, approved
  Daniel Carvalho: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/dev/arm/hdlcd.cc b/src/dev/arm/hdlcd.cc
index a5df836..bb56da6 100644
--- a/src/dev/arm/hdlcd.cc
+++ b/src/dev/arm/hdlcd.cc
@@ -65,25 +65,9 @@
       pixelBufferSize(p.pixel_buffer_size),
       virtRefreshRate(p.virt_refresh_rate),

-      // Registers
-      version(VERSION_RESETV),
-      int_rawstat(0), int_mask(0),
-
-      fb_base(0), fb_line_length(0), fb_line_count(0), fb_line_pitch(0),
-      bus_options(BUS_OPTIONS_RESETV),
-
-      v_sync(0), v_back_porch(0), v_data(0), v_front_porch(0),
-      h_sync(0), h_back_porch(0), h_data(0), h_front_porch(0),
-      polarities(0),
-
-      command(0),
-
-      pixel_format(0),
-      red_select(0), green_select(0), blue_select(0),
-
       virtRefreshEvent([this]{ virtRefresh(); }, name()),
       // Other
- imgFormat(p.frame_format), pic(NULL), conv(PixelConverter::rgba8888_le),
+      imgFormat(p.frame_format),
       pixelPump(*this, *p.pxl_clk, p.pixel_chunk),
       stats(this)
 {
@@ -93,10 +77,6 @@
     imgWriter = createImgWriter(imgFormat, &pixelPump.fb);
 }

-HDLcd::~HDLcd()
-{
-}
-
 HDLcd::
 HDLcdStats::HDLcdStats(Stats::Group *parent)
     : Stats::Group(parent, "HDLcd"),
@@ -234,12 +214,12 @@
     assert(pkt->getAddr() >= pioAddr &&
            pkt->getAddr() < pioAddr + pioSize);

-    const Addr daddr(pkt->getAddr() - pioAddr);
+    const Addr daddr = pkt->getAddr() - pioAddr;
     panic_if(pkt->getSize() != 4,
              "Unhandled read size (address: 0x.4x, size: %u)",
              daddr, pkt->getSize());

-    const uint32_t data(readReg(daddr));
+    const uint32_t data = readReg(daddr);
     DPRINTF(HDLcd, "read register 0x%04x: 0x%x\n", daddr, data);

     pkt->setLE<uint32_t>(data);
@@ -254,11 +234,11 @@
     assert(pkt->getAddr() >= pioAddr &&
            pkt->getAddr() < pioAddr + pioSize);

-    const Addr daddr(pkt->getAddr() - pioAddr);
+    const Addr daddr = pkt->getAddr() - pioAddr;
     panic_if(pkt->getSize() != 4,
              "Unhandled read size (address: 0x.4x, size: %u)",
              daddr, pkt->getSize());
-    const uint32_t data(pkt->getLE<uint32_t>());
+    const uint32_t data = pkt->getLE<uint32_t>();
     DPRINTF(HDLcd, "write register 0x%04x: 0x%x\n", daddr, data);

     writeReg(daddr, data);
@@ -430,8 +410,8 @@
 PixelConverter
 HDLcd::pixelConverter() const
 {
-    ByteOrder byte_order(
-        pixel_format.big_endian ? ByteOrder::big : ByteOrder::little);
+    ByteOrder byte_order =
+        pixel_format.big_endian ? ByteOrder::big : ByteOrder::little;

     /* Some Linux kernels have a broken driver that swaps the red and
      * blue color select registers. */
@@ -467,17 +447,15 @@
         return;
     }

-    const uint32_t dma_burst_flags(bus_options.burst_len);
-    const uint32_t dma_burst_len(
-        dma_burst_flags ?
-        (1UL << (findMsbSet(dma_burst_flags) - 1)) :
-        MAX_BURST_LEN);
+    const uint32_t dma_burst_flags = bus_options.burst_len;
+    const uint32_t dma_burst_len = dma_burst_flags ?
+        (1UL << (findMsbSet(dma_burst_flags) - 1)) : MAX_BURST_LEN;
     // Some drivers seem to set the DMA line count incorrectly. This
     // could either be a driver bug or a specification bug. Unlike for
     // timings, the specification does not require 1 to be added to
     // the DMA engine's line count.
-    const uint32_t dma_lines(
-        fb_line_count + (workaroundDmaLineCount ? 1 : 0));
+    const uint32_t dma_lines =
+        fb_line_count + (workaroundDmaLineCount ? 1 : 0);

     dmaEngine.reset(new DmaEngine(
                         *this, pixelBufferSize,
@@ -583,7 +561,7 @@
 void
 HDLcd::setInterrupts(uint32_t ints, uint32_t mask)
 {
-    const bool old_ints(intStatus());
+    const bool old_ints = intStatus();

     int_mask = mask;
     int_rawstat = ints;
@@ -673,7 +651,7 @@
 void
 HDLcd::PixelPump::dumpSettings()
 {
-    const DisplayTimings &t(timings());
+    const DisplayTimings &t = timings();

     inform("PixelPump width: %u", t.width);
     inform("PixelPump height: %u", t.height);
diff --git a/src/dev/arm/hdlcd.hh b/src/dev/arm/hdlcd.hh
index cdf3331..30f14d9 100644
--- a/src/dev/arm/hdlcd.hh
+++ b/src/dev/arm/hdlcd.hh
@@ -91,7 +91,6 @@
 {
   public:
     HDLcd(const HDLcdParams &p);
-    ~HDLcd();

     void serialize(CheckpointOut &cp) const override;
     void unserialize(CheckpointIn &cp) override;
@@ -226,28 +225,31 @@
      * HDLCD register contents.
      */
     /**@{*/
-    const VersionReg version;       /**< Version register */
-    uint32_t int_rawstat;           /**< Interrupt raw status register */
-    uint32_t int_mask;              /**< Interrupt mask register */
- uint32_t fb_base; /**< Frame buffer base address register */ - uint32_t fb_line_length; /**< Frame buffer Line length register */ - FbLineCountReg fb_line_count; /**< Frame buffer Line count register */ - int32_t fb_line_pitch; /**< Frame buffer Line pitch register */
-    BusOptsReg bus_options;         /**< Bus options register */
-    TimingReg v_sync;               /**< Vertical sync width register */
- TimingReg v_back_porch; /**< Vertical back porch width register */
-    TimingReg v_data;               /**< Vertical data width register */
- TimingReg v_front_porch; /**< Vertical front porch width register */
-    TimingReg h_sync;               /**< Horizontal sync width register */
- TimingReg h_back_porch; /**< Horizontal back porch width register */
-    TimingReg h_data;               /**< Horizontal data width register */
- TimingReg h_front_porch; /**< Horizontal front porch width reg */
-    PolaritiesReg polarities;       /**< Polarities register */
-    CommandReg command;             /**< Command register */
-    PixelFormatReg pixel_format;    /**< Pixel format register */
-    ColorSelectReg red_select;      /**< Red color select register */
-    ColorSelectReg green_select;    /**< Green color select register */
-    ColorSelectReg blue_select;     /**< Blue color select register */
+    const VersionReg version = VERSION_RESETV;
+                                    /**< Version register */
+    uint32_t int_rawstat = 0;       /**< Interrupt raw status register */
+    uint32_t int_mask = 0;          /**< Interrupt mask register */
+ uint32_t fb_base = 0; /**< Frame buffer base address register */ + uint32_t fb_line_length = 0; /**< Frame buffer Line length register */ + /**< Frame buffer Line count register */
+    FbLineCountReg fb_line_count = 0;
+ int32_t fb_line_pitch = 0; /**< Frame buffer Line pitch register */
+    BusOptsReg bus_options = BUS_OPTIONS_RESETV;
+                                    /**< Bus options register */
+    TimingReg v_sync = 0;           /**< Vertical sync width register */
+ TimingReg v_back_porch = 0; /**< Vertical back porch width register */
+    TimingReg v_data = 0;           /**< Vertical data width register */
+ TimingReg v_front_porch = 0; /**< Vertical front porch width register */
+    TimingReg h_sync = 0;           /**< Horizontal sync width register */
+    TimingReg h_back_porch = 0;     /**< Horizontal back porch width reg */
+    TimingReg h_data = 0;           /**< Horizontal data width register */
+ TimingReg h_front_porch = 0; /**< Horizontal front porch width reg */
+    PolaritiesReg polarities = 0;   /**< Polarities register */
+    CommandReg command = 0;         /**< Command register */
+    PixelFormatReg pixel_format = 0;/**< Pixel format register */
+    ColorSelectReg red_select = 0;  /**< Red color select register */
+    ColorSelectReg green_select = 0;/**< Green color select register */
+    ColorSelectReg blue_select = 0; /**< Blue color select register */
     /** @} */

     uint32_t readReg(Addr offset);
@@ -298,7 +300,9 @@
      * @see setInterrupts
      * @param ints Set of interrupts to raise
      */
-    void intRaise(uint32_t ints) {
+    void
+    intRaise(uint32_t ints)
+    {
         setInterrupts(int_rawstat | ints, int_mask);
     }

@@ -308,7 +312,9 @@
      * @see setInterrupts
      * @param ints Set of interrupts to clear
      */
-    void intClear(uint32_t ints) {
+    void
+    intClear(uint32_t ints)
+    {
         setInterrupts(int_rawstat & ~ints, int_mask);
     }

@@ -330,7 +336,9 @@
         void onVSyncBegin() override { return parent.pxlVSyncBegin(); }
         void onVSyncEnd() override { return parent.pxlVSyncEnd(); }

-        void onUnderrun(unsigned x, unsigned y) override {
+        void
+        onUnderrun(unsigned x, unsigned y) override
+        {
             parent.pxlUnderrun();
         }

@@ -351,10 +359,10 @@
     Enums::ImageFormat imgFormat;

     /** Picture of what the current frame buffer looks like */
-    OutputStream *pic;
+    OutputStream *pic = nullptr;

     /** Cached pixel converter, set when the converter is enabled. */
-    PixelConverter conv;
+    PixelConverter conv = PixelConverter::rgba8888_le;

     PixelPump pixelPump;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/38484
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I230e0e0db879a56bc23c3ed439b9722e76cdd8e4
Gerrit-Change-Number: 38484
Gerrit-PatchSet: 8
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Daniel Carvalho <oda...@yahoo.com.br>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to