From 2116b7a473bf1c8d26998b477c294e7fe294921f Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 4 Oct 2010 22:55:57 +0200 Subject: smbfs: move to drivers/staging smbfs has been scheduled for removal in 2.6.27, so maybe we can now move it to drivers/staging on the way out. smbfs still uses the big kernel lock and nobody is going to fix that, so we should be getting rid of it soon. This removes the 32 bit compat mount and ioctl handling code, which is implemented in common fs code, and moves all smbfs related files into drivers/staging/smbfs. Signed-off-by: Arnd Bergmann Acked-by: Jeff Layton Signed-off-by: Greg Kroah-Hartman --- include/linux/Kbuild | 4 - include/linux/smb.h | 118 --------------- include/linux/smb_fs.h | 153 ------------------- include/linux/smb_fs_i.h | 37 ----- include/linux/smb_fs_sb.h | 100 ------------- include/linux/smb_mount.h | 65 --------- include/linux/smbno.h | 363 ---------------------------------------------- 7 files changed, 840 deletions(-) delete mode 100644 include/linux/smb.h delete mode 100644 include/linux/smb_fs.h delete mode 100644 include/linux/smb_fs_i.h delete mode 100644 include/linux/smb_fs_sb.h delete mode 100644 include/linux/smb_mount.h delete mode 100644 include/linux/smbno.h (limited to 'include') diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 626b629429ff..98d520d371ed 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -326,10 +326,6 @@ header-y += serio.h header-y += shm.h header-y += signal.h header-y += signalfd.h -header-y += smb.h -header-y += smb_fs.h -header-y += smb_mount.h -header-y += smbno.h header-y += snmp.h header-y += socket.h header-y += sockios.h diff --git a/include/linux/smb.h b/include/linux/smb.h deleted file mode 100644 index 82fefddc5987..000000000000 --- a/include/linux/smb.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * smb.h - * - * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke - * Copyright (C) 1997 by Volker Lendecke - * - */ - -#ifndef _LINUX_SMB_H -#define _LINUX_SMB_H - -#include -#include -#ifdef __KERNEL__ -#include -#endif - -enum smb_protocol { - SMB_PROTOCOL_NONE, - SMB_PROTOCOL_CORE, - SMB_PROTOCOL_COREPLUS, - SMB_PROTOCOL_LANMAN1, - SMB_PROTOCOL_LANMAN2, - SMB_PROTOCOL_NT1 -}; - -enum smb_case_hndl { - SMB_CASE_DEFAULT, - SMB_CASE_LOWER, - SMB_CASE_UPPER -}; - -struct smb_dskattr { - __u16 total; - __u16 allocblocks; - __u16 blocksize; - __u16 free; -}; - -struct smb_conn_opt { - - /* The socket */ - unsigned int fd; - - enum smb_protocol protocol; - enum smb_case_hndl case_handling; - - /* Connection-Options */ - - __u32 max_xmit; - __u16 server_uid; - __u16 tid; - - /* The following are LANMAN 1.0 options */ - __u16 secmode; - __u16 maxmux; - __u16 maxvcs; - __u16 rawmode; - __u32 sesskey; - - /* The following are NT LM 0.12 options */ - __u32 maxraw; - __u32 capabilities; - __s16 serverzone; -}; - -#ifdef __KERNEL__ - -#define SMB_NLS_MAXNAMELEN 20 -struct smb_nls_codepage { - char local_name[SMB_NLS_MAXNAMELEN]; - char remote_name[SMB_NLS_MAXNAMELEN]; -}; - - -#define SMB_MAXNAMELEN 255 -#define SMB_MAXPATHLEN 1024 - -/* - * Contains all relevant data on a SMB networked file. - */ -struct smb_fattr { - __u16 attr; - - unsigned long f_ino; - umode_t f_mode; - nlink_t f_nlink; - uid_t f_uid; - gid_t f_gid; - dev_t f_rdev; - loff_t f_size; - struct timespec f_atime; - struct timespec f_mtime; - struct timespec f_ctime; - unsigned long f_blocks; - int f_unix; -}; - -enum smb_conn_state { - CONN_VALID, /* everything's fine */ - CONN_INVALID, /* Something went wrong, but did not - try to reconnect yet. */ - CONN_RETRIED, /* Tried a reconnection, but was refused */ - CONN_RETRYING /* Currently trying to reconnect */ -}; - -#define SMB_HEADER_LEN 37 /* includes everything up to, but not - * including smb_bcc */ - -#define SMB_INITIAL_PACKET_SIZE 4000 -#define SMB_MAX_PACKET_SIZE 32768 - -/* reserve this much space for trans2 parameters. Shouldn't have to be more - than 10 or so, but OS/2 seems happier like this. */ -#define SMB_TRANS2_MAX_PARAM 64 - -#endif -#endif diff --git a/include/linux/smb_fs.h b/include/linux/smb_fs.h deleted file mode 100644 index 923cd8a247b1..000000000000 --- a/include/linux/smb_fs.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * smb_fs.h - * - * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke - * Copyright (C) 1997 by Volker Lendecke - * - */ - -#ifndef _LINUX_SMB_FS_H -#define _LINUX_SMB_FS_H - -#include - -/* - * ioctl commands - */ -#define SMB_IOC_GETMOUNTUID _IOR('u', 1, __kernel_old_uid_t) -#define SMB_IOC_NEWCONN _IOW('u', 2, struct smb_conn_opt) - -/* __kernel_uid_t can never change, so we have to use __kernel_uid32_t */ -#define SMB_IOC_GETMOUNTUID32 _IOR('u', 3, __kernel_uid32_t) - - -#ifdef __KERNEL__ -#include -#include - -#include -#include -#include -#include -#include -#include - -static inline struct smb_sb_info *SMB_SB(struct super_block *sb) -{ - return sb->s_fs_info; -} - -static inline struct smb_inode_info *SMB_I(struct inode *inode) -{ - return container_of(inode, struct smb_inode_info, vfs_inode); -} - -/* macro names are short for word, double-word, long value (?) */ -#define WVAL(buf, pos) (get_unaligned_le16((u8 *)(buf) + (pos))) -#define DVAL(buf, pos) (get_unaligned_le32((u8 *)(buf) + (pos))) -#define LVAL(buf, pos) (get_unaligned_le64((u8 *)(buf) + (pos))) - -#define WSET(buf, pos, val) put_unaligned_le16((val), (u8 *)(buf) + (pos)) -#define DSET(buf, pos, val) put_unaligned_le32((val), (u8 *)(buf) + (pos)) -#define LSET(buf, pos, val) put_unaligned_le64((val), (u8 *)(buf) + (pos)) - -/* where to find the base of the SMB packet proper */ -#define smb_base(buf) ((u8 *)(((u8 *)(buf))+4)) - -/* - * Flags for the in-memory inode - */ -#define SMB_F_LOCALWRITE 0x02 /* file modified locally */ - - -/* NT1 protocol capability bits */ -#define SMB_CAP_RAW_MODE 0x00000001 -#define SMB_CAP_MPX_MODE 0x00000002 -#define SMB_CAP_UNICODE 0x00000004 -#define SMB_CAP_LARGE_FILES 0x00000008 -#define SMB_CAP_NT_SMBS 0x00000010 -#define SMB_CAP_RPC_REMOTE_APIS 0x00000020 -#define SMB_CAP_STATUS32 0x00000040 -#define SMB_CAP_LEVEL_II_OPLOCKS 0x00000080 -#define SMB_CAP_LOCK_AND_READ 0x00000100 -#define SMB_CAP_NT_FIND 0x00000200 -#define SMB_CAP_DFS 0x00001000 -#define SMB_CAP_LARGE_READX 0x00004000 -#define SMB_CAP_LARGE_WRITEX 0x00008000 -#define SMB_CAP_UNIX 0x00800000 /* unofficial ... */ - - -/* - * This is the time we allow an inode, dentry or dir cache to live. It is bad - * for performance to have shorter ttl on an inode than on the cache. It can - * cause refresh on each inode for a dir listing ... one-by-one - */ -#define SMB_MAX_AGE(server) (((server)->mnt->ttl * HZ) / 1000) - -static inline void -smb_age_dentry(struct smb_sb_info *server, struct dentry *dentry) -{ - dentry->d_time = jiffies - SMB_MAX_AGE(server); -} - -struct smb_cache_head { - time_t mtime; /* unused */ - unsigned long time; /* cache age */ - unsigned long end; /* last valid fpos in cache */ - int eof; -}; - -#define SMB_DIRCACHE_SIZE ((int)(PAGE_CACHE_SIZE/sizeof(struct dentry *))) -union smb_dir_cache { - struct smb_cache_head head; - struct dentry *dentry[SMB_DIRCACHE_SIZE]; -}; - -#define SMB_FIRSTCACHE_SIZE ((int)((SMB_DIRCACHE_SIZE * \ - sizeof(struct dentry *) - sizeof(struct smb_cache_head)) / \ - sizeof(struct dentry *))) - -#define SMB_DIRCACHE_START (SMB_DIRCACHE_SIZE - SMB_FIRSTCACHE_SIZE) - -struct smb_cache_control { - struct smb_cache_head head; - struct page *page; - union smb_dir_cache *cache; - unsigned long fpos, ofs; - int filled, valid, idx; -}; - -#define SMB_OPS_NUM_STATIC 5 -struct smb_ops { - int (*read)(struct inode *inode, loff_t offset, int count, - char *data); - int (*write)(struct inode *inode, loff_t offset, int count, const - char *data); - int (*readdir)(struct file *filp, void *dirent, filldir_t filldir, - struct smb_cache_control *ctl); - - int (*getattr)(struct smb_sb_info *server, struct dentry *dir, - struct smb_fattr *fattr); - /* int (*setattr)(...); */ /* setattr is really icky! */ - - int (*truncate)(struct inode *inode, loff_t length); - - - /* --- --- --- end of "static" entries --- --- --- */ - - int (*convert)(unsigned char *output, int olen, - const unsigned char *input, int ilen, - struct nls_table *nls_from, - struct nls_table *nls_to); -}; - -static inline int -smb_is_open(struct inode *i) -{ - return (SMB_I(i)->open == server_from_inode(i)->generation); -} - -extern void smb_install_null_ops(struct smb_ops *); -#endif /* __KERNEL__ */ - -#endif /* _LINUX_SMB_FS_H */ diff --git a/include/linux/smb_fs_i.h b/include/linux/smb_fs_i.h deleted file mode 100644 index 8ccf4eca2c3d..000000000000 --- a/include/linux/smb_fs_i.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * smb_fs_i.h - * - * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke - * Copyright (C) 1997 by Volker Lendecke - * - */ - -#ifndef _LINUX_SMB_FS_I -#define _LINUX_SMB_FS_I - -#include -#include - -/* - * smb fs inode data (in memory only) - */ -struct smb_inode_info { - - /* - * file handles are local to a connection. A file is open if - * (open == generation). - */ - unsigned int open; /* open generation */ - __u16 fileid; /* What id to handle a file with? */ - __u16 attr; /* Attribute fields, DOS value */ - - __u16 access; /* Access mode */ - __u16 flags; - unsigned long oldmtime; /* last time refreshed */ - unsigned long closed; /* timestamp when closed */ - unsigned openers; /* number of fileid users */ - - struct inode vfs_inode; /* must be at the end */ -}; - -#endif diff --git a/include/linux/smb_fs_sb.h b/include/linux/smb_fs_sb.h deleted file mode 100644 index bb947dd1fba9..000000000000 --- a/include/linux/smb_fs_sb.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * smb_fs_sb.h - * - * Copyright (C) 1995 by Paal-Kr. Engstad and Volker Lendecke - * Copyright (C) 1997 by Volker Lendecke - * - */ - -#ifndef _SMB_FS_SB -#define _SMB_FS_SB - -#include -#include -#include - -/* - * Upper limit on the total number of active smb_request structs. - */ -#define MAX_REQUEST_HARD 256 - -enum smb_receive_state { - SMB_RECV_START, /* No data read, looking for length + sig */ - SMB_RECV_HEADER, /* Reading the header data */ - SMB_RECV_HCOMPLETE, /* Done with the header */ - SMB_RECV_PARAM, /* Reading parameter words */ - SMB_RECV_DATA, /* Reading data bytes */ - SMB_RECV_END, /* End of request */ - SMB_RECV_DROP, /* Dropping this SMB */ - SMB_RECV_REQUEST, /* Received a request and not a reply */ -}; - -/* structure access macros */ -#define server_from_inode(inode) SMB_SB((inode)->i_sb) -#define server_from_dentry(dentry) SMB_SB((dentry)->d_sb) -#define SB_of(server) ((server)->super_block) - -struct smb_sb_info { - /* List of all smbfs superblocks */ - struct list_head entry; - - enum smb_conn_state state; - struct file * sock_file; - int conn_error; - enum smb_receive_state rstate; - - atomic_t nr_requests; - struct list_head xmitq; - struct list_head recvq; - u16 mid; - - struct smb_mount_data_kernel *mnt; - - /* Connections are counted. Each time a new socket arrives, - * generation is incremented. - */ - unsigned int generation; - struct pid *conn_pid; - struct smb_conn_opt opt; - wait_queue_head_t conn_wq; - int conn_complete; - struct semaphore sem; - - unsigned char header[SMB_HEADER_LEN + 20*2 + 2]; - u32 header_len; - u32 smb_len; - u32 smb_read; - - /* We use our own data_ready callback, but need the original one */ - void *data_ready; - - /* nls pointers for codepage conversions */ - struct nls_table *remote_nls; - struct nls_table *local_nls; - - struct smb_ops *ops; - - struct super_block *super_block; - - struct backing_dev_info bdi; -}; - -static inline int -smb_lock_server_interruptible(struct smb_sb_info *server) -{ - return down_interruptible(&(server->sem)); -} - -static inline void -smb_lock_server(struct smb_sb_info *server) -{ - down(&(server->sem)); -} - -static inline void -smb_unlock_server(struct smb_sb_info *server) -{ - up(&(server->sem)); -} - -#endif diff --git a/include/linux/smb_mount.h b/include/linux/smb_mount.h deleted file mode 100644 index d10f00cb5703..000000000000 --- a/include/linux/smb_mount.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * smb_mount.h - * - * Copyright (C) 1995, 1996 by Paal-Kr. Engstad and Volker Lendecke - * Copyright (C) 1997 by Volker Lendecke - * - */ - -#ifndef _LINUX_SMB_MOUNT_H -#define _LINUX_SMB_MOUNT_H - -#include - -#define SMB_MOUNT_VERSION 6 - -struct smb_mount_data { - int version; - __kernel_uid_t mounted_uid; /* Who may umount() this filesystem? */ - __kernel_uid_t uid; - __kernel_gid_t gid; - __kernel_mode_t file_mode; - __kernel_mode_t dir_mode; -}; - - -#ifdef __KERNEL__ - -/* "vers" in big-endian */ -#define SMB_MOUNT_ASCII 0x76657273 - -#define SMB_MOUNT_OLDVERSION 6 -#undef SMB_MOUNT_VERSION -#define SMB_MOUNT_VERSION 7 - -/* flags */ -#define SMB_MOUNT_WIN95 0x0001 /* Win 95 server */ -#define SMB_MOUNT_OLDATTR 0x0002 /* Use core getattr (Win 95 speedup) */ -#define SMB_MOUNT_DIRATTR 0x0004 /* Use find_first for getattr */ -#define SMB_MOUNT_CASE 0x0008 /* Be case sensitive */ -#define SMB_MOUNT_UNICODE 0x0010 /* Server talks unicode */ -#define SMB_MOUNT_UID 0x0020 /* Use user specified uid */ -#define SMB_MOUNT_GID 0x0040 /* Use user specified gid */ -#define SMB_MOUNT_FMODE 0x0080 /* Use user specified file mode */ -#define SMB_MOUNT_DMODE 0x0100 /* Use user specified dir mode */ - -struct smb_mount_data_kernel { - int version; - - uid_t mounted_uid; /* Who may umount() this filesystem? */ - uid_t uid; - gid_t gid; - mode_t file_mode; - mode_t dir_mode; - - u32 flags; - - /* maximum age in jiffies (inode, dentry and dircache) */ - int ttl; - - struct smb_nls_codepage codepage; -}; - -#endif - -#endif diff --git a/include/linux/smbno.h b/include/linux/smbno.h deleted file mode 100644 index f99e02d9ffe2..000000000000 --- a/include/linux/smbno.h +++ /dev/null @@ -1,363 +0,0 @@ -#ifndef _SMBNO_H_ -#define _SMBNO_H_ - -/* these define the attribute byte as seen by DOS */ -#define aRONLY (1L<<0) -#define aHIDDEN (1L<<1) -#define aSYSTEM (1L<<2) -#define aVOLID (1L<<3) -#define aDIR (1L<<4) -#define aARCH (1L<<5) - -/* error classes */ -#define SUCCESS 0 /* The request was successful. */ -#define ERRDOS 0x01 /* Error is from the core DOS operating system set. */ -#define ERRSRV 0x02 /* Error is generated by the server network file manager.*/ -#define ERRHRD 0x03 /* Error is an hardware error. */ -#define ERRCMD 0xFF /* Command was not in the "SMB" format. */ - -/* SMB X/Open error codes for the ERRdos error class */ - -#define ERRbadfunc 1 /* Invalid function (or system call) */ -#define ERRbadfile 2 /* File not found (pathname error) */ -#define ERRbadpath 3 /* Directory not found */ -#define ERRnofids 4 /* Too many open files */ -#define ERRnoaccess 5 /* Access denied */ -#define ERRbadfid 6 /* Invalid fid */ -#define ERRbadmcb 7 /* Memory control blocks destroyed */ -#define ERRnomem 8 /* Out of memory */ -#define ERRbadmem 9 /* Invalid memory block address */ -#define ERRbadenv 10 /* Invalid environment */ -#define ERRbadformat 11 /* Invalid format */ -#define ERRbadaccess 12 /* Invalid open mode */ -#define ERRbaddata 13 /* Invalid data (only from ioctl call) */ -#define ERRres 14 /* reserved */ -#define ERRbaddrive 15 /* Invalid drive */ -#define ERRremcd 16 /* Attempt to delete current directory */ -#define ERRdiffdevice 17 /* rename/move across different filesystems */ -#define ERRnofiles 18 /* no more files found in file search */ -#define ERRbadshare 32 /* Share mode on file conflict with open mode */ -#define ERRlock 33 /* Lock request conflicts with existing lock */ -#define ERRfilexists 80 /* File in operation already exists */ -#define ERRbadpipe 230 /* Named pipe invalid */ -#define ERRpipebusy 231 /* All instances of pipe are busy */ -#define ERRpipeclosing 232 /* named pipe close in progress */ -#define ERRnotconnected 233 /* No process on other end of named pipe */ -#define ERRmoredata 234 /* More data to be returned */ - -#define ERROR_INVALID_PARAMETER 87 -#define ERROR_DISK_FULL 112 -#define ERROR_INVALID_NAME 123 -#define ERROR_DIR_NOT_EMPTY 145 -#define ERROR_NOT_LOCKED 158 -#define ERROR_ALREADY_EXISTS 183 /* see also 80 ? */ -#define ERROR_EAS_DIDNT_FIT 275 /* Extended attributes didn't fit */ -#define ERROR_EAS_NOT_SUPPORTED 282 /* Extended attributes not supported */ - -/* Error codes for the ERRSRV class */ - -#define ERRerror 1 /* Non specific error code */ -#define ERRbadpw 2 /* Bad password */ -#define ERRbadtype 3 /* reserved */ -#define ERRaccess 4 /* No permissions to do the requested operation */ -#define ERRinvnid 5 /* tid invalid */ -#define ERRinvnetname 6 /* Invalid servername */ -#define ERRinvdevice 7 /* Invalid device */ -#define ERRqfull 49 /* Print queue full */ -#define ERRqtoobig 50 /* Queued item too big */ -#define ERRinvpfid 52 /* Invalid print file in smb_fid */ -#define ERRsmbcmd 64 /* Unrecognised command */ -#define ERRsrverror 65 /* smb server internal error */ -#define ERRfilespecs 67 /* fid and pathname invalid combination */ -#define ERRbadlink 68 /* reserved */ -#define ERRbadpermits 69 /* Access specified for a file is not valid */ -#define ERRbadpid 70 /* reserved */ -#define ERRsetattrmode 71 /* attribute mode invalid */ -#define ERRpaused 81 /* Message server paused */ -#define ERRmsgoff 82 /* Not receiving messages */ -#define ERRnoroom 83 /* No room for message */ -#define ERRrmuns 87 /* too many remote usernames */ -#define ERRtimeout 88 /* operation timed out */ -#define ERRnoresource 89 /* No resources currently available for request. */ -#define ERRtoomanyuids 90 /* too many userids */ -#define ERRbaduid 91 /* bad userid */ -#define ERRuseMPX 250 /* temporarily unable to use raw mode, use MPX mode */ -#define ERRuseSTD 251 /* temporarily unable to use raw mode, use std.mode */ -#define ERRcontMPX 252 /* resume MPX mode */ -#define ERRbadPW /* reserved */ -#define ERRnosupport 0xFFFF - -/* Error codes for the ERRHRD class */ - -#define ERRnowrite 19 /* read only media */ -#define ERRbadunit 20 /* Unknown device */ -#define ERRnotready 21 /* Drive not ready */ -#define ERRbadcmd 22 /* Unknown command */ -#define ERRdata 23 /* Data (CRC) error */ -#define ERRbadreq 24 /* Bad request structure length */ -#define ERRseek 25 -#define ERRbadmedia 26 -#define ERRbadsector 27 -#define ERRnopaper 28 -#define ERRwrite 29 /* write fault */ -#define ERRread 30 /* read fault */ -#define ERRgeneral 31 /* General hardware failure */ -#define ERRwrongdisk 34 -#define ERRFCBunavail 35 -#define ERRsharebufexc 36 /* share buffer exceeded */ -#define ERRdiskfull 39 - -/* - * Access modes when opening a file - */ -#define SMB_ACCMASK 0x0003 -#define SMB_O_RDONLY 0x0000 -#define SMB_O_WRONLY 0x0001 -#define SMB_O_RDWR 0x0002 - -/* offsets into message for common items */ -#define smb_com 8 -#define smb_rcls 9 -#define smb_reh 10 -#define smb_err 11 -#define smb_flg 13 -#define smb_flg2 14 -#define smb_reb 13 -#define smb_tid 28 -#define smb_pid 30 -#define smb_uid 32 -#define smb_mid 34 -#define smb_wct 36 -#define smb_vwv 37 -#define smb_vwv0 37 -#define smb_vwv1 39 -#define smb_vwv2 41 -#define smb_vwv3 43 -#define smb_vwv4 45 -#define smb_vwv5 47 -#define smb_vwv6 49 -#define smb_vwv7 51 -#define smb_vwv8 53 -#define smb_vwv9 55 -#define smb_vwv10 57 -#define smb_vwv11 59 -#define smb_vwv12 61 -#define smb_vwv13 63 -#define smb_vwv14 65 - -/* these are the trans2 sub fields for primary requests */ -#define smb_tpscnt smb_vwv0 -#define smb_tdscnt smb_vwv1 -#define smb_mprcnt smb_vwv2 -#define smb_mdrcnt smb_vwv3 -#define smb_msrcnt smb_vwv4 -#define smb_flags smb_vwv5 -#define smb_timeout smb_vwv6 -#define smb_pscnt smb_vwv9 -#define smb_psoff smb_vwv10 -#define smb_dscnt smb_vwv11 -#define smb_dsoff smb_vwv12 -#define smb_suwcnt smb_vwv13 -#define smb_setup smb_vwv14 -#define smb_setup0 smb_setup -#define smb_setup1 (smb_setup+2) -#define smb_setup2 (smb_setup+4) - -/* these are for the secondary requests */ -#define smb_spscnt smb_vwv2 -#define smb_spsoff smb_vwv3 -#define smb_spsdisp smb_vwv4 -#define smb_sdscnt smb_vwv5 -#define smb_sdsoff smb_vwv6 -#define smb_sdsdisp smb_vwv7 -#define smb_sfid smb_vwv8 - -/* and these for responses */ -#define smb_tprcnt smb_vwv0 -#define smb_tdrcnt smb_vwv1 -#define smb_prcnt smb_vwv3 -#define smb_proff smb_vwv4 -#define smb_prdisp smb_vwv5 -#define smb_drcnt smb_vwv6 -#define smb_droff smb_vwv7 -#define smb_drdisp smb_vwv8 - -/* the complete */ -#define SMBmkdir 0x00 /* create directory */ -#define SMBrmdir 0x01 /* delete directory */ -#define SMBopen 0x02 /* open file */ -#define SMBcreate 0x03 /* create file */ -#define SMBclose 0x04 /* close file */ -#define SMBflush 0x05 /* flush file */ -#define SMBunlink 0x06 /* delete file */ -#define SMBmv 0x07 /* rename file */ -#define SMBgetatr 0x08 /* get file attributes */ -#define SMBsetatr 0x09 /* set file attributes */ -#define SMBread 0x0A /* read from file */ -#define SMBwrite 0x0B /* write to file */ -#define SMBlock 0x0C /* lock byte range */ -#define SMBunlock 0x0D /* unlock byte range */ -#define SMBctemp 0x0E /* create temporary file */ -#define SMBmknew 0x0F /* make new file */ -#define SMBchkpth 0x10 /* check directory path */ -#define SMBexit 0x11 /* process exit */ -#define SMBlseek 0x12 /* seek */ -#define SMBtcon 0x70 /* tree connect */ -#define SMBtconX 0x75 /* tree connect and X*/ -#define SMBtdis 0x71 /* tree disconnect */ -#define SMBnegprot 0x72 /* negotiate protocol */ -#define SMBdskattr 0x80 /* get disk attributes */ -#define SMBsearch 0x81 /* search directory */ -#define SMBsplopen 0xC0 /* open print spool file */ -#define SMBsplwr 0xC1 /* write to print spool file */ -#define SMBsplclose 0xC2 /* close print spool file */ -#define SMBsplretq 0xC3 /* return print queue */ -#define SMBsends 0xD0 /* send single block message */ -#define SMBsendb 0xD1 /* send broadcast message */ -#define SMBfwdname 0xD2 /* forward user name */ -#define SMBcancelf 0xD3 /* cancel forward */ -#define SMBgetmac 0xD4 /* get machine name */ -#define SMBsendstrt 0xD5 /* send start of multi-block message */ -#define SMBsendend 0xD6 /* send end of multi-block message */ -#define SMBsendtxt 0xD7 /* send text of multi-block message */ - -/* Core+ protocol */ -#define SMBlockread 0x13 /* Lock a range and read */ -#define SMBwriteunlock 0x14 /* Unlock a range then write */ -#define SMBreadbraw 0x1a /* read a block of data with no smb header */ -#define SMBwritebraw 0x1d /* write a block of data with no smb header */ -#define SMBwritec 0x20 /* secondary write request */ -#define SMBwriteclose 0x2c /* write a file then close it */ - -/* dos extended protocol */ -#define SMBreadBraw 0x1A /* read block raw */ -#define SMBreadBmpx 0x1B /* read block multiplexed */ -#define SMBreadBs 0x1C /* read block (secondary response) */ -#define SMBwriteBraw 0x1D /* write block raw */ -#define SMBwriteBmpx 0x1E /* write block multiplexed */ -#define SMBwriteBs 0x1F /* write block (secondary request) */ -#define SMBwriteC 0x20 /* write complete response */ -#define SMBsetattrE 0x22 /* set file attributes expanded */ -#define SMBgetattrE 0x23 /* get file attributes expanded */ -#define SMBlockingX 0x24 /* lock/unlock byte ranges and X */ -#define SMBtrans 0x25 /* transaction - name, bytes in/out */ -#define SMBtranss 0x26 /* transaction (secondary request/response) */ -#define SMBioctl 0x27 /* IOCTL */ -#define SMBioctls 0x28 /* IOCTL (secondary request/response) */ -#define SMBcopy 0x29 /* copy */ -#define SMBmove 0x2A /* move */ -#define SMBecho 0x2B /* echo */ -#define SMBopenX 0x2D /* open and X */ -#define SMBreadX 0x2E /* read and X */ -#define SMBwriteX 0x2F /* write and X */ -#define SMBsesssetupX 0x73 /* Session Set Up & X (including User Logon) */ -#define SMBtconX 0x75 /* tree connect and X */ -#define SMBffirst 0x82 /* find first */ -#define SMBfunique 0x83 /* find unique */ -#define SMBfclose 0x84 /* find close */ -#define SMBinvalid 0xFE /* invalid command */ - - -/* Extended 2.0 protocol */ -#define SMBtrans2 0x32 /* TRANS2 protocol set */ -#define SMBtranss2 0x33 /* TRANS2 protocol set, secondary command */ -#define SMBfindclose 0x34 /* Terminate a TRANSACT2_FINDFIRST */ -#define SMBfindnclose 0x35 /* Terminate a TRANSACT2_FINDNOTIFYFIRST */ -#define SMBulogoffX 0x74 /* user logoff */ - -/* these are the TRANS2 sub commands */ -#define TRANSACT2_OPEN 0 -#define TRANSACT2_FINDFIRST 1 -#define TRANSACT2_FINDNEXT 2 -#define TRANSACT2_QFSINFO 3 -#define TRANSACT2_SETFSINFO 4 -#define TRANSACT2_QPATHINFO 5 -#define TRANSACT2_SETPATHINFO 6 -#define TRANSACT2_QFILEINFO 7 -#define TRANSACT2_SETFILEINFO 8 -#define TRANSACT2_FSCTL 9 -#define TRANSACT2_IOCTL 10 -#define TRANSACT2_FINDNOTIFYFIRST 11 -#define TRANSACT2_FINDNOTIFYNEXT 12 -#define TRANSACT2_MKDIR 13 - -/* Information Levels - Shared? */ -#define SMB_INFO_STANDARD 1 -#define SMB_INFO_QUERY_EA_SIZE 2 -#define SMB_INFO_QUERY_EAS_FROM_LIST 3 -#define SMB_INFO_QUERY_ALL_EAS 4 -#define SMB_INFO_IS_NAME_VALID 6 - -/* Information Levels - TRANSACT2_FINDFIRST */ -#define SMB_FIND_FILE_DIRECTORY_INFO 0x101 -#define SMB_FIND_FILE_FULL_DIRECTORY_INFO 0x102 -#define SMB_FIND_FILE_NAMES_INFO 0x103 -#define SMB_FIND_FILE_BOTH_DIRECTORY_INFO 0x104 - -/* Information Levels - TRANSACT2_QPATHINFO */ -#define SMB_QUERY_FILE_BASIC_INFO 0x101 -#define SMB_QUERY_FILE_STANDARD_INFO 0x102 -#define SMB_QUERY_FILE_EA_INFO 0x103 -#define SMB_QUERY_FILE_NAME_INFO 0x104 -#define SMB_QUERY_FILE_ALL_INFO 0x107 -#define SMB_QUERY_FILE_ALT_NAME_INFO 0x108 -#define SMB_QUERY_FILE_STREAM_INFO 0x109 -#define SMB_QUERY_FILE_COMPRESSION_INFO 0x10b - -/* Information Levels - TRANSACT2_SETFILEINFO */ -#define SMB_SET_FILE_BASIC_INFO 0x101 -#define SMB_SET_FILE_DISPOSITION_INFO 0x102 -#define SMB_SET_FILE_ALLOCATION_INFO 0x103 -#define SMB_SET_FILE_END_OF_FILE_INFO 0x104 - -/* smb_flg field flags */ -#define SMB_FLAGS_SUPPORT_LOCKREAD 0x01 -#define SMB_FLAGS_CLIENT_BUF_AVAIL 0x02 -#define SMB_FLAGS_RESERVED 0x04 -#define SMB_FLAGS_CASELESS_PATHNAMES 0x08 -#define SMB_FLAGS_CANONICAL_PATHNAMES 0x10 -#define SMB_FLAGS_REQUEST_OPLOCK 0x20 -#define SMB_FLAGS_REQUEST_BATCH_OPLOCK 0x40 -#define SMB_FLAGS_REPLY 0x80 - -/* smb_flg2 field flags (samba-2.2.0/source/include/smb.h) */ -#define SMB_FLAGS2_LONG_PATH_COMPONENTS 0x0001 -#define SMB_FLAGS2_EXTENDED_ATTRIBUTES 0x0002 -#define SMB_FLAGS2_DFS_PATHNAMES 0x1000 -#define SMB_FLAGS2_READ_PERMIT_NO_EXECUTE 0x2000 -#define SMB_FLAGS2_32_BIT_ERROR_CODES 0x4000 -#define SMB_FLAGS2_UNICODE_STRINGS 0x8000 - - -/* - * UNIX stuff (from samba trans2.h) - */ -#define MIN_UNIX_INFO_LEVEL 0x200 -#define MAX_UNIX_INFO_LEVEL 0x2FF -#define SMB_FIND_FILE_UNIX 0x202 -#define SMB_QUERY_FILE_UNIX_BASIC 0x200 -#define SMB_QUERY_FILE_UNIX_LINK 0x201 -#define SMB_QUERY_FILE_UNIX_HLINK 0x202 -#define SMB_SET_FILE_UNIX_BASIC 0x200 -#define SMB_SET_FILE_UNIX_LINK 0x201 -#define SMB_SET_FILE_UNIX_HLINK 0x203 -#define SMB_QUERY_CIFS_UNIX_INFO 0x200 - -/* values which means "don't change it" */ -#define SMB_MODE_NO_CHANGE 0xFFFFFFFF -#define SMB_UID_NO_CHANGE 0xFFFFFFFF -#define SMB_GID_NO_CHANGE 0xFFFFFFFF -#define SMB_TIME_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL -#define SMB_SIZE_NO_CHANGE 0xFFFFFFFFFFFFFFFFULL - -/* UNIX filetype mappings. */ -#define UNIX_TYPE_FILE 0 -#define UNIX_TYPE_DIR 1 -#define UNIX_TYPE_SYMLINK 2 -#define UNIX_TYPE_CHARDEV 3 -#define UNIX_TYPE_BLKDEV 4 -#define UNIX_TYPE_FIFO 5 -#define UNIX_TYPE_SOCKET 6 -#define UNIX_TYPE_UNKNOWN 0xFFFFFFFF - -#endif /* _SMBNO_H_ */ -- cgit v1.2.3-59-g8ed1b From 40fb29a777d23b1161271ec88fd21739835e4f6a Mon Sep 17 00:00:00 2001 From: Pavan Savoy Date: Thu, 30 Sep 2010 16:13:28 -0400 Subject: tty.h: new ldisc for TI WiLink ST Texas Instrument's WiLink7 connectivity devices pack wireless connectivity technologies like Bluetooth, FM Radio Receiver and Transmitter, GPS and WLAN into a single die. The BT, FM and GPS core on the chip are interfaced to application processors via a single UART. This line discipline driver allows such different technologies to be used simultaneous and independent of each other. Signed-off-by: Pavan Savoy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ti-st/ti_wilink_st.h | 5 ----- include/linux/tty.h | 1 + 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'include') diff --git a/drivers/staging/ti-st/ti_wilink_st.h b/drivers/staging/ti-st/ti_wilink_st.h index 537efce96d58..afb0cc644c1f 100644 --- a/drivers/staging/ti-st/ti_wilink_st.h +++ b/drivers/staging/ti-st/ti_wilink_st.h @@ -25,11 +25,6 @@ #ifndef TI_WILINK_ST_H #define TI_WILINK_ST_H -/* TODO: - * Move the following to tty.h upon acceptance - */ -#define N_TI_WL 22 /* Ldisc for TI's WL BT, FM, GPS combo chips */ - #ifdef __KERNEL__ /** * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW diff --git a/include/linux/tty.h b/include/linux/tty.h index 67d64e6efe7a..244bb8de2b92 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -50,6 +50,7 @@ #define N_V253 19 /* Codec control over voice modem */ #define N_CAIF 20 /* CAIF protocol for talking to modems */ #define N_GSM0710 21 /* GSM 0710 Mux */ +#define N_TI_WL 22 /* for TI's WL BT, FM, GPS combo chips */ /* * This character is the same as _POSIX_VDISABLE: it cannot be used as -- cgit v1.2.3-59-g8ed1b From e5558679bbb80788dc8c4c30484ac0a68e971ca5 Mon Sep 17 00:00:00 2001 From: Pavan Savoy Date: Thu, 30 Sep 2010 16:13:30 -0400 Subject: staging: ti-st: mv ti_wilink_st header Move the header to a standard linux device driver location. This should pave the way for other drivers to be moved into the relevant directories. ti_wilink_st.h is a common header file used by the TI's shared transport device driver for WiLink chipsets. Each individual protocol drivers like bluetooth driver, FM V4L2 driver and GPS drivers will make use of this header. Signed-off-by: Pavan Savoy Signed-off-by: Greg Kroah-Hartman --- drivers/staging/ti-st/bt_drv.c | 2 +- drivers/staging/ti-st/st_core.c | 2 +- drivers/staging/ti-st/st_kim.c | 2 +- drivers/staging/ti-st/st_ll.c | 2 +- drivers/staging/ti-st/ti_wilink_st.h | 402 ----------------------------------- include/linux/ti_wilink_st.h | 402 +++++++++++++++++++++++++++++++++++ 6 files changed, 406 insertions(+), 406 deletions(-) delete mode 100644 drivers/staging/ti-st/ti_wilink_st.h create mode 100644 include/linux/ti_wilink_st.h (limited to 'include') diff --git a/drivers/staging/ti-st/bt_drv.c b/drivers/staging/ti-st/bt_drv.c index 50da66db72c2..75065bf39e5c 100644 --- a/drivers/staging/ti-st/bt_drv.c +++ b/drivers/staging/ti-st/bt_drv.c @@ -24,7 +24,7 @@ #include #include -#include "ti_wilink_st.h" +#include #include "bt_drv.h" /* Define this macro to get debug msg */ diff --git a/drivers/staging/ti-st/st_core.c b/drivers/staging/ti-st/st_core.c index 03397bee37db..5bef61e579c3 100644 --- a/drivers/staging/ti-st/st_core.c +++ b/drivers/staging/ti-st/st_core.c @@ -28,7 +28,7 @@ #include #include #include -#include "ti_wilink_st.h" +#include /* strings to be used for rfkill entries and by * ST Core to be used for sysfs debug entry diff --git a/drivers/staging/ti-st/st_kim.c b/drivers/staging/ti-st/st_kim.c index 09e2c97562be..372a9960c304 100644 --- a/drivers/staging/ti-st/st_kim.c +++ b/drivers/staging/ti-st/st_kim.c @@ -36,7 +36,7 @@ #include #include -#include "ti_wilink_st.h" +#include static int kim_probe(struct platform_device *pdev); diff --git a/drivers/staging/ti-st/st_ll.c b/drivers/staging/ti-st/st_ll.c index d08b58e78083..ed1e4bc180d3 100644 --- a/drivers/staging/ti-st/st_ll.c +++ b/drivers/staging/ti-st/st_ll.c @@ -21,7 +21,7 @@ #define pr_fmt(fmt) "(stll) :" fmt #include #include -#include "ti_wilink_st.h" +#include /**********************************************************************/ /* internal functions */ diff --git a/drivers/staging/ti-st/ti_wilink_st.h b/drivers/staging/ti-st/ti_wilink_st.h deleted file mode 100644 index 2a5acf599598..000000000000 --- a/drivers/staging/ti-st/ti_wilink_st.h +++ /dev/null @@ -1,402 +0,0 @@ -/* - * Shared Transport Header file - * To be included by the protocol stack drivers for - * Texas Instruments BT,FM and GPS combo chip drivers - * and also serves the sub-modules of the shared transport driver. - * - * Copyright (C) 2009-2010 Texas Instruments - * Author: Pavan Savoy - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#ifndef TI_WILINK_ST_H -#define TI_WILINK_ST_H - -/** - * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW - * gpio states for their chip/core enable gpios - */ -enum kim_gpio_state { - KIM_GPIO_INACTIVE, - KIM_GPIO_ACTIVE, -}; - -/** - * enum proto-type - The protocol on WiLink chips which share a - * common physical interface like UART. - */ -enum proto_type { - ST_BT, - ST_FM, - ST_GPS, - ST_MAX, -}; - -/** - * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST - * @type: type of the protocol being registered among the - * available proto_type(BT, FM, GPS the protocol which share TTY). - * @recv: the receiver callback pointing to a function in the - * protocol drivers called by the ST driver upon receiving - * relevant data. - * @match_packet: reserved for future use, to make ST more generic - * @reg_complete_cb: callback handler pointing to a function in protocol - * handler called by ST when the pending registrations are complete. - * The registrations are marked pending, in situations when fw - * download is in progress. - * @write: pointer to function in ST provided to protocol drivers from ST, - * to be made use when protocol drivers have data to send to TTY. - * @priv_data: privdate data holder for the protocol drivers, sent - * from the protocol drivers during registration, and sent back on - * reg_complete_cb and recv. - */ -struct st_proto_s { - enum proto_type type; - long (*recv) (void *, struct sk_buff *); - unsigned char (*match_packet) (const unsigned char *data); - void (*reg_complete_cb) (void *, char data); - long (*write) (struct sk_buff *skb); - void *priv_data; -}; - -extern long st_register(struct st_proto_s *); -extern long st_unregister(enum proto_type); - - -/* - * header information used by st_core.c - */ - -/* states of protocol list */ -#define ST_NOTEMPTY 1 -#define ST_EMPTY 0 - -/* - * possible st_states - */ -#define ST_INITIALIZING 1 -#define ST_REG_IN_PROGRESS 2 -#define ST_REG_PENDING 3 -#define ST_WAITING_FOR_RESP 4 - -/** - * struct st_data_s - ST core internal structure - * @st_state: different states of ST like initializing, registration - * in progress, this is mainly used to return relevant err codes - * when protocol drivers are registering. It is also used to track - * the recv function, as in during fw download only HCI events - * can occur , where as during other times other events CH8, CH9 - * can occur. - * @tty: tty provided by the TTY core for line disciplines. - * @ldisc_ops: the procedures that this line discipline registers with TTY. - * @tx_skb: If for some reason the tty's write returns lesser bytes written - * then to maintain the rest of data to be written on next instance. - * This needs to be protected, hence the lock inside wakeup func. - * @tx_state: if the data is being written onto the TTY and protocol driver - * wants to send more, queue up data and mark that there is - * more data to send. - * @list: the list of protocols registered, only MAX can exist, one protocol - * can register only once. - * @rx_state: states to be maintained inside st's tty receive - * @rx_count: count to be maintained inside st's tty receieve - * @rx_skb: the skb where all data for a protocol gets accumulated, - * since tty might not call receive when a complete event packet - * is received, the states, count and the skb needs to be maintained. - * @txq: the list of skbs which needs to be sent onto the TTY. - * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued - * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs - * from waitq can be moved onto the txq. - * Needs locking too. - * @lock: the lock to protect skbs, queues, and ST states. - * @protos_registered: count of the protocols registered, also when 0 the - * chip enable gpio can be toggled, and when it changes to 1 the fw - * needs to be downloaded to initialize chip side ST. - * @ll_state: the various PM states the chip can be, the states are notified - * to us, when the chip sends relevant PM packets(SLEEP_IND, WAKE_IND). - * @kim_data: reference to the parent encapsulating structure. - * - */ -struct st_data_s { - unsigned long st_state; - struct tty_struct *tty; - struct tty_ldisc_ops *ldisc_ops; - struct sk_buff *tx_skb; -#define ST_TX_SENDING 1 -#define ST_TX_WAKEUP 2 - unsigned long tx_state; - struct st_proto_s *list[ST_MAX]; - unsigned long rx_state; - unsigned long rx_count; - struct sk_buff *rx_skb; - struct sk_buff_head txq, tx_waitq; - spinlock_t lock; - unsigned char protos_registered; - unsigned long ll_state; - void *kim_data; -}; - -/** - * st_int_write - - * point this to tty->driver->write or tty->ops->write - * depending upon the kernel version - */ -int st_int_write(struct st_data_s*, const unsigned char*, int); - -/** - * st_write - - * internal write function, passed onto protocol drivers - * via the write function ptr of protocol struct - */ -long st_write(struct sk_buff *); - -/* function to be called from ST-LL */ -void st_ll_send_frame(enum proto_type, struct sk_buff *); - -/* internal wake up function */ -void st_tx_wakeup(struct st_data_s *st_data); - -/* init, exit entry funcs called from KIM */ -int st_core_init(struct st_data_s **); -void st_core_exit(struct st_data_s *); - -/* ask for reference from KIM */ -void st_kim_ref(struct st_data_s **, int); - -#define GPS_STUB_TEST -#ifdef GPS_STUB_TEST -int gps_chrdrv_stub_write(const unsigned char*, int); -void gps_chrdrv_stub_init(void); -#endif - -/* - * header information used by st_kim.c - */ - -/* time in msec to wait for - * line discipline to be installed - */ -#define LDISC_TIME 500 -#define CMD_RESP_TIME 500 -#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ - | ((unsigned short)((unsigned char)(b))) << 8)) - -#define GPIO_HIGH 1 -#define GPIO_LOW 0 - -/* the Power-On-Reset logic, requires to attempt - * to download firmware onto chip more than once - * since the self-test for chip takes a while - */ -#define POR_RETRY_COUNT 5 - -/** - * struct chip_version - save the chip version - */ -struct chip_version { - unsigned short full; - unsigned short chip; - unsigned short min_ver; - unsigned short maj_ver; -}; - -/** - * struct kim_data_s - the KIM internal data, embedded as the - * platform's drv data. One for each ST device in the system. - * @uim_pid: KIM needs to communicate with UIM to request to install - * the ldisc by opening UART when protocol drivers register. - * @kim_pdev: the platform device added in one of the board-XX.c file - * in arch/XX/ directory, 1 for each ST device. - * @kim_rcvd: completion handler to notify when data was received, - * mainly used during fw download, which involves multiple send/wait - * for each of the HCI-VS commands. - * @ldisc_installed: completion handler to notify that the UIM accepted - * the request to install ldisc, notify from tty_open which suggests - * the ldisc was properly installed. - * @resp_buffer: data buffer for the .bts fw file name. - * @fw_entry: firmware class struct to request/release the fw. - * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores. - * @rx_state: the rx state for kim's receive func during fw download. - * @rx_count: the rx count for the kim's receive func during fw download. - * @rx_skb: all of fw data might not come at once, and hence data storage for - * whole of the fw response, only HCI_EVENTs and hence diff from ST's - * response. - * @rfkill: rfkill data for each of the cores to be registered with rfkill. - * @rf_protos: proto types of the data registered with rfkill sub-system. - * @core_data: ST core's data, which mainly is the tty's disc_data - * @version: chip version available via a sysfs entry. - * - */ -struct kim_data_s { - long uim_pid; - struct platform_device *kim_pdev; - struct completion kim_rcvd, ldisc_installed; - char resp_buffer[30]; - const struct firmware *fw_entry; - long gpios[ST_MAX]; - unsigned long rx_state; - unsigned long rx_count; - struct sk_buff *rx_skb; - struct rfkill *rfkill[ST_MAX]; - enum proto_type rf_protos[ST_MAX]; - struct st_data_s *core_data; - struct chip_version version; -}; - -/** - * functions called when 1 of the protocol drivers gets - * registered, these need to communicate with UIM to request - * ldisc installed, read chip_version, download relevant fw - */ -long st_kim_start(void *); -long st_kim_stop(void *); - -void st_kim_recv(void *, const unsigned char *, long count); -void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); -void st_kim_complete(void *); -void kim_st_list_protocols(struct st_data_s *, void *); - -/* - * BTS headers - */ -#define ACTION_SEND_COMMAND 1 -#define ACTION_WAIT_EVENT 2 -#define ACTION_SERIAL 3 -#define ACTION_DELAY 4 -#define ACTION_RUN_SCRIPT 5 -#define ACTION_REMARKS 6 - -/** - * struct bts_header - the fw file is NOT binary which can - * be sent onto TTY as is. The .bts is more a script - * file which has different types of actions. - * Each such action needs to be parsed by the KIM and - * relevant procedure to be called. - */ -struct bts_header { - u32 magic; - u32 version; - u8 future[24]; - u8 actions[0]; -} __attribute__ ((packed)); - -/** - * struct bts_action - Each .bts action has its own type of - * data. - */ -struct bts_action { - u16 type; - u16 size; - u8 data[0]; -} __attribute__ ((packed)); - -struct bts_action_send { - u8 data[0]; -} __attribute__ ((packed)); - -struct bts_action_wait { - u32 msec; - u32 size; - u8 data[0]; -} __attribute__ ((packed)); - -struct bts_action_delay { - u32 msec; -} __attribute__ ((packed)); - -struct bts_action_serial { - u32 baud; - u32 flow_control; -} __attribute__ ((packed)); - -/** - * struct hci_command - the HCI-VS for intrepreting - * the change baud rate of host-side UART, which - * needs to be ignored, since UIM would do that - * when it receives request from KIM for ldisc installation. - */ -struct hci_command { - u8 prefix; - u16 opcode; - u8 plen; - u32 speed; -} __attribute__ ((packed)); - -/* - * header information used by st_ll.c - */ - -/* ST LL receiver states */ -#define ST_W4_PACKET_TYPE 0 -#define ST_BT_W4_EVENT_HDR 1 -#define ST_BT_W4_ACL_HDR 2 -#define ST_BT_W4_SCO_HDR 3 -#define ST_BT_W4_DATA 4 -#define ST_FM_W4_EVENT_HDR 5 -#define ST_GPS_W4_EVENT_HDR 6 - -/* ST LL state machines */ -#define ST_LL_ASLEEP 0 -#define ST_LL_ASLEEP_TO_AWAKE 1 -#define ST_LL_AWAKE 2 -#define ST_LL_AWAKE_TO_ASLEEP 3 -#define ST_LL_INVALID 4 - -/* different PM notifications coming from chip */ -#define LL_SLEEP_IND 0x30 -#define LL_SLEEP_ACK 0x31 -#define LL_WAKE_UP_IND 0x32 -#define LL_WAKE_UP_ACK 0x33 - -/* initialize and de-init ST LL */ -long st_ll_init(struct st_data_s *); -long st_ll_deinit(struct st_data_s *); - -/** - * enable/disable ST LL along with KIM start/stop - * called by ST Core - */ -void st_ll_enable(struct st_data_s *); -void st_ll_disable(struct st_data_s *); - -/** - * various funcs used by ST core to set/get the various PM states - * of the chip. - */ -unsigned long st_ll_getstate(struct st_data_s *); -unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char); -void st_ll_wakeup(struct st_data_s *); - -/* - * header information used by st_core.c for FM and GPS - * packet parsing, the bluetooth headers are already available - * at net/bluetooth/ - */ - -struct fm_event_hdr { - u8 plen; -} __attribute__ ((packed)); - -#define FM_MAX_FRAME_SIZE 0xFF /* TODO: */ -#define FM_EVENT_HDR_SIZE 1 /* size of fm_event_hdr */ -#define ST_FM_CH8_PKT 0x8 - -/* gps stuff */ -struct gps_event_hdr { - u8 opcode; - u16 plen; -} __attribute__ ((packed)); - -#endif /* TI_WILINK_ST_H */ diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h new file mode 100644 index 000000000000..2a5acf599598 --- /dev/null +++ b/include/linux/ti_wilink_st.h @@ -0,0 +1,402 @@ +/* + * Shared Transport Header file + * To be included by the protocol stack drivers for + * Texas Instruments BT,FM and GPS combo chip drivers + * and also serves the sub-modules of the shared transport driver. + * + * Copyright (C) 2009-2010 Texas Instruments + * Author: Pavan Savoy + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef TI_WILINK_ST_H +#define TI_WILINK_ST_H + +/** + * enum kim_gpio_state - Few protocols such as FM have ACTIVE LOW + * gpio states for their chip/core enable gpios + */ +enum kim_gpio_state { + KIM_GPIO_INACTIVE, + KIM_GPIO_ACTIVE, +}; + +/** + * enum proto-type - The protocol on WiLink chips which share a + * common physical interface like UART. + */ +enum proto_type { + ST_BT, + ST_FM, + ST_GPS, + ST_MAX, +}; + +/** + * struct st_proto_s - Per Protocol structure from BT/FM/GPS to ST + * @type: type of the protocol being registered among the + * available proto_type(BT, FM, GPS the protocol which share TTY). + * @recv: the receiver callback pointing to a function in the + * protocol drivers called by the ST driver upon receiving + * relevant data. + * @match_packet: reserved for future use, to make ST more generic + * @reg_complete_cb: callback handler pointing to a function in protocol + * handler called by ST when the pending registrations are complete. + * The registrations are marked pending, in situations when fw + * download is in progress. + * @write: pointer to function in ST provided to protocol drivers from ST, + * to be made use when protocol drivers have data to send to TTY. + * @priv_data: privdate data holder for the protocol drivers, sent + * from the protocol drivers during registration, and sent back on + * reg_complete_cb and recv. + */ +struct st_proto_s { + enum proto_type type; + long (*recv) (void *, struct sk_buff *); + unsigned char (*match_packet) (const unsigned char *data); + void (*reg_complete_cb) (void *, char data); + long (*write) (struct sk_buff *skb); + void *priv_data; +}; + +extern long st_register(struct st_proto_s *); +extern long st_unregister(enum proto_type); + + +/* + * header information used by st_core.c + */ + +/* states of protocol list */ +#define ST_NOTEMPTY 1 +#define ST_EMPTY 0 + +/* + * possible st_states + */ +#define ST_INITIALIZING 1 +#define ST_REG_IN_PROGRESS 2 +#define ST_REG_PENDING 3 +#define ST_WAITING_FOR_RESP 4 + +/** + * struct st_data_s - ST core internal structure + * @st_state: different states of ST like initializing, registration + * in progress, this is mainly used to return relevant err codes + * when protocol drivers are registering. It is also used to track + * the recv function, as in during fw download only HCI events + * can occur , where as during other times other events CH8, CH9 + * can occur. + * @tty: tty provided by the TTY core for line disciplines. + * @ldisc_ops: the procedures that this line discipline registers with TTY. + * @tx_skb: If for some reason the tty's write returns lesser bytes written + * then to maintain the rest of data to be written on next instance. + * This needs to be protected, hence the lock inside wakeup func. + * @tx_state: if the data is being written onto the TTY and protocol driver + * wants to send more, queue up data and mark that there is + * more data to send. + * @list: the list of protocols registered, only MAX can exist, one protocol + * can register only once. + * @rx_state: states to be maintained inside st's tty receive + * @rx_count: count to be maintained inside st's tty receieve + * @rx_skb: the skb where all data for a protocol gets accumulated, + * since tty might not call receive when a complete event packet + * is received, the states, count and the skb needs to be maintained. + * @txq: the list of skbs which needs to be sent onto the TTY. + * @tx_waitq: if the chip is not in AWAKE state, the skbs needs to be queued + * up in here, PM(WAKEUP_IND) data needs to be sent and then the skbs + * from waitq can be moved onto the txq. + * Needs locking too. + * @lock: the lock to protect skbs, queues, and ST states. + * @protos_registered: count of the protocols registered, also when 0 the + * chip enable gpio can be toggled, and when it changes to 1 the fw + * needs to be downloaded to initialize chip side ST. + * @ll_state: the various PM states the chip can be, the states are notified + * to us, when the chip sends relevant PM packets(SLEEP_IND, WAKE_IND). + * @kim_data: reference to the parent encapsulating structure. + * + */ +struct st_data_s { + unsigned long st_state; + struct tty_struct *tty; + struct tty_ldisc_ops *ldisc_ops; + struct sk_buff *tx_skb; +#define ST_TX_SENDING 1 +#define ST_TX_WAKEUP 2 + unsigned long tx_state; + struct st_proto_s *list[ST_MAX]; + unsigned long rx_state; + unsigned long rx_count; + struct sk_buff *rx_skb; + struct sk_buff_head txq, tx_waitq; + spinlock_t lock; + unsigned char protos_registered; + unsigned long ll_state; + void *kim_data; +}; + +/** + * st_int_write - + * point this to tty->driver->write or tty->ops->write + * depending upon the kernel version + */ +int st_int_write(struct st_data_s*, const unsigned char*, int); + +/** + * st_write - + * internal write function, passed onto protocol drivers + * via the write function ptr of protocol struct + */ +long st_write(struct sk_buff *); + +/* function to be called from ST-LL */ +void st_ll_send_frame(enum proto_type, struct sk_buff *); + +/* internal wake up function */ +void st_tx_wakeup(struct st_data_s *st_data); + +/* init, exit entry funcs called from KIM */ +int st_core_init(struct st_data_s **); +void st_core_exit(struct st_data_s *); + +/* ask for reference from KIM */ +void st_kim_ref(struct st_data_s **, int); + +#define GPS_STUB_TEST +#ifdef GPS_STUB_TEST +int gps_chrdrv_stub_write(const unsigned char*, int); +void gps_chrdrv_stub_init(void); +#endif + +/* + * header information used by st_kim.c + */ + +/* time in msec to wait for + * line discipline to be installed + */ +#define LDISC_TIME 500 +#define CMD_RESP_TIME 500 +#define MAKEWORD(a, b) ((unsigned short)(((unsigned char)(a)) \ + | ((unsigned short)((unsigned char)(b))) << 8)) + +#define GPIO_HIGH 1 +#define GPIO_LOW 0 + +/* the Power-On-Reset logic, requires to attempt + * to download firmware onto chip more than once + * since the self-test for chip takes a while + */ +#define POR_RETRY_COUNT 5 + +/** + * struct chip_version - save the chip version + */ +struct chip_version { + unsigned short full; + unsigned short chip; + unsigned short min_ver; + unsigned short maj_ver; +}; + +/** + * struct kim_data_s - the KIM internal data, embedded as the + * platform's drv data. One for each ST device in the system. + * @uim_pid: KIM needs to communicate with UIM to request to install + * the ldisc by opening UART when protocol drivers register. + * @kim_pdev: the platform device added in one of the board-XX.c file + * in arch/XX/ directory, 1 for each ST device. + * @kim_rcvd: completion handler to notify when data was received, + * mainly used during fw download, which involves multiple send/wait + * for each of the HCI-VS commands. + * @ldisc_installed: completion handler to notify that the UIM accepted + * the request to install ldisc, notify from tty_open which suggests + * the ldisc was properly installed. + * @resp_buffer: data buffer for the .bts fw file name. + * @fw_entry: firmware class struct to request/release the fw. + * @gpios: the list of core/chip enable gpios for BT, FM and GPS cores. + * @rx_state: the rx state for kim's receive func during fw download. + * @rx_count: the rx count for the kim's receive func during fw download. + * @rx_skb: all of fw data might not come at once, and hence data storage for + * whole of the fw response, only HCI_EVENTs and hence diff from ST's + * response. + * @rfkill: rfkill data for each of the cores to be registered with rfkill. + * @rf_protos: proto types of the data registered with rfkill sub-system. + * @core_data: ST core's data, which mainly is the tty's disc_data + * @version: chip version available via a sysfs entry. + * + */ +struct kim_data_s { + long uim_pid; + struct platform_device *kim_pdev; + struct completion kim_rcvd, ldisc_installed; + char resp_buffer[30]; + const struct firmware *fw_entry; + long gpios[ST_MAX]; + unsigned long rx_state; + unsigned long rx_count; + struct sk_buff *rx_skb; + struct rfkill *rfkill[ST_MAX]; + enum proto_type rf_protos[ST_MAX]; + struct st_data_s *core_data; + struct chip_version version; +}; + +/** + * functions called when 1 of the protocol drivers gets + * registered, these need to communicate with UIM to request + * ldisc installed, read chip_version, download relevant fw + */ +long st_kim_start(void *); +long st_kim_stop(void *); + +void st_kim_recv(void *, const unsigned char *, long count); +void st_kim_chip_toggle(enum proto_type, enum kim_gpio_state); +void st_kim_complete(void *); +void kim_st_list_protocols(struct st_data_s *, void *); + +/* + * BTS headers + */ +#define ACTION_SEND_COMMAND 1 +#define ACTION_WAIT_EVENT 2 +#define ACTION_SERIAL 3 +#define ACTION_DELAY 4 +#define ACTION_RUN_SCRIPT 5 +#define ACTION_REMARKS 6 + +/** + * struct bts_header - the fw file is NOT binary which can + * be sent onto TTY as is. The .bts is more a script + * file which has different types of actions. + * Each such action needs to be parsed by the KIM and + * relevant procedure to be called. + */ +struct bts_header { + u32 magic; + u32 version; + u8 future[24]; + u8 actions[0]; +} __attribute__ ((packed)); + +/** + * struct bts_action - Each .bts action has its own type of + * data. + */ +struct bts_action { + u16 type; + u16 size; + u8 data[0]; +} __attribute__ ((packed)); + +struct bts_action_send { + u8 data[0]; +} __attribute__ ((packed)); + +struct bts_action_wait { + u32 msec; + u32 size; + u8 data[0]; +} __attribute__ ((packed)); + +struct bts_action_delay { + u32 msec; +} __attribute__ ((packed)); + +struct bts_action_serial { + u32 baud; + u32 flow_control; +} __attribute__ ((packed)); + +/** + * struct hci_command - the HCI-VS for intrepreting + * the change baud rate of host-side UART, which + * needs to be ignored, since UIM would do that + * when it receives request from KIM for ldisc installation. + */ +struct hci_command { + u8 prefix; + u16 opcode; + u8 plen; + u32 speed; +} __attribute__ ((packed)); + +/* + * header information used by st_ll.c + */ + +/* ST LL receiver states */ +#define ST_W4_PACKET_TYPE 0 +#define ST_BT_W4_EVENT_HDR 1 +#define ST_BT_W4_ACL_HDR 2 +#define ST_BT_W4_SCO_HDR 3 +#define ST_BT_W4_DATA 4 +#define ST_FM_W4_EVENT_HDR 5 +#define ST_GPS_W4_EVENT_HDR 6 + +/* ST LL state machines */ +#define ST_LL_ASLEEP 0 +#define ST_LL_ASLEEP_TO_AWAKE 1 +#define ST_LL_AWAKE 2 +#define ST_LL_AWAKE_TO_ASLEEP 3 +#define ST_LL_INVALID 4 + +/* different PM notifications coming from chip */ +#define LL_SLEEP_IND 0x30 +#define LL_SLEEP_ACK 0x31 +#define LL_WAKE_UP_IND 0x32 +#define LL_WAKE_UP_ACK 0x33 + +/* initialize and de-init ST LL */ +long st_ll_init(struct st_data_s *); +long st_ll_deinit(struct st_data_s *); + +/** + * enable/disable ST LL along with KIM start/stop + * called by ST Core + */ +void st_ll_enable(struct st_data_s *); +void st_ll_disable(struct st_data_s *); + +/** + * various funcs used by ST core to set/get the various PM states + * of the chip. + */ +unsigned long st_ll_getstate(struct st_data_s *); +unsigned long st_ll_sleep_state(struct st_data_s *, unsigned char); +void st_ll_wakeup(struct st_data_s *); + +/* + * header information used by st_core.c for FM and GPS + * packet parsing, the bluetooth headers are already available + * at net/bluetooth/ + */ + +struct fm_event_hdr { + u8 plen; +} __attribute__ ((packed)); + +#define FM_MAX_FRAME_SIZE 0xFF /* TODO: */ +#define FM_EVENT_HDR_SIZE 1 /* size of fm_event_hdr */ +#define ST_FM_CH8_PKT 0x8 + +/* gps stuff */ +struct gps_event_hdr { + u8 opcode; + u16 plen; +} __attribute__ ((packed)); + +#endif /* TI_WILINK_ST_H */ -- cgit v1.2.3-59-g8ed1b From 73f12e8d3d94828b9efe2b8b8a34b4ad6d14ee47 Mon Sep 17 00:00:00 2001 From: Pavan Savoy Date: Tue, 12 Oct 2010 16:27:38 -0400 Subject: drivers: misc: ti-st: fix review comments Based on comments from Jiri Slaby, drop the register storage specifier, remove the unused code, cleanup the const to non-const type casting. Also make the line discipline ops structure static, since its a singleton, unmodified structure which need not be in heap. Reported-by: Jiri Slaby Signed-off-by: Pavan Savoy Signed-off-by: Greg Kroah-Hartman --- drivers/misc/ti-st/st_core.c | 73 +++++++++++--------------------------------- drivers/misc/ti-st/st_kim.c | 15 ++++----- include/linux/ti_wilink_st.h | 2 -- 3 files changed, 25 insertions(+), 65 deletions(-) (limited to 'include') diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 9bae0eb26b96..f9aad06d1ae5 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -31,15 +31,6 @@ #include #include -/* strings to be used for rfkill entries and by - * ST Core to be used for sysfs debug entry - */ -#define PROTO_ENTRY(type, name) name -const unsigned char *protocol_strngs[] = { - PROTO_ENTRY(ST_BT, "Bluetooth"), - PROTO_ENTRY(ST_FM, "FM"), - PROTO_ENTRY(ST_GPS, "GPS"), -}; /* function pointer pointing to either, * st_kim_recv during registration to receive fw download responses * st_int_recv after registration to receive proto stack responses @@ -144,7 +135,7 @@ void st_reg_complete(struct st_data_s *st_gdata, char err) static inline int st_check_data_len(struct st_data_s *st_gdata, int protoid, int len) { - register int room = skb_tailroom(st_gdata->rx_skb); + int room = skb_tailroom(st_gdata->rx_skb); pr_debug("len %d room %d", len, room); @@ -187,7 +178,7 @@ static inline int st_check_data_len(struct st_data_s *st_gdata, static inline void st_wakeup_ack(struct st_data_s *st_gdata, unsigned char cmd) { - register struct sk_buff *waiting_skb; + struct sk_buff *waiting_skb; unsigned long flags = 0; spin_lock_irqsave(&st_gdata->lock, flags); @@ -216,13 +207,13 @@ static inline void st_wakeup_ack(struct st_data_s *st_gdata, void st_int_recv(void *disc_data, const unsigned char *data, long count) { - register char *ptr; + char *ptr; struct hci_event_hdr *eh; struct hci_acl_hdr *ah; struct hci_sco_hdr *sh; struct fm_event_hdr *fm; struct gps_event_hdr *gps; - register int len = 0, type = 0, dlen = 0; + int len = 0, type = 0, dlen = 0; static enum proto_type protoid = ST_MAX; struct st_data_s *st_gdata = (struct st_data_s *)disc_data; @@ -918,34 +909,27 @@ static void st_tty_flush_buffer(struct tty_struct *tty) return; } +static struct tty_ldisc_ops st_ldisc_ops = { + .magic = TTY_LDISC_MAGIC, + .name = "n_st", + .open = st_tty_open, + .close = st_tty_close, + .receive_buf = st_tty_receive, + .write_wakeup = st_tty_wakeup, + .flush_buffer = st_tty_flush_buffer, + .owner = THIS_MODULE +}; + /********************************************************************/ int st_core_init(struct st_data_s **core_data) { struct st_data_s *st_gdata; long err; - static struct tty_ldisc_ops *st_ldisc_ops; - - /* populate and register to TTY line discipline */ - st_ldisc_ops = kzalloc(sizeof(*st_ldisc_ops), GFP_KERNEL); - if (!st_ldisc_ops) { - pr_err("no mem to allocate"); - return -ENOMEM; - } - st_ldisc_ops->magic = TTY_LDISC_MAGIC; - st_ldisc_ops->name = "n_st"; /*"n_hci"; */ - st_ldisc_ops->open = st_tty_open; - st_ldisc_ops->close = st_tty_close; - st_ldisc_ops->receive_buf = st_tty_receive; - st_ldisc_ops->write_wakeup = st_tty_wakeup; - st_ldisc_ops->flush_buffer = st_tty_flush_buffer; - st_ldisc_ops->owner = THIS_MODULE; - - err = tty_register_ldisc(N_TI_WL, st_ldisc_ops); + err = tty_register_ldisc(N_TI_WL, &st_ldisc_ops); if (err) { pr_err("error registering %d line discipline %ld", N_TI_WL, err); - kfree(st_ldisc_ops); return err; } pr_debug("registered n_shared line discipline"); @@ -956,7 +940,6 @@ int st_core_init(struct st_data_s **core_data) err = tty_unregister_ldisc(N_TI_WL); if (err) pr_err("unable to un-register ldisc %ld", err); - kfree(st_ldisc_ops); err = -ENOMEM; return err; } @@ -970,22 +953,6 @@ int st_core_init(struct st_data_s **core_data) /* Locking used in st_int_enqueue() to avoid multiple execution */ spin_lock_init(&st_gdata->lock); - /* ldisc_ops ref to be only used in __exit of module */ - st_gdata->ldisc_ops = st_ldisc_ops; - -#if 0 - err = st_kim_init(); - if (err) { - pr_err("error during kim initialization(%ld)", err); - kfree(st_gdata); - err = tty_unregister_ldisc(N_TI_WL); - if (err) - pr_err("unable to un-register ldisc"); - kfree(st_ldisc_ops); - return -1; - } -#endif - err = st_ll_init(st_gdata); if (err) { pr_err("error during st_ll initialization(%ld)", err); @@ -993,7 +960,6 @@ int st_core_init(struct st_data_s **core_data) err = tty_unregister_ldisc(N_TI_WL); if (err) pr_err("unable to un-register ldisc"); - kfree(st_ldisc_ops); return -1; } *core_data = st_gdata; @@ -1007,11 +973,7 @@ void st_core_exit(struct st_data_s *st_gdata) err = st_ll_deinit(st_gdata); if (err) pr_err("error during deinit of ST LL %ld", err); -#if 0 - err = st_kim_deinit(); - if (err) - pr_err("error during deinit of ST KIM %ld", err); -#endif + if (st_gdata != NULL) { /* Free ST Tx Qs and skbs */ skb_queue_purge(&st_gdata->txq); @@ -1022,7 +984,6 @@ void st_core_exit(struct st_data_s *st_gdata) err = tty_unregister_ldisc(N_TI_WL); if (err) pr_err("unable to un-register ldisc %ld", err); - kfree(st_gdata->ldisc_ops); /* free the global data pointer */ kfree(st_gdata); } diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 6d23a7222627..73b6c8b0e869 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -75,7 +75,7 @@ const unsigned char *protocol_names[] = { }; #define MAX_ST_DEVICES 3 /* Imagine 1 on each UART for now */ -struct platform_device *st_kim_devices[MAX_ST_DEVICES]; +static struct platform_device *st_kim_devices[MAX_ST_DEVICES]; /**********************************************************************/ /* internal functions */ @@ -157,17 +157,18 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len) void kim_int_recv(struct kim_data_s *kim_gdata, const unsigned char *data, long count) { - register char *ptr; + const unsigned char *ptr; struct hci_event_hdr *eh; - register int len = 0, type = 0; + int len = 0, type = 0; pr_debug("%s", __func__); /* Decode received bytes here */ - ptr = (char *)data; + ptr = data; if (unlikely(ptr == NULL)) { pr_err(" received null from TTY "); return; } + while (count) { if (kim_gdata->rx_count) { len = min_t(unsigned int, kim_gdata->rx_count, count); @@ -231,7 +232,7 @@ void kim_int_recv(struct kim_data_s *kim_gdata, static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) { unsigned short version = 0, chip = 0, min_ver = 0, maj_ver = 0; - char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 }; + const char read_ver_cmd[] = { 0x01, 0x01, 0x10, 0x00 }; pr_debug("%s", __func__); @@ -278,8 +279,8 @@ static long download_firmware(struct kim_data_s *kim_gdata) { long err = 0; long len = 0; - register unsigned char *ptr = NULL; - register unsigned char *action_ptr = NULL; + unsigned char *ptr = NULL; + unsigned char *action_ptr = NULL; unsigned char bts_scr_name[30] = { 0 }; /* 30 char long bts scr name? */ err = read_local_version(kim_gdata, bts_scr_name); diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 2a5acf599598..4c7be2263011 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h @@ -101,7 +101,6 @@ extern long st_unregister(enum proto_type); * can occur , where as during other times other events CH8, CH9 * can occur. * @tty: tty provided by the TTY core for line disciplines. - * @ldisc_ops: the procedures that this line discipline registers with TTY. * @tx_skb: If for some reason the tty's write returns lesser bytes written * then to maintain the rest of data to be written on next instance. * This needs to be protected, hence the lock inside wakeup func. @@ -132,7 +131,6 @@ extern long st_unregister(enum proto_type); struct st_data_s { unsigned long st_state; struct tty_struct *tty; - struct tty_ldisc_ops *ldisc_ops; struct sk_buff *tx_skb; #define ST_TX_SENDING 1 #define ST_TX_WAKEUP 2 -- cgit v1.2.3-59-g8ed1b