[PATCH] Staging: pi433: rf69: fixed a multi line comment issue

2018-07-19 Thread Mark Railton
Fixed a coding style issue

Signed-off-by: Mark Railton 
---
 drivers/staging/pi433/rf69.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 90280e9b006d..14826fb505dd 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -618,7 +618,8 @@ bool rf69_get_flag(struct spi_device *spi, enum flag flag)
case fifo_full:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_FULL);
 /* case fifo_not_empty:
- * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY); */
+ * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
+ */
case fifo_empty:
return !(rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
case fifo_level_below_threshold:
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] Drivers: Staging: pi433: remove unsused case

2018-07-21 Thread Mark Railton
Removed a commented out case statement

Signed-off-by: Mark Railton 
---
 drivers/staging/pi433/rf69.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
index 14826fb505dd..b2d69af6d3fe 100644
--- a/drivers/staging/pi433/rf69.c
+++ b/drivers/staging/pi433/rf69.c
@@ -617,9 +617,6 @@ bool rf69_get_flag(struct spi_device *spi, enum flag flag)
return (rf69_read_reg(spi, REG_IRQFLAGS1) & 
MASK_IRQFLAGS1_SYNC_ADDRESS_MATCH);
case fifo_full:
return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_FULL);
-/* case fifo_not_empty:
- * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
- */
case fifo_empty:
return !(rf69_read_reg(spi, REG_IRQFLAGS2) & 
MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
case fifo_level_below_threshold:
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: pi433: rf69: fixed a multi line comment issue

2018-07-21 Thread Mark Railton
On Sat, Jul 21, 2018 at 08:53:21AM +0200, Greg KH wrote:
> On Thu, Jul 19, 2018 at 10:43:18PM +0100, Mark Railton wrote:
> > Fixed a coding style issue
> > 
> > Signed-off-by: Mark Railton 
> > ---
> >  drivers/staging/pi433/rf69.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/pi433/rf69.c b/drivers/staging/pi433/rf69.c
> > index 90280e9b006d..14826fb505dd 100644
> > --- a/drivers/staging/pi433/rf69.c
> > +++ b/drivers/staging/pi433/rf69.c
> > @@ -618,7 +618,8 @@ bool rf69_get_flag(struct spi_device *spi, enum flag 
> > flag)
> > case fifo_full:
> > return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
> > MASK_IRQFLAGS2_FIFO_FULL);
> >  /* case fifo_not_empty:
> > - * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
> > MASK_IRQFLAGS2_FIFO_NOT_EMPTY); */
> > + * return (rf69_read_reg(spi, REG_IRQFLAGS2) & 
> > MASK_IRQFLAGS2_FIFO_NOT_EMPTY);
> > + */
> 
> Ick, just delete this whole thing if it isn't being used, don't make it
> prettier :)
> 
> thanks,
> 
> greg k-h

Apologies, should have realised that to begin with. Have sent a new
patch with the correct change.

Thanks,

Mark
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] ATOMISP: Tidies up code warnings and errors in file

2017-05-08 Thread Mark Railton
Cleared up some errors and warnings in
drivers/staging/media/atomisp/i2c/ap1302.c

Signed-off-by: Mark Railton 
---
 drivers/staging/media/atomisp/i2c/ap1302.c | 83 ++
 1 file changed, 50 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/media/atomisp/i2c/ap1302.c 
b/drivers/staging/media/atomisp/i2c/ap1302.c
index bacffbe..8c33a35 100644
--- a/drivers/staging/media/atomisp/i2c/ap1302.c
+++ b/drivers/staging/media/atomisp/i2c/ap1302.c
@@ -11,11 +11,6 @@
  * 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., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- *
  */
 
 #include "../include/linux/atomisp.h"
@@ -162,9 +157,11 @@ static struct ap1302_context_info context_info[] = {
{CNTX_HINF_CTRL, AP1302_REG16, "hinf_ctrl"},
 };
 
