Commit Graph

23 Commits

Author SHA1 Message Date
Okash Khawaja ca693dcd5c staging: speakup: make input functionality swappable
This moves functions which take input from external synth, into struct
spk_io_ops. The calling code then uses serial implementation of those methods
through spk_io_ops. That way we can add a parallel TTY-based implementation and
simply replace serial with TTY. That is what the next patch in this series does.

speakup_decext.c has get_last_char function which reads the most recent
available character from the synth. This patch changes that by defining
read_buff_add callback method of spk_syth and letting that update the last_char
global character read from the synth. read_buff_add is called from ISR, so
there is a possibility for last_char to be stale. Therefore it is marked as
volatile. It also pulls a repeated get_index implementation into synth.c, to
be used as a utility function.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-15 12:31:43 +02:00
Linus Torvalds 291b38a756 Annotation of module parameters that specify device settings
-----BEGIN PGP SIGNATURE-----
 
 iQIVAwUAWPiW6vSw1s6N8H32AQLOrw/+NTqGf7bjq+64YKS6NfR0XDgE+wNJltGO
 ck7zJW3NHIg76RNu8s0I9xg5aVmwizz3Z5DGROZquaolnezux4tQihZ3AFyxIzLc
 +Y3WHYagcML7yFfjl/WznCLRD5EW3yPln4lCvQO0nW/xICRYeRI057JaIbi2Dtek
 BhcXt3c4AjXDLdYJkgtHV3p2R2mt8hcdFdWqqx6s7JaIThZNRGNzxAgtbcB9k5IW
 HVG9ZEIL73VBYWHrYivzjHYF5rBnNCPt87eOwDQeTOSkhv8te+u9k+bH8vxZw1T0
 XUtDrLBndKiuVo2GUfLkkF8LItx3Q9eLCJYy0joaIliyPqTEsPx9KjQ+Af0cxS9s
 ZPCZ5SYf96stKmDeL5xaMfrAmeyVHJ4lc4JTOqdzbIT8blsOSfYO/03p0ALShSDv
 /RQLaKGlf8Bjoy8PwKFcXb4sIDufcd/U1Av/EMFXxOfgN/u2JUkGKq6EaIM5B68L
 fHPje+aR9VNELPmPjwNOWtmN4I79EH3EItQf7zv0KG+UeKhcHLx/EAcSJ3ZRKEkH
 Lathg7pPOEJGArPiVO79TZzBG01ADn1aiwv65XObMzNZ+54xI/mN/Y1DNF/kL5jU
 XzvNzEjFt8mwMIZGVNdAt4+pDyMfIZGZSyUkSRKFnaQZMIvQrfQIU9RLBYLX5eOx
 +/p0VkIwDpg=
 =lbS7
 -----END PGP SIGNATURE-----

