From: Peter Huewe <peterhuewe@gmx.de> To: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Thomas Winischhofer <thomas@winischhofer.net>, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Huewe <peterhuewe@gmx.de> Subject: [PATCH] video/sis: Annotate SiS_DRAMType as __devinitconst Date: Fri, 4 May 2012 00:14:55 +0200 [thread overview] Message-ID: <1336083295-7327-1-git-send-email-peterhuewe@gmx.de> (raw) In-Reply-To: <4FA2FD10.6090306@gmx.de> SiS_DRAMType is const and only used by sisfb_post_300_rwtest which is marked __devinit we can annotate SiS_DRAMType with __devinitconst and move it into the file scope in order to not have it created on the stack. This patch decreases the compiled module size by about 100bytes. And since hardcoded values are bad we use ARRAY_SIZE for determining the size of SiS_DRAMType ;) Signed-off-by: Peter Huewe <peterhuewe@gmx.de> --- drivers/video/sis/sis_main.c | 41 +++++++++++++++++++++-------------------- 1 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 078ca21..a7a48db 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -4222,6 +4222,26 @@ sisfb_post_300_buswidth(struct sis_video_info *ivideo) return 1; /* 32bit */ } +static const unsigned short __devinitconst SiS_DRAMType[17][5] = { + {0x0C,0x0A,0x02,0x40,0x39}, + {0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35}, + {0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31}, + {0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34}, + {0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21}, + {0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11}, + {0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01}, + {0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20}, + {0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00} +}; + static int __devinit sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration, int buswidth, int PseudoRankCapacity, int PseudoAdrPinCount, @@ -4231,27 +4251,8 @@ sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration, int buswidth unsigned short sr14; unsigned int k, RankCapacity, PageCapacity, BankNumHigh, BankNumMid; unsigned int PhysicalAdrOtherPage, PhysicalAdrHigh, PhysicalAdrHalfPage; - static const unsigned short SiS_DRAMType[17][5] = { - {0x0C,0x0A,0x02,0x40,0x39}, - {0x0D,0x0A,0x01,0x40,0x48}, - {0x0C,0x09,0x02,0x20,0x35}, - {0x0D,0x09,0x01,0x20,0x44}, - {0x0C,0x08,0x02,0x10,0x31}, - {0x0D,0x08,0x01,0x10,0x40}, - {0x0C,0x0A,0x01,0x20,0x34}, - {0x0C,0x09,0x01,0x08,0x32}, - {0x0B,0x08,0x02,0x08,0x21}, - {0x0C,0x08,0x01,0x08,0x30}, - {0x0A,0x08,0x02,0x04,0x11}, - {0x0B,0x0A,0x01,0x10,0x28}, - {0x09,0x08,0x02,0x02,0x01}, - {0x0B,0x09,0x01,0x08,0x24}, - {0x0B,0x08,0x01,0x04,0x20}, - {0x0A,0x08,0x01,0x02,0x10}, - {0x09,0x08,0x01,0x01,0x00} - }; - for(k = 0; k <= 16; k++) { + for(k = 0; k < ARRAY_SIZE(SiS_DRAMType); k++) { RankCapacity = buswidth * SiS_DRAMType[k][3]; -- 1.7.3.4
WARNING: multiple messages have this Message-ID (diff)
From: Peter Huewe <peterhuewe@gmx.de> To: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Thomas Winischhofer <thomas@winischhofer.net>, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Huewe <peterhuewe@gmx.de> Subject: [PATCH] video/sis: Annotate SiS_DRAMType as __devinitconst Date: Thu, 03 May 2012 22:14:55 +0000 [thread overview] Message-ID: <1336083295-7327-1-git-send-email-peterhuewe@gmx.de> (raw) In-Reply-To: <4FA2FD10.6090306@gmx.de> SiS_DRAMType is const and only used by sisfb_post_300_rwtest which is marked __devinit we can annotate SiS_DRAMType with __devinitconst and move it into the file scope in order to not have it created on the stack. This patch decreases the compiled module size by about 100bytes. And since hardcoded values are bad we use ARRAY_SIZE for determining the size of SiS_DRAMType ;) Signed-off-by: Peter Huewe <peterhuewe@gmx.de> --- drivers/video/sis/sis_main.c | 41 +++++++++++++++++++++-------------------- 1 files changed, 21 insertions(+), 20 deletions(-) diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 078ca21..a7a48db 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c @@ -4222,6 +4222,26 @@ sisfb_post_300_buswidth(struct sis_video_info *ivideo) return 1; /* 32bit */ } +static const unsigned short __devinitconst SiS_DRAMType[17][5] = { + {0x0C,0x0A,0x02,0x40,0x39}, + {0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35}, + {0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31}, + {0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34}, + {0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21}, + {0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11}, + {0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01}, + {0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20}, + {0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00} +}; + static int __devinit sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration, int buswidth, int PseudoRankCapacity, int PseudoAdrPinCount, @@ -4231,27 +4251,8 @@ sisfb_post_300_rwtest(struct sis_video_info *ivideo, int iteration, int buswidth unsigned short sr14; unsigned int k, RankCapacity, PageCapacity, BankNumHigh, BankNumMid; unsigned int PhysicalAdrOtherPage, PhysicalAdrHigh, PhysicalAdrHalfPage; - static const unsigned short SiS_DRAMType[17][5] = { - {0x0C,0x0A,0x02,0x40,0x39}, - {0x0D,0x0A,0x01,0x40,0x48}, - {0x0C,0x09,0x02,0x20,0x35}, - {0x0D,0x09,0x01,0x20,0x44}, - {0x0C,0x08,0x02,0x10,0x31}, - {0x0D,0x08,0x01,0x10,0x40}, - {0x0C,0x0A,0x01,0x20,0x34}, - {0x0C,0x09,0x01,0x08,0x32}, - {0x0B,0x08,0x02,0x08,0x21}, - {0x0C,0x08,0x01,0x08,0x30}, - {0x0A,0x08,0x02,0x04,0x11}, - {0x0B,0x0A,0x01,0x10,0x28}, - {0x09,0x08,0x02,0x02,0x01}, - {0x0B,0x09,0x01,0x08,0x24}, - {0x0B,0x08,0x01,0x04,0x20}, - {0x0A,0x08,0x01,0x02,0x10}, - {0x09,0x08,0x01,0x01,0x00} - }; - for(k = 0; k <= 16; k++) { + for(k = 0; k < ARRAY_SIZE(SiS_DRAMType); k++) { RankCapacity = buswidth * SiS_DRAMType[k][3]; -- 1.7.3.4
next prev parent reply other threads:[~2012-05-03 22:15 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-04-15 21:10 [PATCH 1/2] video/sis: Use SiS_DRAMType from init.h and annotate it __devinitconst Peter Huewe 2012-04-15 21:10 ` Peter Huewe 2012-04-15 21:10 ` [PATCH 2/2] video/sis: Remove unused structs SiS_SDRDRAM_TYPE/SiS_DDRDRAM_TYPE Peter Huewe 2012-04-15 21:10 ` Peter Huewe 2012-04-29 20:26 ` [PATCH v2] video/sis: Use SiS_DRAMType from init.h and annotate it __devinitconst Peter Huewe 2012-04-29 20:26 ` Peter Huewe 2012-05-02 23:12 ` Florian Tobias Schandinat 2012-05-02 23:12 ` Florian Tobias Schandinat 2012-05-03 21:40 ` Peter Hüwe 2012-05-03 21:40 ` Peter Hüwe 2012-05-03 21:48 ` Florian Tobias Schandinat 2012-05-03 21:58 ` Peter Hüwe 2012-05-03 21:58 ` Peter Hüwe 2012-05-03 22:14 ` Peter Huewe [this message] 2012-05-03 22:14 ` [PATCH] video/sis: Annotate SiS_DRAMType as __devinitconst Peter Huewe 2012-05-10 0:19 ` Florian Tobias Schandinat 2012-05-10 21:39 ` Peter Hüwe 2012-05-10 21:39 ` Peter Hüwe 2012-05-13 13:04 ` Florian Tobias Schandinat
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1336083295-7327-1-git-send-email-peterhuewe@gmx.de \ --to=peterhuewe@gmx.de \ --cc=FlorianSchandinat@gmx.de \ --cc=linux-fbdev@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=thomas@winischhofer.net \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.