-/* This array stores the description list for metadata.
-   The metadata contains exposure settings and face
-   detection results. */
+/*
+ *  This array stores the description list for metadata.
+ *  The metadata contains exposure settings and face
+ *  detection results.
+ */
 static u16 ap1302_ss_list[] = {
0xb01c, /* From 0x0186 with size 0x1C are exposure settings. */
0x0186,
@@ -213,6 +210,7 @@ static int ap1302_i2c_write_reg(struct v4l2_subdev *sd,
struct ap1302_device *dev = to_ap1302_device(sd);
struct i2c_client *client = v4l2_get_subdevdata(sd);
int ret;
+
if (len == AP1302_REG16)
ret = regmap_write(dev->regmap16, reg, val);
else if (len == AP1302_REG32)
@@ -236,11 +234,13 @@ static u16
 ap1302_calculate_context_reg_addr(enum ap1302_contexts context, u16 offset)
 {
u16 reg_addr;
-   /* The register offset is defined according to preview/video registers.
-  Preview and video context have the same register definition.
-  But snapshot context does not have register S1_SENSOR_MODE.
-  When setting snapshot registers, if the offset exceeds
-  S1_SENSOR_MODE, the actual offset needs to minus 2. */
+   /*
+*  The register offset is defined according to preview/video registers.
+*  Preview and video context have the same register definition.
+*  But snapshot context does not have register S1_SENSOR_MODE.
+*  When setting snapshot registers, if the offset exceeds
+*  S1_SENSOR_MODE, the actual offset needs to minus 2.
+*/
if (context == CONTEXT_SNAPSHOT) {
if (offset == CNTX_S1_SENSOR_MODE)
return 0;
@@ -261,6 +261,7 @@ static int ap1302_read_context_reg(struct v4l2_subdev *sd,
 {
struct ap1302_device *dev = to_ap1302_device(sd);
u16 reg_addr = ap1302_calculate_context_reg_addr(context, offset);
+
if (reg_addr == 0)
return -EINVAL;
return ap1302_i2c_read_reg(sd, reg_addr, len,
@@ -272,6 +273,7 @@ static int ap1302_write_context_reg(struct v4l2_subdev *sd,
 {
struct ap1302_device *dev = to_ap1302_device(sd);
u16 reg_addr = ap1302_calculate_context_reg_addr(context, offset);
+
if (reg_addr == 0)
return -EINVAL;
return ap1302_i2c_write_reg(sd, reg_addr, len,
@@ -284,7 +286,9 @@ static int ap1302_dump_context_reg(struct v4l2_subdev *sd,
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ap1302_device *dev = to_ap1302_device(sd);
int i;
+
dev_dbg(&client->dev, "Dump registers for context[%d]:\n", context);
+
for (i = 0; i < ARRAY_SIZE(context_info); i++) {
struct ap1302_context_info *info = &context_info[i];
u8 *var = (u8 *)&dev->cntx_config[context] + info->offset;
@@ -308,6 +312,7 @@ static int ap1302_request_firmware(struct v4l2_subdev *sd)
struct i2c_client *client = v4l2_get_subdevdata(sd);
struct ap1302_device *dev = to_ap1302_device(sd);
int ret;
+
ret = request_firmware(&dev->fw, "ap1302_fw.bin", &client->dev);
if (ret)
dev_err(&client->dev,
@@ -315,12 +320,14 @@ static int ap1302_request_firmware(struct v4l2_subdev *sd)
return ret;
 }
 
-/* When loading firmware, host writes firmware data from address 0x8000.
-   When the address reaches 0x9FFF, the next address should return to 0x8000.
-   This function handles this address window and load firmware data to AP1302.
-   win_pos indicates the offset within this window. Firmware loading procedure
-   may call this function several times. win_pos records the current position
-   that has been written to.*/
+/*
+ *  When loading firmware, host writes firmware data from address 0x8000.
+ *  When the address reaches 0