LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "Janorkar, Mayuresh" <mayur@ti.com>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Thomas Winischhofer <thomas@winischhofer.net>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH 1/6] sisfb: POST should fail if R/W test fails
Date: Mon, 14 Feb 2011 11:38:24 +0530	[thread overview]
Message-ID: <EAF47CD23C76F840A9E7FCE10091EFAB0323A959C3@dbde02.ent.ti.com> (raw)
In-Reply-To: <1297635088-13224-2-git-send-email-aaro.koskinen@iki.fi>



> -----Original Message-----
> From: linux-fbdev-owner@vger.kernel.org [mailto:linux-fbdev-
> owner@vger.kernel.org] On Behalf Of Aaro Koskinen
> Sent: Monday, February 14, 2011 3:41 AM
> To: linux-fbdev@vger.kernel.org; linux-kernel@vger.kernel.org
> Cc: Thomas Winischhofer
> Subject: [PATCH 1/6] sisfb: POST should fail if R/W test fails
> 
> Currently there is no indication if R/W test fails during POST. This can
> happen e.g. when user plugs in a card with unsupported type of memory.
> Since the driver will be unusable, it's better to fail the whole POST
> if the memory cannot be configured properly.
> 
> Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
> Cc: Thomas Winischhofer <thomas@winischhofer.net>
> ---
>  drivers/video/sis/sis_main.c |   22 +++++++++++++++++-----
>  1 files changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c
> index 2fb8c5a..2c5de66 100644
> --- a/drivers/video/sis/sis_main.c
> +++ b/drivers/video/sis/sis_main.c
> @@ -4627,11 +4627,11 @@ sisfb_post_xgi_rwtest(struct sis_video_info
> *ivideo, int starta,
>  	return 1;
>  }
> 
> -static void __devinit
> +static int __devinit
>  sisfb_post_xgi_ramsize(struct sis_video_info *ivideo)
>  {
>  	unsigned int buswidth, ranksize, channelab, mapsize;
> -	int i, j, k, l;
> +	int i, j, k, l, status;
>  	u8 reg, sr14;
>  	static const u8 dramsr13[12 * 5] = {
>  		0x02, 0x0e, 0x0b, 0x80, 0x5d,
> @@ -4673,7 +4673,7 @@ sisfb_post_xgi_ramsize(struct sis_video_info
> *ivideo)
>  		SiS_SetReg(SISSR, 0x13, 0x35);
>  		SiS_SetReg(SISSR, 0x14, 0x41);
>  		/* TODO */
> -		return;
> +		return -ENOMEM;
>  	}
> 
>  	/* Non-interleaving */
> @@ -4835,6 +4835,7 @@ bail_out:
> 
>  	j = (ivideo->chip == XGI_20) ? 5 : 9;
>  	k = (ivideo->chip == XGI_20) ? 12 : 4;
> +	status = -EIO;

How about assigning this value during variable declaration?

> 
>  	for(i = 0; i < k; i++) {
> 
> @@ -4868,11 +4869,15 @@ bail_out:
>  		SiS_SetRegANDOR(SISSR, 0x14, 0x0f, (reg & 0xf0));
>  		sisfb_post_xgi_delay(ivideo, 1);
> 
> -		if(sisfb_post_xgi_rwtest(ivideo, j, ((reg >> 4) + channelab -
> 2 + 20), mapsize))
> +		if (sisfb_post_xgi_rwtest(ivideo, j, ((reg >> 4) + channelab -
> 2 + 20), mapsize)) {
> +			status = 0;
>  			break;
> +		}
>  	}
> 
>  	iounmap(ivideo->video_vbase);
> +
> +	return status;
>  }
> 
>  static void __devinit
> @@ -5648,6 +5653,7 @@ sisfb_post_xgi(struct pci_dev *pdev)
>  		SiS_SetReg(SISSR, 0x14, bios[regb + 0xe0 + 8]);
> 
>  	} else {
> +		int err;
> 
>  		/* Set default mode, don't clear screen */
>  		ivideo->SiS_Pr.SiS_UseOEM = false;
> @@ -5661,10 +5667,16 @@ sisfb_post_xgi(struct pci_dev *pdev)
> 
>  		/* Disable read-cache */
>  		SiS_SetRegAND(SISSR, 0x21, 0xdf);
> -		sisfb_post_xgi_ramsize(ivideo);
> +		err = sisfb_post_xgi_ramsize(ivideo);
>  		/* Enable read-cache */
>  		SiS_SetRegOR(SISSR, 0x21, 0x20);
> 
> +		if (err) {
> +			dev_err(&pdev->dev,
> +				"%s: RAM size detection failed: %d\n",
> +				__func__, err);
> +			return 0;


Are you sure you wish to return 0 when there is an error?

> +		}
>  	}
> 
>  #if 0
> --
> 1.5.6.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2011-02-14  6:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-13 22:11 [PATCH 0/6] sisfb: XGI Z9 POST Aaro Koskinen
2011-02-13 22:11 ` [PATCH 1/6] sisfb: POST should fail if R/W test fails Aaro Koskinen
2011-02-14  6:08   ` Janorkar, Mayuresh [this message]
2011-02-14 19:01     ` Aaro Koskinen
2011-02-13 22:11 ` [PATCH 2/6] sisfb: move XGI POST RAM type detection into a subroutine Aaro Koskinen
2011-02-13 22:11 ` [PATCH 3/6] sisfb: add subroutine for detecting XGI Z9 Aaro Koskinen
2011-02-13 22:11 ` [PATCH 4/6] sisfb: add RAM type detection for " Aaro Koskinen
2011-02-13 22:11 ` [PATCH 5/6] sisfb: move XGI POST DDR2 bootup code into subroutines Aaro Koskinen
2011-02-13 22:11 ` [PATCH 6/6] sisfb: add support for XGI Z9 DDR2 POST Aaro Koskinen
2011-02-16 17:41 ` [PATCH 0/6] sisfb: XGI Z9 POST Aaro Koskinen

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=EAF47CD23C76F840A9E7FCE10091EFAB0323A959C3@dbde02.ent.ti.com \
    --to=mayur@ti.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas@winischhofer.net \
    --subject='RE: [PATCH 1/6] sisfb: POST should fail if R/W test fails' \
    /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: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).