/* * V4L2 flash LED sub-device registration helpers. * * Copyright (C) 2015 Samsung Electronics Co., Ltd * Author: Jacek Anaszewski * * 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. */ #ifndef _V4L2_FLASH_H #define _V4L2_FLASH_H #include #include struct led_classdev_flash; struct led_classdev; struct v4l2_flash; enum led_brightness; /** * struct v4l2_flash_ctrl_data - flash control initialization data, filled * basing on the features declared by the LED flash * class driver in the v4l2_flash_config * @config: initialization data for a control * @cid: contains v4l2 flash control id if the config * field was initialized, 0 otherwise */ struct v4l2_flash_ctrl_data { struct v4l2_ctrl_config config; u32 cid; }; /** * struct v4l2_flash_ops - V4L2 flash operations * * @external_strobe_set: Setup strobing the flash by hardware pin state * assertion. * @intensity_to_led_brightness: Convert intensity to brightness in a device * specific manner * @led_brightness_to_intensity: convert brightness to intensity in a device * specific manner. */ struct v4l2_flash_ops { int (*external_strobe_set)(struct v4l2_flash *v4l2_flash, bool enable); enum led_brightness (*intensity_to_led_brightness) (struct v4l2_flash *v4l2_flash, s32 intensity); s32 (*led_brightness_to_intensity) (struct v4l2_flash *v4l2_flash, enum led_brightness); }; /** * struct v4l2_flash_config - V4L2 Flash sub-device initialization data * @dev_name: the name of the media entity, * unique in the system * @torch_intensity: constraints for the LED in torch mode * @indicator_intensity: constraints for the indicator LED * @flash_faults: bitmask of flash faults that the LED flash class * device can report; corresponding LED_FAULT* bit * definitions are available in the header file * * @has_external_strobe: external strobe capability */ struct v4l2_flash_config { char dev_name[32]; struct led_flash_setting torch_intensity; struct led_flash_setting indicator_intensity; u32 flash_faults; unsigned int has_external_strobe:1; }; /** * struct v4l2_flash - Flash sub-device context * @fled_cdev: LED flash class device controlled by this sub-device * @iled_cdev: LED class device representing indicator LED associated * with the LED flash class device * @ops: V4L2 specific flash ops * @sd: V4L2 sub-device * @hdl: flash controls handler * @ctrls: array of pointers to controls, whose values define * the sub-device state */ struct v4l2_flash { struct led_classdev_flash *fled_cdev; struct led_classdev_flash *iled_cdev; const struct v4l2_flash_ops *ops; struct v4l2_subdev sd; struct v4l2_ctrl_handler hdl; struct v4l2_ctrl **ctrls; }; static inline struct v4l2_flash *v4l2_subdev_to_v4l2_flash( struct v4l2_subdev *sd) { return container_of(sd, struct v4l2_flash, sd); } static inline struct v4l2_flash *v4l2_ctrl_to_v4l2_flash(struct v4l2_ctrl *c) { return container_of(c->handler, struct v4l2_flash, hdl); } #if IS_ENABLED(CONFIG_V4L2_FLASH_LED_CLASS) /** * v4l2_flash_init - initialize V4L2 flash led sub-device * @dev: flash device, e.g. an I2C device * @of_node: of_node of the LED, may be NULL if the same as device's * @fled_cdev: LED flash class device to wrap * @iled_cdev: LED flash class device representing indicator LED associated * with fled_cdev, may be NULL * @ops: V4L2 Flash device ops * @config: initialization data for V4L2 Flash sub-device * * Create V4L2 Flash sub-device wrapping given LED subsystem device. * * Returns: A valid pointer, or, when an error occurs, the return * value is encoded using ERR_PTR(). Use IS_ERR() to check and * PTR_ERR() to obtain the numeric return value. */ struct v4l2_flash *v4l2_flash_init( struct device *dev, struct device_node *of_node, struct led_classdev_flash *fled_cdev, struct led_classdev_flash *iled_cdev, const struct v4l2_flash_ops *ops, struct v4l2_flash_config *config); /** * v4l2_flash_release - release V4L2 Flash sub-device * @v4l2_flash: the V4L2 Flash sub-device to release * * Release V4L2 Flash sub-device. */ void v4l2_flash_release(struct v4l2_flash *v4l2_flash); #else static inline struct v4l2_flash *v4l2_flash_init( struct device *dev, struct device_node *of_node, struct led_classdev_flash *fled_cdev, struct led_classdev_flash *iled_cdev, const struct v4l2_flash_ops *ops, struct v4l2_flash_config *config) { return NULL; } static inline void v4l2_flash_release(struct v4l2_flash *v4l2_flash) { } #endif /* CONFIG_V4L2_FLASH_LED_CLASS */ #endif /* _V4L2_FLASH_H */ Ard Biesheuvel <ard.biesheuvel@linaro.org>2017-02-01 17:45:02 +0000 committerIngo Molnar <mingo@kernel.org>2017-02-01 21:17:49 +0100 commitc8f325a59cfc718d13a50fbc746ed9b415c25e92 (patch) treed53fbdac9d0781e39a13b2ac6b2bd258cf3b4140 /net/ipv6/netfilter/nf_conntrack_reasm.c parentbf29bddf0417a4783da3b24e8c9e017ac649326f (diff)
efi/fdt: Avoid FDT manipulation after ExitBootServices()
Some AArch64 UEFI implementations disable the MMU in ExitBootServices(), after which unaligned accesses to RAM are no longer supported. Commit: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") fixed an issue in the memory map handling of the stub FDT code, but inadvertently created an issue with such firmware, by moving some of the FDT manipulation to after the invocation of ExitBootServices(). Given that the stub's libfdt implementation uses the ordinary, accelerated string functions, which rely on hardware handling of unaligned accesses, manipulating the FDT with the MMU off may result in alignment faults. So fix the situation by moving the update_fdt_memmap() call into the callback function invoked by efi_exit_boot_services() right before it calls the ExitBootServices() UEFI service (which is arguably a better place for it anyway) Note that disabling the MMU in ExitBootServices() is not compliant with the UEFI spec, and carries great risk due to the fact that switching from cached to uncached memory accesses halfway through compiler generated code (i.e., involving a stack) can never be done in a way that is architecturally safe. Fixes: abfb7b686a3e ("efi/libstub/arm*: Pass latest memory map to the kernel") Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Riku Voipio <riku.voipio@linaro.org> Cc: <stable@vger.kernel.org> Cc: mark.rutland@arm.com Cc: linux-efi@vger.kernel.org Cc: matt@codeblueprint.co.uk Cc: leif.lindholm@linaro.org Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1485971102-23330-2-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'net/ipv6/netfilter/nf_conntrack_reasm.c')