Merge tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull hw lockdown support from David Howells:
 "Annotation of module parameters that configure hardware resources
  including ioports, iomem addresses, irq lines and dma channels.

  This allows a future patch to prohibit the use of such module
  parameters to prevent that hardware from being abused to gain access
  to the running kernel image as part of locking the kernel down under
  UEFI secure boot conditions.

  Annotations are made by changing:

        module_param(n, t, p)
        module_param_named(n, v, t, p)
        module_param_array(n, t, m, p)

  to:

        module_param_hw(n, t, hwtype, p)
        module_param_hw_named(n, v, t, hwtype, p)
        module_param_hw_array(n, t, hwtype, m, p)

  where the module parameter refers to a hardware setting

  hwtype specifies the type of the resource being configured. This can
  be one of:

        ioport          Module parameter configures an I/O port
        iomem           Module parameter configures an I/O mem address
        ioport_or_iomem Module parameter could be either (runtime set)
        irq             Module parameter configures an I/O port
        dma             Module parameter configures a DMA channel
        dma_addr        Module parameter configures a DMA buffer address
        other           Module parameter configures some other value

  Note that the hwtype is compile checked, but not currently stored (the
  lockdown code probably won't require it). It is, however, there for
  future use.

  A bonus is that the hwtype can also be used for grepping.

  The intention is for the kernel to ignore or reject attempts to set
  annotated module parameters if lockdown is enabled. This applies to
  options passed on the boot command line, passed to insmod/modprobe or
  direct twiddling in /sys/module/ parameter files.

  The module initialisation then needs to handle the parameter not being
  set, by (1) giving an error, (2) probing for a value or (3) using a
  reasonable default.

  What I can't do is just reject a module out of hand because it may
  take a hardware setting in the module parameters. Some important
  modules, some ipmi stuff for instance, both probe for hardware and
  allow hardware to be manually specified; if the driver is aborts with
  any error, you don't get any ipmi hardware.

  Further, trying to do this entirely in the module initialisation code
  doesn't protect against sysfs twiddling.

  [!] Note that in and of itself, this series of patches should have no
      effect on the the size of the kernel or code execution - that is
      left to a patch in the next series to effect. It does mark
      annotated kernel parameters with a KERNEL_PARAM_FL_HWPARAM flag in
      an already existing field"

* tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (38 commits)
  Annotate hardware config module parameters in sound/pci/
  Annotate hardware config module parameters in sound/oss/
  Annotate hardware config module parameters in sound/isa/
  Annotate hardware config module parameters in sound/drivers/
  Annotate hardware config module parameters in fs/pstore/
  Annotate hardware config module parameters in drivers/watchdog/
  Annotate hardware config module parameters in drivers/video/
  Annotate hardware config module parameters in drivers/tty/
  Annotate hardware config module parameters in drivers/staging/vme/
  Annotate hardware config module parameters in drivers/staging/speakup/
  Annotate hardware config module parameters in drivers/staging/media/
  Annotate hardware config module parameters in drivers/scsi/
  Annotate hardware config module parameters in drivers/pcmcia/
  Annotate hardware config module parameters in drivers/pci/hotplug/
  Annotate hardware config module parameters in drivers/parport/
  Annotate hardware config module parameters in drivers/net/wireless/
  Annotate hardware config module parameters in drivers/net/wan/
  Annotate hardware config module parameters in drivers/net/irda/
  Annotate hardware config module parameters in drivers/net/hamradio/
  Annotate hardware config module parameters in drivers/net/ethernet/
  ...
2017-05-10 19:13:03 -07:00
David Howells dbf05cb05f Annotate hardware config module parameters in drivers/staging/speakup/
When the kernel is running in secure boot mode, we lock down the kernel to
prevent userspace from modifying the running kernel image.  Whilst this
includes prohibiting access to things like /dev/mem, it must also prevent
access by means of configuring driver modules in such a way as to cause a
device to access or modify the kernel image.

To this end, annotate module_param* statements that refer to hardware
configuration and indicate for future reference what type of parameter they
specify.  The parameter parser in the core sees this information and can
skip such parameters with an error message if the kernel is locked down.
The module initialisation then runs as normal, but just sees whatever the
default values for those parameters is.

Note that we do still need to do the module initialisation because some
drivers have viable defaults set in case parameters aren't specified and
some drivers support automatic configuration (e.g. PNP or PCI) in addition
to manually coded parameters.

This patch annotates drivers in drivers/staging/speakup/.

Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: speakup@linux-speakup.org
cc: devel@driverdev.osuosl.org
2017-04-20 12:02:32 +01:00
Arushi Singhal 205931ea88 staging: speakup: spaces preferred around operator
Fixed the checkpatch.pl issues like:
CHECK: spaces preferred around that '&' (ctx:VxV)
CHECK: spaces preferred around that '|' (ctx:VxV)
CHECK: spaces preferred around that '-' (ctx:VxV)
CHECK: spaces preferred around that '+' (ctx:VxV)
etc.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-23 14:20:41 +01:00
Arushi Singhal defaa9ad58 staging: speakup: Add blank line after declarations
Patch fixes the warnings reported by checkpatch.pl
for please use a blank line after function/struct/union/enum
declarations.
Add a blank line after enum and struct declarations.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16 11:15:10 +09:00
Okash Khawaja a50ef31654 staging: speakup: move spk_stop_serial_interrupt into synth-specific release function
This moves call to spk_stop_serial_interrupt() function out of synth_release()
and into release() method of specific spk_synth instances. This is because
the spk_stop_serial_interrupt() call is specific to current serial i/o
implementation. Moving it into each synth's release() method gives the
decision of calling  spk_stop_serial_interrupt() to that synth.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16 11:12:02 +09:00
Okash Khawaja 1e441594e5 staging: speakup: add spk_io_ops struct to spk_synth
This patch adds spk_io_ops struct which contain those methods whose job is to
communicate with synth device. Currently, all comms with external synth
device use raw serial i/o. The idea is to group all methods which do the
actual communication with external device into this new struct. Then migrating
a serial-based synth over to an alternative to raw serial i/o will mean
swapping serial spk_io_ops instance with the io_ops instance of the new
method, making the migration simpler.

At the moment, this struct only contains one method, synth_out but more will
be added in future when migrating synths which require input functionality.
Also at the moment, synth_out method has one implementation which uses
serial i/o. Plan is to add an alternative.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-16 11:11:22 +09:00
Samuel Thibault 89fc2ae80b speakup: extend synth buffer to 16bit unicode characters
This extends the synth buffer slots to 16bit, so as to hold 16bit
unicode characters.

synth_buffer_getc and synth_buffer_peek now return 16bit characters.
Speech synthesizers which do not support characters beyond latin1 can
use the synth_buffer_skip_nonlatin1() helper to skip the non-latin1
characters before getting or peeking. All synthesizers are made to use
it for now.

This makes synth_buffer_add take a 16bit character. For simplicity for
now, synth_printf is left to using latin1 formats and strings.
synth_putwc, synth_putwc_s, synth_putws and synth_putws_s helpers are
however added to put 16bit characters and strings.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Reviewed-by: Chris Brannon <chris@the-brannons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-09 17:28:20 +01:00
Arushi Singhal 4d0bdcb10c staging: rtl8192e: Aligning the * on each line in block comments
This patch fixes the issue by aligning the * on each line in block
comments.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-02-12 13:46:57 +01:00
Derek Robson 73c3700e86 Staging: speakup - syle fix permissions to octal
A style fix across whole driver.
changed permissions to octal style, found using checkpatch

Signed-off-by: Derek Robson <robsonde@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-31 09:30:58 +01:00
Shraddha Barke 5cb10d42de Staging: speakup: Remove FSF mailing address
FSF mailing address is no longer required to be specified. Hence
removed.
Detected using checkpatch

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-01-28 22:40:31 -08:00
Vaishali Thakkar ae89faccc6 Staging: speakup: Use module_spk_synth
Macro module_spk_synth can be used for speakup drivers
whose init and exit paths does only module registrations.
So, here remove some boilerplate code by using
module_spk_synth.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-20 13:27:34 +01:00
Linus Torvalds 29afc4e9a4 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree changes from Jiri Kosina:
 "Patches from trivial.git that keep the world turning around.

  Mostly documentation and comment fixes, and a two corner-case code
  fixes from Alan Cox"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial:
  kexec, Kconfig: spell "architecture" properly
  mm: fix cleancache debugfs directory path
  blackfin: mach-common: ints-priority: remove unused function
  doubletalk: probe failure causes OOPS
  ARM: cache-l2x0.c: Make it clear that cache-l2x0 handles L310 cache controller
  msdos_fs.h: fix 'fields' in comment
  scsi: aic7xxx: fix comment
  ARM: l2c: fix comment
  ibmraid: fix writeable attribute with no store method
  dynamic_debug: fix comment
  doc: usbmon: fix spelling s/unpriviledged/unprivileged/
  x86: init_mem_mapping(): use capital BIOS in comment
2015-02-10 18:57:15 -08:00
Alan Cox 7aa4d5c8ff doubletalk: probe failure causes OOPS
The code bothers to probe for the device, but on failing to find it proceeds
to try and release a NULL resource, thereby ruining it's prior good
behaviour

Resolves-Bug: https://bugzilla.kernel.org/show_bug.cgi?id=88581
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2015-01-20 13:56:05 +01:00
Esra Altintas c65cfb5e5a staging: speakup: remove jiffies comparison using time_after_eq() in speakup_dtlk.c
The following patch fixes the checkpatch.pl warning:
WARNING: Comparing jiffies is almost always wrong; prefer time_after,
time_before and friends

Signed-off-by: Esra Altintas <es.altintas@gmail.com>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:12 +08:00
Domagoj Trsan 8e69a81106 staging: speakup: fix missing blank lines after declarations
Signed-off-by: Domagoj Trsan <domagoj.trsan@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-09-11 14:54:51 -07:00
Rusty Russell d901aaa723 drivers/staging/speakup/: avoid world-writable sysfs files.
In line with practice for module parameters, we're adding a build-time
check that sysfs files aren't world-writable.

Cc: Christopher Brannon <chris@the-brannons.com>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-05-23 20:31:22 +09:00
Rusty Russell 22c9bcad85 staging: fix up speakup kobject mode
It uses the unnecessary S_IFREG bit which broke when my
stricter-checking-for-mode patch went in.

Since we're fixing it anyway, the extra level of indirection is
confusing for readers (ROOT_W == rw-r--r-- for example).

Also, many of these are other-writable.  Is that really intended?

I'll-queue-this-patch-up-in-a-bit-by: Greg KH <greg@kroah.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-04-01 14:20:26 +10:30
Sachin Kamat 61b7a28428 Staging: speakup/speakup_dtlk: Return NULL instead of 0
The function returns a pointer. Hence return NULL instead of 0.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-22 15:35:38 -07:00
William Hubbs 62c8c835ed staging: speakup: dtlk: remove custom locking macros
Signed-off-by: William Hubbs <w.d.hubbs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16 16:14:47 -07:00
Samuel Thibault ca2beaf84d staging: speakup: Prefix externally-visible symbols
This prefixes all externally-visible symbols of speakup with "spk_".

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-07 14:06:31 -08:00
Christopher Brannon 2c9e0cb07f staging: speakup: speakup_dtlk.c: style fixes
* Clean this file based on reports from checkpatch.pl.
* Replace function-like macros with inline functions.
* Simplify some boolean expressions.

Signed-off-by: Christopher Brannon <chris@the-brannons.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-15 12:22:36 -07:00
William Hubbs c6e3fd22cd Staging: add speakup to the staging directory
Speakup is a kernel based screen review package for the linux operating
system.  It allows blind users to interact with applications on the
linux console by means of synthetic speech.

The authors and maintainers of this code include the following:

Kirk Reiser, Andy Berdan, John Covici, Brian and
David Borowski, Christopher Brannon, Samuel Thibault and William Hubbs.

Signed-off-by: William Hubbs <w.d.hubbs@gmail.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-10-07 19:22:31 -07:00