From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 18 Oct 2013 15:58:44 +0200 Subject: [U-Boot] [PATCH 1/4] usb: ums: move ums code from trats to Samsung common directory In-Reply-To: <52611DD3.5010002@samsung.com> References: <1381929675-26165-1-git-send-email-p.marczak@samsung.com> <201310171939.10867.marex@denx.de> <52611DD3.5010002@samsung.com> Message-ID: <201310181558.45116.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Przemyslaw Marczak, > Hello Marek, > Thank you for fast reply. > > On 10/17/2013 07:39 PM, Marek Vasut wrote: > > Dear Przemyslaw Marczak, > > > >> UMS init was implemented in trats board file but mostly it comprises > >> common code. Due to that it has been moved to common/ums.c to avoid > >> code duplication in the future. > >> > >> Changes: > >> - move ums initialization code from trats to common/ums.c > >> - remove unused CONFIG_USB_GADGET_MASS_STORAGE from trats.h > >> > >> Signed-off-by: Przemyslaw Marczak > >> Cc: Marek Vasut > >> Cc: Minkyu Kang > >> Cc: Lukasz Majewski > >> --- > >> > >> board/samsung/common/Makefile | 1 + > >> board/samsung/common/ums.c | 66 > >> > >> +++++++++++++++++++++++++++++++++++++++++ board/samsung/trats/trats.c > >> | > >> > >> 62 -------------------------------------- include/configs/trats.h > >> | > >> > >> 2 -- > >> > >> 4 files changed, 67 insertions(+), 64 deletions(-) > >> create mode 100644 board/samsung/common/ums.c > >> > >> diff --git a/board/samsung/common/Makefile > >> b/board/samsung/common/Makefile index ad7564c..d122169 100644 > >> --- a/board/samsung/common/Makefile > >> +++ b/board/samsung/common/Makefile > >> @@ -11,6 +11,7 @@ LIB = $(obj)libsamsung.o > >> > >> COBJS-$(CONFIG_SOFT_I2C_MULTI_BUS) += multi_i2c.o > >> COBJS-$(CONFIG_THOR_FUNCTION) += thor.o > >> > >> +COBJS-$(CONFIG_CMD_USB_MASS_STORAGE) += ums.o > >> > >> SRCS := $(COBJS-y:.o=.c) > >> OBJS := $(addprefix $(obj),$(COBJS-y)) > >> > >> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c > >> new file mode 100644 > >> index 0000000..506f4b5 > >> --- /dev/null > >> +++ b/board/samsung/common/ums.c > >> @@ -0,0 +1,66 @@ > >> +/* > >> + * Copyright (C) 2013 Samsung Electronics > >> + * Lukasz Majewski > >> + * > >> + * SPDX-License-Identifier: GPL-2.0+ > >> + */ > >> + > >> +#include > >> +#include > >> +#include > >> + > >> +static int ums_read_sector(struct ums_device *ums_dev, > >> + ulong start, lbaint_t blkcnt, void *buf) > >> +{ > >> + if (ums_dev->mmc->block_dev.block_read(ums_dev->dev_num, > >> + start + ums_dev->offset, blkcnt, > >> + buf) != blkcnt) > > > > This looks like hell. > > > > typeT block_dev = ums_dev->mmc; > > int ret; > > > > ret = block_dev->block_read(....); > > > > return ret; > > Ok, you're right - I will fix it in next patch set. > > > Is it necessary to return -1? Why ? > > It's only because of ums gadged driver design but it is easy to simplify. A proper errno.h patch would be good here. > > Please fix the whole thing in-place first, then rebase this migration > > patch on top of the fix. > > OK, migration patch will be at the top. > > And one more. Do you want me to make it applicable to usb-next or > usb-master tree? -next please.