All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] staging: sm7xxfb: code improvements and cleanup
@ 2012-06-27 12:10 Javier M. Mellid
  2012-06-27 12:10 ` [PATCH 1/2] staging: sm7xxfb: rename vars holding device and revision ids Javier M. Mellid
  2012-06-27 12:10 ` [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info Javier M. Mellid
  0 siblings, 2 replies; 4+ messages in thread
From: Javier M. Mellid @ 2012-06-27 12:10 UTC (permalink / raw)
  To: gregkh, gewang; +Cc: devel, linux-kernel, Javier M. Mellid

From: "Javier M. Mellid" <jmunhoz@igalia.com>

This patchset implements some code improvements and cleanup related to
smtcfb_info.

Tested with SM712.

Javier M. Mellid (2):
  staging: sm7xxfb: rename vars holding device and revision ids
  staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info

 drivers/staging/sm7xxfb/sm7xxfb.c |   29 ++++++++++++++---------------
 1 file changed, 14 insertions(+), 15 deletions(-)

-- 
1.7.10


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] staging: sm7xxfb: rename vars holding device and revision ids
  2012-06-27 12:10 [PATCH 0/2] staging: sm7xxfb: code improvements and cleanup Javier M. Mellid
@ 2012-06-27 12:10 ` Javier M. Mellid
  2012-06-27 12:10 ` [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info Javier M. Mellid
  1 sibling, 0 replies; 4+ messages in thread
From: Javier M. Mellid @ 2012-06-27 12:10 UTC (permalink / raw)
  To: gregkh, gewang; +Cc: devel, linux-kernel, Javier M. Mellid

From: "Javier M. Mellid" <jmunhoz@igalia.com>

This patch fixes CamelCase var names in smtcfb_info holding device and
revision identifiers.

Tested with SM712.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
---
 drivers/staging/sm7xxfb/sm7xxfb.c |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index 16d2b5e..c603e8c 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -42,8 +42,9 @@ struct screen_info smtc_screen_info;
 struct smtcfb_info {
 	struct fb_info fb;
 	struct pci_dev *pdev;
+	u16 chip_id;
+	u8  chip_rev_id;
 
-	u16 chipID;
 	unsigned char __iomem *m_pMMIO;
 	char __iomem *m_pLFB;
 	char *m_pDPR;
@@ -53,8 +54,6 @@ struct smtcfb_info {
 	u_int width;
 	u_int height;
 	u_int hz;
-
-	u8 chipRevID;
 };
 
 struct vesa_mode_table	{
@@ -231,7 +230,7 @@ static void sm712_setpalette(int regno, unsigned red, unsigned green,
 
 static void smtc_set_timing(struct smtcfb_info *sfb)
 {
-	switch (sfb->chipID) {
+	switch (sfb->chip_id) {
 	case 0x710:
 	case 0x712:
 	case 0x720:
@@ -812,8 +811,8 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
 	if (!sfb)
 		goto failed_free;
 
-	sfb->chipID = ent->device;
-	sprintf(name, "sm%Xfb", sfb->chipID);
+	sfb->chip_id = ent->device;
+	sprintf(name, "sm%Xfb", sfb->chip_id);
 
 	pci_set_drvdata(pdev, sfb);
 
@@ -837,9 +836,9 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
 #endif
 	/* Map address and memory detection */
 	pFramebufferPhysical = pci_resource_start(pdev, 0);
-	pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chipRevID);
+	pci_read_config_byte(pdev, PCI_REVISION_ID, &sfb->chip_rev_id);
 
-	switch (sfb->chipID) {
+	switch (sfb->chip_id) {
 	case 0x710:
 	case 0x712:
 		sfb->fb.fix.mmio_start = pFramebufferPhysical + 0x00400000;
@@ -925,7 +924,7 @@ static int __devinit smtcfb_pci_probe(struct pci_dev *pdev,
 
 	dev_info(&pdev->dev,
 		 "Silicon Motion SM%X Rev%X primary display mode %dx%d-%d Init Complete.",
-		 sfb->chipID, sfb->chipRevID, sfb->fb.var.xres,
+		 sfb->chip_id, sfb->chip_rev_id, sfb->fb.var.xres,
 		 sfb->fb.var.yres, sfb->fb.var.bits_per_pixel);
 
 	return 0;
@@ -1001,7 +1000,7 @@ static int smtcfb_pci_resume(struct device *device)
 
 	/* reinit hardware */
 	sm7xx_init_hw();
-	switch (sfb->chipID) {
+	switch (sfb->chip_id) {
 	case 0x710:
 	case 0x712:
 		/* set MCLK = 14.31818 *  (0x16 / 0x2) */
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info
  2012-06-27 12:10 [PATCH 0/2] staging: sm7xxfb: code improvements and cleanup Javier M. Mellid
  2012-06-27 12:10 ` [PATCH 1/2] staging: sm7xxfb: rename vars holding device and revision ids Javier M. Mellid
@ 2012-06-27 12:10 ` Javier M. Mellid
  2012-07-06 23:08   ` Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Javier M. Mellid @ 2012-06-27 12:10 UTC (permalink / raw)
  To: gregkh, gewang; +Cc: devel, linux-kernel, Javier M. Mellid

From: "Javier M. Mellid" <jmunhoz@igalia.com>

This patch erases hardcode cast between smtcfb_info and fb_info in order
to get a more robust and less rigid smtcfb_info structure. fb_info
doesn't need to be the first field in smtcfb_info after this patch.

Tested with SM712.

Signed-off-by: Javier M. Mellid <jmunhoz@igalia.com>
---
 drivers/staging/sm7xxfb/sm7xxfb.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c
index c603e8c..e3511ec 100644
--- a/drivers/staging/sm7xxfb/sm7xxfb.c
+++ b/drivers/staging/sm7xxfb/sm7xxfb.c
@@ -40,8 +40,8 @@ struct screen_info smtc_screen_info;
 * Private structure
 */
 struct smtcfb_info {
-	struct fb_info fb;
 	struct pci_dev *pdev;
+	struct fb_info fb;
 	u16 chip_id;
 	u8  chip_rev_id;
 
@@ -328,9 +328,11 @@ static int smtc_blank(int blank_mode, struct fb_info *info)
 static int smtc_setcolreg(unsigned regno, unsigned red, unsigned green,
 			  unsigned blue, unsigned trans, struct fb_info *info)
 {
-	struct smtcfb_info *sfb = (struct smtcfb_info *)info;
+	struct smtcfb_info *sfb;
 	u32 val;
 
+	sfb = info->par;
+
 	if (regno > 255)
 		return 1;
 
@@ -623,9 +625,7 @@ static int smtc_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 static int smtc_set_par(struct fb_info *info)
 {
-	struct smtcfb_info *sfb = (struct smtcfb_info *)info;
-
-	smtcfb_setmode(sfb);
+	smtcfb_setmode(info->par);
 
 	return 0;
 }
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info
  2012-06-27 12:10 ` [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info Javier M. Mellid
@ 2012-07-06 23:08   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2012-07-06 23:08 UTC (permalink / raw)
  To: Javier M. Mellid; +Cc: gewang, devel, linux-kernel

On Wed, Jun 27, 2012 at 02:10:15PM +0200, Javier M. Mellid wrote:
> From: "Javier M. Mellid" <jmunhoz@igalia.com>
> 
> This patch erases hardcode cast between smtcfb_info and fb_info in order
> to get a more robust and less rigid smtcfb_info structure. fb_info
> doesn't need to be the first field in smtcfb_info after this patch.

Nice job, stuff like this is always appreciated.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-07-06 23:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-27 12:10 [PATCH 0/2] staging: sm7xxfb: code improvements and cleanup Javier M. Mellid
2012-06-27 12:10 ` [PATCH 1/2] staging: sm7xxfb: rename vars holding device and revision ids Javier M. Mellid
2012-06-27 12:10 ` [PATCH 2/2] staging: sm7xxfb: erase hardcode cast between smtcfb_info and fb_info Javier M. Mellid
2012-07-06 23:08   ` Greg KH

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.