Commit 022e468e authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

usb: sisusb_con, cleanup configs



There are two macros defined:
1) ifdef CONFIG_COMPAT => define SISUSB_NEW_CONFIG_COMPAT
2) ifdef CONFIG_USB_SISUSBVGA_CON => define INCL_SISUSB_CON

Remove the latter and make use only of the former. This removes one
layer of obfuscation.

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3af5d01c
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@
#include "sisusb.h"
#include "sisusb_init.h"

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
#include <linux/font.h>
#endif

@@ -61,7 +61,7 @@

/* Forward declarations / clean-up routines */

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
static int sisusb_first_vc;
static int sisusb_last_vc;
module_param_named(first, sisusb_first_vc, int, 0);
@@ -1198,7 +1198,7 @@ static int sisusb_read_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,

/* High level: Gfx (indexed) register access */

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
int sisusb_setreg(struct sisusb_usb_data *sisusb, int port, u8 data)
{
	return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_IO, port, data);
@@ -1272,7 +1272,7 @@ int sisusb_setidxregand(struct sisusb_usb_data *sisusb, int port,

/* Write/read video ram */

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
int sisusb_writeb(struct sisusb_usb_data *sisusb, u32 adr, u8 data)
{
	return sisusb_write_memio_byte(sisusb, SISUSB_TYPE_MEM, adr, data);
@@ -2255,7 +2255,7 @@ static int sisusb_init_gfxdevice(struct sisusb_usb_data *sisusb, int initscreen)
}


#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON

/* Set up default text mode:
 * - Set text mode (0x03)
@@ -2448,7 +2448,7 @@ void sisusb_delete(struct kref *kref)
	sisusb->sisusb_dev = NULL;
	sisusb_free_buffers(sisusb);
	sisusb_free_urbs(sisusb);
#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	kfree(sisusb->SiS_Pr);
#endif
	kfree(sisusb);
@@ -2844,7 +2844,7 @@ static int sisusb_handle_command(struct sisusb_usb_data *sisusb,

	case SUCMD_HANDLETEXTMODE:
		retval = 0;
#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
		/* Gfx core must be initialized, SiS_Pr must exist */
		if (!sisusb->gfxinit || !sisusb->SiS_Pr)
			return -ENODEV;
@@ -2860,7 +2860,7 @@ static int sisusb_handle_command(struct sisusb_usb_data *sisusb,
#endif
		break;

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	case SUCMD_SETMODE:
		/* Gfx core must be initialized, SiS_Pr must exist */
		if (!sisusb->gfxinit || !sisusb->SiS_Pr)
@@ -2944,7 +2944,7 @@ static long sisusb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
		x.sisusb_vramsize = sisusb->vramsize;
		x.sisusb_minor = sisusb->minor;
		x.sisusb_fbdevactive = 0;
#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
		x.sisusb_conactive  = sisusb->haveconsole ? 1 : 0;
#else
		x.sisusb_conactive  = 0;
@@ -2975,7 +2975,7 @@ err_out:
	return retval;
}

#ifdef SISUSB_NEW_CONFIG_COMPAT
#ifdef CONFIG_COMPAT
static long sisusb_compat_ioctl(struct file *f, unsigned int cmd,
		unsigned long arg)
{
@@ -2998,7 +2998,7 @@ static const struct file_operations usb_sisusb_fops = {
	.read =		sisusb_read,
	.write =	sisusb_write,
	.llseek =	sisusb_lseek,
#ifdef SISUSB_NEW_CONFIG_COMPAT
#ifdef CONFIG_COMPAT
	.compat_ioctl = sisusb_compat_ioctl,
#endif
	.unlocked_ioctl = sisusb_ioctl
@@ -3091,7 +3091,7 @@ static int sisusb_probe(struct usb_interface *intf,
	dev_info(&sisusb->sisusb_dev->dev, "Allocated %d output buffers\n",
			sisusb->numobufs);

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	/* Allocate our SiS_Pr */
	sisusb->SiS_Pr = kmalloc(sizeof(struct SiS_Private), GFP_KERNEL);
	if (!sisusb->SiS_Pr) {
@@ -3112,7 +3112,7 @@ static int sisusb_probe(struct usb_interface *intf,

	if (dev->speed == USB_SPEED_HIGH || dev->speed >= USB_SPEED_SUPER) {
		int initscreen = 1;
#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
		if (sisusb_first_vc > 0 && sisusb_last_vc > 0 &&
				sisusb_first_vc <= sisusb_last_vc &&
				sisusb_last_vc <= MAX_NR_CONSOLES)
@@ -3134,7 +3134,7 @@ static int sisusb_probe(struct usb_interface *intf,
	dev_dbg(&sisusb->sisusb_dev->dev, "*** RWTEST END ***\n");
#endif

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	sisusb_console_init(sisusb, sisusb_first_vc, sisusb_last_vc);
#endif

@@ -3160,7 +3160,7 @@ static void sisusb_disconnect(struct usb_interface *intf)
	if (!sisusb)
		return;

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	sisusb_console_exit(sisusb);
#endif

@@ -3210,7 +3210,7 @@ static struct usb_driver sisusb_driver = {
static int __init usb_sisusb_init(void)
{

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	sisusb_init_concode();
#endif

+1 −14
Original line number Diff line number Diff line
@@ -38,17 +38,8 @@
#ifndef _SISUSB_H_
#define _SISUSB_H_

#ifdef CONFIG_COMPAT
#define SISUSB_NEW_CONFIG_COMPAT
#endif

#include <linux/mutex.h>

/* For older kernels, support for text consoles is by default
 * off. To enable text console support, change the following:
 */
/* #define CONFIG_USB_SISUSBVGA_CON */

/* Version Information */

#define SISUSB_VERSION		0
@@ -57,10 +48,6 @@

/* Include console and mode switching code? */

#ifdef CONFIG_USB_SISUSBVGA_CON
#define INCL_SISUSB_CON		1
#endif

#include <linux/console.h>
#include <linux/vt_kern.h>
#include "sisusb_struct.h"
@@ -139,7 +126,7 @@ struct sisusb_usb_data {
	unsigned char gfxinit;	/* graphics core initialized? */
	unsigned short chipid, chipvendor;
	unsigned short chiprevision;
#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON
	struct SiS_Private *SiS_Pr;
	unsigned long scrbuf;
	unsigned int scrbuf_size;
+1 −1
Original line number Diff line number Diff line
@@ -70,7 +70,7 @@
#include "sisusb.h"
#include "sisusb_init.h"

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON

#define sisusbcon_writew(val, addr)	(*(addr) = (val))
#define sisusbcon_readw(addr)		(*(addr))
+2 −2
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@

#include "sisusb.h"

#ifdef INCL_SISUSB_CON
#ifdef CONFIG_USB_SISUSBVGA_CON

#include "sisusb_init.h"

@@ -956,4 +956,4 @@ int SiSUSBSetVESAMode(struct SiS_Private *SiS_Pr, unsigned short VModeNo)
	return SiSUSBSetMode(SiS_Pr, ModeNo);
}

#endif /* INCL_SISUSB_CON */
#endif /* CONFIG_USB_SISUSBVGA_CON */